GCC (MinGW-w64 through MSYS2) on Windows Questions

Hi there!

I've got a few questions regarding GCC on Windows.

I've gotten to build a program just fine via makefile. However MinGW has some DLLs it requires for libstdc++ winpthread, etc. So trying to start the built application complains about missing those DLLs.


Of course I can include everything statically it seems at the cost of bloating the .exe size using these linker flags courtesy of Stack Overflow:

-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic

I believe on Linux this would be advised against due to licenses from GLIBC. Is it okay to just link this statically on Windows with MinGW without running into some licensing headache? Or is packaging with DLLs an option?

Regarding the latter, is there some redistributable runtime installer similar to the ones for the different MSVC++ versions, but for MinGW?

I'd greatly appreciate any information!
I generally have the same problem as you - how to deploy.

I usually give up on finding a runtime installer and I just use:

1) ldd to get the shared library dependencies
2) Set PATH= and start the executable, and see what it misses each time. Eventually this should be nothing missing. This is problematic if you are unaware of unusual loads, eg., via open/exec calls or whatever. Maybe check the source code of your app or any 3rd-party libs. Or click on buttons to see if something is not found. Perhaps run a debug version under gdb or some tool to protect things better.

Sorry I don't use MinGW as much as Cygwin and other 3rd-party libs that I understand better. Good luck finding something.

I might also mention that the ./configure script can be easy or complex and can have upwards of 20,000 lines of macro code. This can be used to analyze apps if necessary. And new macros and scripts can be added to it.
Last edited on
Topic archived. No new replies allowed.