0

I'm transferring to a Windows computer, and need to run my Makefile written on Linux to create a library.

    HEADER=/usr/include
    INCLUDEDIR=include
    LIB_NAME=libpce.so
    SO_NAME=$(LIB_NAME).3.2
    REAL_NAME=$(SO_NAME).5
    SHARED_LIB=bin/$(REAL_NAME)

    mkdir $(HEADER)/libpce
    cp $(INCLUDEDIR)/pce.h $(HEADER)/libpce
    chmod 644 $(HEADER)/libpce/pce.h
    cp $(SHARED_LIB) /usr/lib/
    ln -f -s $(SO_NAME) /usr/lib/$(LIB_NAME)
    chmod 644 /usr/lib/$(REAL_NAME)
    ldconfig

The output of running it through a cygwin terminal on windows gives an error as ldconfig is not defined, so I tried running them without the ldconfig command at the end.

Then when I need to run my other Makefile to compile my code with argument -lpce, it says -lpce is not defined. I feel like ldconfig was essential, but I'm not able to run it on Windows.

Is there any way to execute this command on Windows? Is this the problem, or could it potentially be an issue with the /usr/lib/ paths?

StackUser
  • 135
  • 1
  • 11

2 Answers2

2

Your makefile is full of Linux-specific commands and paths. They don't translate 1:1. Maybe you can get it sorted out, but the real solution is not to hand-write your makefiles. Use a build system like cmake, which will generate the necessary build files for you no matter what system you're on.

You also don't mention what you have set up on your Windows machine. Windows by default does not come equipped to compile C++ code. You have to install something, whether it's the MS Build Tools, WSL, MinGW/MSYS2, or Cygwin.

Although, looking closer, your makefile snippet is nothing more than a bash script. That could probably get translated to a PowerShell script if you end up staying in a 100% Windows environment.

sweenish
  • 4,793
  • 3
  • 12
  • 23
1

ldconfig is not necessary on cygwin.

-lpce does not word because you have a libpce.so, but the linker is looking for a DLL. The solution is to create a symlink:

ln -s libpce.so libpce.dll

To go deeper, take a look at:

Benjamin T
  • 8,120
  • 20
  • 37