Compiling libnoise on windows with mingw

2019-02-24 06:22发布

问题:

This is my first post here so forgive me if I've done something wrong.

I've been struggling with this for a few days and I've finally decided to concede and ask for help. Put simply, I would like to compile libnoise (1.0.0) on windows using mingw. However, there seems to be a lack of information available online.

I have downloaded the source files from the website and followed the instructions inside the INSTALL text file which indicate that I should run the command "CXXFLAGS='-O3 -fomit-frame-pointer' make" (which I do from the mingW shell).

The output from this operation can be found at link (I've linked rather then posting the output due to its length). The output doesn't vary much if I omit the CXXFLAGS or the fomit-frame-pointer flags or if I use the mingw32-make or make all commands.

It seems to be complaining about missing files such as

Makefile:56: ../src/latlon.d: No such file or directory

though I can confirm they exist in the directory stated. It is also complaining about something else

c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../libmingw32.a(main.o):main.c:(.tex t.startup+0xa7): undefined reference to _WinMain@16' collect2.exe: error: ld returned 1 exit status make[1]: *** [libnoise.so.0.3] Error 1 make[1]: Leaving directory /c/users/gibbons/desktop/libnoisesrc-1.0.0/noise/src ' make: * [src] Error 2

I have no idea how to address these issues. A google search didn't really turn up much other then a single blog post. Which also didn't really help since I am unsure what it means by "Rename the library name to give it a proper DLL extension. A replace-all will do.".

Any help or advice would be appreciated, I'm really quite stuck! :-/

Cheers

Extra info: I'm running windows 7, 64 bit and (think) I'm on mingW 4.7.0.

回答1:

  1. Don't worry about No such file or directory. It's normal, see the bottom of src/Makefile for explanation.
  2. Don't ever use target clean. I couldn't recover from that.
  3. Remove all directions to build .so files. These are linux files and cannot be built by mingw. Open all the Makefiles and comment out lines containing .so, except the lines:

    libnoise: libnoise.so libnoise.a libnoise.la
    all: libnoise.a libnoise.la libnoise.so.0.3

    In the above lines only remove the words containing .so. This will prevent building .so targets.

Find the static library in src/.libs/libnoise.a.

Building DLL would be a bit harder, as the authors build it using Visual Studio. There are no makefile targets to build the dll. One would need to prepare a few more lines to process files in win32 directory and produce the library out of it.



标签: c++ mingw