jwt27 / build-gcc

Shell scripts to build various gcc cross-compilers (primarily djgpp)
https://jw.h4ck.me/debian/
GNU General Public License v3.0
44 stars 9 forks source link

Autoconf fails to build with MSYS2 (MINGW64) #27

Closed chestertonic closed 2 years ago

chestertonic commented 2 years ago

When running ./build-djgpp default (or any other variant) the build always fails at:

make[3]: Leaving directory '/home/Chester/build-djgpp/build/djcross-gcc-10.3.0/autoconf-2.69/lib/m4sugar'
autom4te_perllibdir='..'/lib AUTOM4TE_CFG='../lib/autom4te.cfg'         ../bin/autom4te -B '..'/lib -B '..'/lib         --language M4sh --cache '' --melt ./autoconf.as -o autoconf.in
The system cannot find the path specified.
autom4te: need GNU m4 1.4 or later: /usr/bin/m4
make[2]: *** [Makefile:641: autoconf.in] Error 1
make[2]: Leaving directory '/home/Chester/build-djgpp/build/djcross-gcc-10.3.0/autoconf-2.69/bin'
make[1]: *** [Makefile:357: all-recursive] Error 1
make[1]: Leaving directory '/home/Chester/build-djgpp/build/djcross-gcc-10.3.0/autoconf-2.69'
make: *** [Makefile:292: all] Error 2

Seems that this type of failure is common across all platforms but can't seem to find a solution.

jwt27 commented 2 years ago

Hi, thanks for the report.

Do you have M4 installed? pacman -Syuu m4 should resolve it. I thought package base-devel included M4, apparently it doesn't. I'll list it in the readme.

chestertonic commented 2 years ago

I believe m4 is pulled in as a dependency of packages in base-devel as I checked for it's existence after getting the error message. Looking at the MSYS2 and MINGW packages for autoconf shows a number of patches to make it work on Windows. I'm not sure if any of those patches will help.

chestertonic commented 2 years ago

Looks like autoconf was picking up /mingw64/bin/perl instead of /usr/bin/perl expected by M4. Not sure if one of the dependencies listed pulled in /mingw64/bin/perl or I had previously installed it. I just did an export PERL=/usr/bin/perl before calling build-djgpp.sh and the build succeeded.

jwt27 commented 2 years ago

Hi again, sorry, haven't had much time for coding lately.

Good to hear you figured it out, weird though that the mingw64 perl isn't compatible with M4/autoconf. I suppose I could put that export PERL=/usr/bin/perl line in the script when building on mingw-w64.