I try to build program with static linked toolchain libraries. I pass:
LDFLAGS="-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -static-libgcc -static-libstdc++"
but program linked with shared libwinpthread-1.dll
.
What I doing wrong?
Only way when I got static linked libwinpthreads is pass -static
to LDFLAGS
. But it break build programs with plugin system.
I use mingw-w64 + GCC-4.7.2 from the MinGW-builds project: http://sourceforge.net/projects/mingwbuilds/
Static linking increases the file size of your program, and it may increase the code size in memory if other applications, or other copies of your application, are running on the system. This option forces the linker to place the library procedures your program references into the program's object file.
Reinstalling the program may fix this problem. libwinpthread-1. dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vender for support.
Static linking means that the code for all routines called by your program becomes part of the executable file. Statically linked programs can be moved to run on systems without the XL Fortran runtime libraries.
Try this:
-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
Notice the -lstdc++
before -lpthread
. It worked for me.
Make sure to add this to the very end of your g++
command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With