scottdraves / flam3

the original fractal flame renderer and genetic language
GNU General Public License v3.0
394 stars 73 forks source link

Compiling for Windows using Msys2 #31

Closed dfkettle closed 3 years ago

dfkettle commented 4 years ago

I'm trying to compile for Windows (Windows 7, SP1, 64-bit AMD processor) using Msys2, and I actually succeeded, but I had to make a manual change to the generated "Makefile". After installing a few libraries that were missing from Msys2 (png, xml, etc.), I was getting the following error:

C:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ./.libs/libflam3.a(png.o): in function 'write_png': C:\Dropbox\C++\flam3-master/png.c:108: undefined reference to '__imp_htons'

After doing some research using Google, I discovered that I needed to add a switch (-lws2_32) to this line in the generated makefile:

LIBS = -ljpeg -lpthread -lxml2 -lpng -lz -lws2_32

After doing that, all four targets compiled and linked without any errors, but I'm trying to figure out what I need to change in "Makefile.am" to avoid having to manually edit the makefile. I tried adding the same switch to this line in "Makefile.am", but it didn't seem to help, even after going through all the steps in README.txt (libtoolize, aclocal, automake, autoconf, ./configure, and make):

libflam3_la_LDFLAGS = -no-undefined -ljpeg -lpng -lz -lpthread -lws2_32

I'm not very familiar with the GNU compile tools, so any advice would be appreciated. If I can get this working, I could upload a fix so others wouldn't have this issue.

Thanks.