Building with MSYS2 and Mingw64 (almost!)
Posted: Tue Oct 31, 2023 9:46 pm
Some weeks ago I was having some problems building Oolite on Arch Linux, and so I thought I'd look at the Windows build environment that I had that was working for some clues as to why. The downloadable Windows dev environment is great, in that it just works and everything is all set up. However, it annoys me a little in that it's a bit of a black box and it would be nice to be able to configure an environment from scratch.
The current setup uses the old MSYS. The lastest version is MSYS2, which is also available in GitHub Actions. So I thought I'd give it a go to try and build Oolite with the more modern tools and see how far I got. And learn a few things along the way!
After some days spent chasing one error after another, trying to build various dependencies, I finally managed to get Oolite to successfully compile. Note that I say compile, not run. Oolite then shouted at me that it couldn't find various DLLs, and as I tried to help it do so, I eventually got to an unhelpful message about an "entry point not found". So I went nuclear and copied all DLLs from the /bin/ folder into the Oolite.app folder, which, while not allowing the program to run, stopped those messages. I've since narrowed things down using lld and now only copy about half the folder's DLLs instead.
As I was falling asleep last night, it occurred to me to try running my build through gdb to see if I get any useful messages. And... Success! Ish. It runs! I can save and load games, and fly a Cobby! But only if I make a debug build, and only if I run that debug build with gdb. Running it without gdb gives me a split second of the splash screen and no more. What's more, there are messages in the latest.log:
Current thoughts are that there's something I haven't configured with the GNUstep build, or that I need to go all the way and not use anything that's pre-built in the oolite-windows-dependencies repository. If the latter is the case, then I've potentially managed to make some further progress in that - using the mingw64 versions of libpng, openal and libvorbis. Not yet managed are espeak and the js library - I'm saving that pain for last!
It's been an educational little project. So far along my unexpected journey, I've re-learned about
My current attempts can be found at https://github.com/Bzomak/oolite-msys2. It's a fairly empty repository - there's a shell script that replicates my efforts, and then everything else can be found in the various workflows for GitHub Actions, which I've been experimenting with. I feel like I've barely left the Shire, and already "here be dragons"!
If anyone has any ideas on how to get any further, I'm all ears!
The current setup uses the old MSYS. The lastest version is MSYS2, which is also available in GitHub Actions. So I thought I'd give it a go to try and build Oolite with the more modern tools and see how far I got. And learn a few things along the way!
After some days spent chasing one error after another, trying to build various dependencies, I finally managed to get Oolite to successfully compile. Note that I say compile, not run. Oolite then shouted at me that it couldn't find various DLLs, and as I tried to help it do so, I eventually got to an unhelpful message about an "entry point not found". So I went nuclear and copied all DLLs from the /bin/ folder into the Oolite.app folder, which, while not allowing the program to run, stopped those messages. I've since narrowed things down using lld and now only copy about half the folder's DLLs instead.
As I was falling asleep last night, it occurred to me to try running my build through gdb to see if I get any useful messages. And... Success! Ish. It runs! I can save and load games, and fly a Cobby! But only if I make a debug build, and only if I run that debug build with gdb. Running it without gdb gives me a split second of the splash screen and no more. What's more, there are messages in the latest.log:
Code: Select all
21:05:11.579 [dataCache.notFound]: No data cache found, starting from scratch.
21:05:11.580 [dataCache.write.buildPath.failed]: Could not create folder C:/msys64/home/Robert/oolite/oolite.app/GNUstep/Library/Caches.
...
21:05:36.221 [dataCache.write.buildPath.failed]: Could not create folder C:/msys64/home/Robert/oolite/oolite.app/GNUstep/Library/Caches.
21:05:36.221 [dataCache.write.failed]: Failed to write data cache.
21:05:56.187 [oxz.manager.error]: Could not create folder C:/msys64/home/Robert/oolite/oolite.app/GNUstep/Library/ApplicationSupport/Oolite/ManagedAddOns.
21:05:56.187 [oxz.manager.error]: Unable to create installation folder.
It's been an educational little project. So far along my unexpected journey, I've re-learned about
make
and makefiles, learned how to use wget
, tar
, and patch
, have sort-of learned more about compiler flags, and for a nice diversion, learned more about GitHub Actions and some of the different things one can do, and have duplicated my own computer's efforts online!My current attempts can be found at https://github.com/Bzomak/oolite-msys2. It's a fairly empty repository - there's a shell script that replicates my efforts, and then everything else can be found in the various workflows for GitHub Actions, which I've been experimenting with. I feel like I've barely left the Shire, and already "here be dragons"!
If anyone has any ideas on how to get any further, I'm all ears!