Hi Jan! I'm sorry you ran into this and I have been seeing some cases of it myself when building final games in compile mode. However, it seems to be random as some games will do it while others are just fine. It also seems to keep changing whenever I do an MSYS2 upgrade. I am interested in finding the root cause of this myself, but it's proved to be a little difficult since it sometimes won't occur when building with debugging symbols and gdb'ing the release exe doesn't yield anything useful because there is no debugging symbols! It's a bit of catch 22.
You can try maybe compiling the games with different systems (I specifically want to point my finger at OpenAL here as a potential cause of this). Another workaround, since you said the game works fine in run mode, is to copy and distribute the temp file exe of your game (the file path is printed in LGM's output window when you run the game). One issue with the second work around is you may end up with a terminal window when you double click the game. You can circumvent that by modifying the main makefile to link the Windows subsystem in Run mode (which tells Windows that it's a Window app not a console app). Just change the following line from Compile to Run, save the makefile, build your game, and copy the temp file.
https://github.com/enigma-dev/enigma-dev/blob/2df68cffc66d5e6564392f5b078ad0589cf868ae/ENIGMAsystem/SHELL/Makefile#L92Again, I'm sorry about this problem, and I will continue looking into it.