compiling OpenMSX in MinGW

By brnomade

Supporter (7)

brnomade's picture

26-12-2019, 21:40

Hello. I am trying to compile OpenMSX in MinGW but I am getting an error when running ./configure.

Somehow the SDL_ttf library is not being found and probe.log is showing this:

compiler command: x86_64-w64-mingw32-g++ -c derived/x86_64-mingw-w64-devel/config/SDL_TTF.cc -o derived/x86_64-mingw-w64-devel/config/SDL_TTF.o -m64
derived/x86_64-mingw-w64-devel/config/SDL_TTF.cc:1:10: fatal error: SDL_ttf.h: No such file or directory
#include

Anyone has seen and solved that before?

Cheers.
Andre.

Login or register to post comments

By Manuel

Ascended (15979)

Manuel's picture

27-12-2019, 00:04

Hey, I've seen you on IRC today. We can try to help you there as well!

Try this command to build it (see also the Compilation Guide):

make staticbindist

This will also download and compile all required dependencies...

By brnomade

Supporter (7)

brnomade's picture

27-12-2019, 13:32

Thank you Manuel.

I was following the Compilation Guide but I was at step 4.1 GCC part. The command you mentioned is on section 5.

The other error I had was the directory names. I was using one with spaces in it and the make process didn't like it.

I created a new directory and re-started the process following your suggestion (and command listed on section 5). It worked well for a while (quite a long time) but if finished abruptly with following error:

Compiling video/v9990/V9990SDLRasterizer.cc...
Compiling video/v9990/V9990VRAM.cc...
Compiling video/v9990/Video9000.cc...
Creating derived/x86_64-mingw-w64-devel-3rd/config/resource-info.h...
Compiling resources...
Linking openmsx.exe...
make[1]: execvp: x86_64-w64-mingw32-g++: Argument list too long
make[1]: *** [build/main.mk:555: derived/x86_64-mingw-w64-devel-3rd/bin/openmsx.exe] Error 127
make[1]: Leaving directory '/home/Andre/openMSX-0.15.0'
make: *** [build/main.mk:682: staticbindist] Error 2

Any idea of what is causing the error?

Best Regards,

Andre.

By mth

Champion (488)

mth's picture

27-12-2019, 17:56

This is really weird. Can you add "V=1" to the "make staticbindist" command line? I'm wondering whether the argument list is longer than it should be and with that option it should be printed on the console.

By brnomade

Supporter (7)

brnomade's picture

27-12-2019, 18:09

Hi. Indeed the argument list is massive. It has 33,123 characters. Not sure I can paste it in full here.

The start of it is like this:

x86_64-w64-mingw32-g++ -o derived/x86_64-mingw-w64-devel-3rd/bin/openmsx.exe -O2 -g derived/x86_64-mingw-w64-devel-3rd/obj/AndroidApiWrapper.o derived/x86_64-mingw-w64-devel-3rd/obj/Autofire.o derived/x86_64-mingw-w64-devel-3rd/obj/CLIOption.o derived/x86_64-mingw-w64-devel-3rd/obj/CartridgeSlotManager.o derived/x86_64-mingw-w64-devel-3rd/obj/ChakkariCopy.o derived/x86_64-mingw-w64-devel-3rd/obj/CliExtension.o derived/x86_64-mingw-w64-devel-3rd/obj/CommandLineParser.o derived/x86_64-mingw-w64-devel-3rd/obj/Connector.o derived/x86_64-mingw-w64-devel-3rd/obj/DebugDevice.o derived/x86_64-mingw-w64-devel-3rd/obj/DeviceFactory.o derived/x86_64-mingw-w64-devel-3rd/obj/DummyDevice.o

The end of it is like this:

derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libvorbis.a derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libogg.a /home/Andre/openMSX-0.15.0/derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libtcl85s.a -lws2_32 -L/home/Andre/openMSX-0.15.0/derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib -lmingw32 -lSDLmain -lSDL -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libglew32.a -lopengl32 derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libogg.a -lopengl32 derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libtheoradec.a derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libogg.a derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libpng16.a derived/x86_64-mingw-w64-devel-3rd/3rdparty/install/lib/libz.a

and in the end, the same message:

make[1]: execvp: x86_64-w64-mingw32-g++: Argument list too long
make[1]: *** [build/main.mk:555: derived/x86_64-mingw-w64-devel-3rd/bin/openmsx.exe] Error 127
make[1]: Leaving directory '/home/Andre/openMSX-0.15.0'
make: *** [build/main.mk:682: staticbindist] Error 2

By mth

Champion (488)

mth's picture

27-12-2019, 18:29

That looks as expected.

Are you running MinGW on Windows or doing a cross-compile from for example Linux to Windows using MinGW? Does "getconf ARG_MAX" work and if so, what does it return?

By brnomade

Supporter (7)

brnomade's picture

27-12-2019, 18:35

I am running MinGW on Windows. The getconf function returns: 32000.

By mth

Champion (488)

mth's picture

27-12-2019, 18:51

Ugh, that's a very low limit for a modern system. Is this the latest MinGW release? For comparison, on my Linux system the limit is 2MB.

Are you using CMD.EXE or msys bash or something else as your shell?

Hmm, the problem might be in Windows itself: CreateProcess seems to have a 32K limit.

I guess it could be worked around by using a file to pass the arguments to the compiler.

By pgimeno

Resident (48)

pgimeno's picture

27-12-2019, 20:41

Moving the openMSX subdir to c:/msx/ might help maybe, depending on how many times the absolute path appears in the command line.

By mth

Champion (488)

mth's picture

27-12-2019, 21:17

I think the link command line uses relative paths only.

By brnomade

Supporter (7)

brnomade's picture

28-12-2019, 00:59

So I have update MSYS2 (and mingw) but that made no difference.

I have also change the openMSX directory to one with shorter name. That also made no difference.

I finally played with symbolic links and manually changed the g++ command to use the shortened symbolic links instead of the original full length directory names. For that I created the d -> derived and derived\x-3rd -> x86_64-mingw-w64-devel-3rd. This reduced the original parameter list to around 15000 characters and therefore the link command run without apparent error.

The result is an openmsx.exe file in the bin folder. It appears to work but I still need to test and see if it can run any rom file.

Just wondering if anyone has faced such build errors using mingw msys2 on a windows machine? There must be a better way of running it.