Static library linking error in cross-compile
The multilib x265.exe says it is missing libstdc++-6.dll and libgcc_s_seh-1.dll after cross-compiling. It will work when these .dll files are placed in the same directory as x265.exe. I am testing it on Windows 8.1 and it is cross compiled on a Debian distribution where both are 64 bit machines. Everything has been updated on the Debian system.
I am using the x86_64 static toolchain provided on the cross-compile tutorial (https://bitbucket.org/multicoreware/x265/wiki/CrossCompile) where the flags -static-libgcc and -static-libstdc++ are being used. In the multilib.sh file I have added -DCMAKE_TOOLCHAIN_FILE=~/toolchain.cmake -DCMAKE_STATIC_CRT=ON and have tried with and without the -DENABLE_SHARED=OFF flag on the 8bit line.
x86_64-w64-mingw32-gcc version is 6.1.1 x86_64-w64-mingw32-g++ version is 6.1.1 x86_64-w64-mingw32-windres version is 2.27.51.20161105 yasm version is 1.3.0 gcc version is 6.2.0 g++ version is 6.2.0 This was tested to cross-compile x265 2.1+55
Both x86_64-w64-mingw32-gcc and x86_64-w64-mingw32-g++ were packages using apt-get and it shows that they were configured with --enable-shared. The only solutions I have found online have been people that were able to configure their mingw32 with --disable-shared.
Comments (4)
-
Account Deactivated -
Account Deactivated -
assigned issue to
-
assigned issue to
-
Actually having the same issue with it at the moment. I used to cross-compile it on Arch Linux, used to work pretty well, but after reinstalling the OS, the version of GCC provided by Pacman libraries was changed and the libraries don't get linked statically anymore. Had a similar problem before and it was because of old version of GCC (https://bitbucket.org/multicoreware/x265/issues/242/cannot-import-libwinpthread). Now, I don't know why the newer version of gcc does that for me again.
Edit: Managed to solve this. It seems like the linker doesn't like when .dll.a files libs exist in mingw folder.
It compiled and worked absolutely fine after using "rm /usr/x86_64-w64-mingw32/*.dll.a", I recommend you to back them up, but they don't seem to be any useful and somehow destroy the static linking.
-
I always use https://github.com/mxe/mxe for cross-compiling. I haven't tested building x265 in a while though. The cross-toolchain provided by your distro may be a bit outdated or lacking stuff.
- Log in to comment
I don't understand your goal - are trying to compile x265 on a debian distro to use in windows, or are you compiling with mingw inside Windows? Can you please clarify so that we can recommend a good solution?