stephaneguindon / phyml

PhyML -- Phylogenetic estimation using (Maximum) Likelihood
GNU General Public License v3.0
175 stars 61 forks source link

PhyML Compiling Error on Windows (MSYS2) #167

Open amduffy opened 2 years ago

amduffy commented 2 years ago

Hello, I've been trying to compile a Windows executable from the Spring 2022 release, but I keep running into undefined reference to 'WinMain@16' errors when running make. I've tried this through both through MSYS2 on a Windows 10 machine and while trying to cross-compile with mingw on an Ubuntu 20.04.4 machine with the same result.

My apologies if there's a common fix to this - I'm not experienced at all with C compilers.

Details of my system setup and the error are below, while console output from autogen, configure, and make are attached

Thank you for your help!

Setup

Windows 10, MSYS2 fresh install (msys2-x86_64-20220503)

Installed packages:

Attempting to compile phyml-3.3.20220408 (Spring 2022 release) in MSYS2 MINGW x86

Error from make:

i686-w64-mingw32-gcc  -std=c99 -O3 -fomit-frame-pointer -funroll-loops -Wall -Winline -finline -march=native   -o phyml.exe   -lm
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.3.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.3.0/../../../../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o): in function `main':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:1134: phyml.exe] Error 1
make[2]: Leaving directory '/c/users/duffy/downloads/phyml-3.3.20220408/src'
make[1]: *** [Makefile:365: all-recursive] Error 1
make[1]: Leaving directory '/c/users/duffy/downloads/phyml-3.3.20220408'
make: *** [Makefile:306: all] Error 2

configure-log.log autogen-log.log make-log.log

yilitai commented 3 weeks ago

@amduffy I faced the same issue. Me too was using MSYS2

yilitai commented 3 weeks ago

I tried the phyml-3.3.20220408 and phyml-3.3.20211118, same output:

$ make
make all-recursive
make[1]: Entering directory '/d/phyml-3.3.20211118'
Making all in src
make[2]: Entering directory '/d/phyml-3.3.20211118/src'

.: Building [phyml.exe]. Version 3.3.20211118 :.

i686-w64-mingw32-gcc -std=c99 -O3 -fomit-frame-pointer -funroll-loops -Wall -Winline -finline -march=native -o phyml.exe -lm
D:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe: D:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../lib/libmingw32.a(lib32_libmingw32_a-crtexewin.o): in function main': C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xd0): undefined reference to WinMain@16'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:1625: phyml.exe] Error 1
make[2]: Leaving directory '/d/phyml-3.3.20211118/src'
make[1]: *** [Makefile:365: all-recursive] Error 1
make[1]: Leaving directory '/d/phyml-3.3.20211118'
make: *** [Makefile:306: all] Error 2