I am cross-compiling a Windows 64-bit-only app from my Linux 64-bit machine.
The Linux build build works flawlessly, but on windows the app crashes with "The procedure entry point ......basic_ostringstream......char_traits.... could not be located in the dynamic link library ....
I am compiling and using many .dll files that I load at runtime and I do NOT want to statically link to libstdc++ on each of them because it adds 15 megabytes on each, which does not make sense on my modular system with potentially hundreds of modules that would be only 500kb otherwise..
What I accept is either placing a dll in the executable directory or statically linking it in only ONE library that is dynamically linked to these modules. Neither seems to be working.
I tried having the libstdc++-6.dll file inside the directory, issue persists. I tried statically linking it in a shared library that that is dynamically linked, same issue still.
Here's my cmake configuration for the dynamically linked version :
target_link_libraries(myModule gcc stdc++)
It does work well when I use -static-libstdc++
instead of stdc++
, but that solution is bad because of the increased size in the resulting library.
Anyone has a solution ? Am I doing something wrong ?
~ >>> x86_64-w64-mingw32-g++ -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/9.3.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: /home/olivier/.cache/yay/mingw-w64-gcc/src/gcc/configure --prefix=/usr --libexecdir=/usr/lib --target=x86_64-w64-mingw32 --with-pkgversion='Arch Linux 9.3.0-1' --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-threads=posix --enable-fully-dynamic-string --enable-libstdcxx-time=yes --enable-libstdcxx-filesystem-ts=yes --with-system-zlib --enable-cloog-backend=isl --enable-lto --disable-dw2-exceptions --enable-libgomp --disable-multilib --enable-checking=release
Thread model: posix
gcc version 9.3.0 (Arch Linux 9.3.0-1)
EDIT : Solved. Turns out I was not using the correct libstdc++-6.dll file... After locating it on my system, there was multiple files
>>> locate libstdc++-6.dll
/home/****/****/****/libstdc++-6.dll
/usr/i686-w64-mingw32/bin/libstdc++-6.dll
/usr/x86_64-w64-mingw32/bin/libstdc++-6.dll
I did a diff between all three results (the first being the one I was copying to my windows machine that was not working)
Somehow, the one I was using was the same as the i686-w64 and different from the x86_64-w64...
I tried with the other one and it worked !
Solved. For anyone else having this issue, make sure you are using the dll that comes from the same version of mingw than the one you are compiling with.