FFmpeg Failing to Run Due to Missing libstdc++-6 When Cross-Compiling

Questions that occur when trying to compile FFmpeg.
Post Reply
barndawgie
Posts: 7
Joined: Sat Mar 23, 2013 7:44 pm

FFmpeg Failing to Run Due to Missing libstdc++-6 When Cross-Compiling

Post by barndawgie » Tue Jul 09, 2019 10:03 pm

I'm attempting to cross-compile FFmpeg for 64-bit Windows using Ubuntu 18.04. I have everything working with x264 and fdk-aac, but am hitting problems when building with x265.

Configuration and compilation work fine, but the resultant executable fails with the following:
"The code execution cannot proceed because libstdc++-6.dll was not found."

The x265.exe executable itself works fine, so I suspect that somehow the static version of that lib isn't getting built/found in ffmpeg itself.

This is the command I'm using to configure x265:

Code: Select all

cmake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres -DCMAKE_ASM_YASM_COMPILER=yasm -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -static -O3 -s" -DCMAKE_C_FLAGS="-static-libgcc -static-libstdc++ -static -O3 -s" -DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS="-static-libgcc -static-libstdc++ -static -O3 -s" -DCMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS="-static-libgcc -static-libstdc++ -static -O3 -s" -DENABLE_CLI=1 -DCMAKE_INSTALL_PREFIX=$prefix -DENABLE_SHARED=0 ../source
And the command I'm using to configure FFmpeg:

Code: Select all

--arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/home/ubuntu/ffmpeg_cross-compile/ffmpeg_install --extra-libs=-lstdc++ --logfile=./config.log --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265
Any help would be greatly appreciated; I've tried everything that I can seem to find via Google and feel like I'm doing something close to what is in ffmpeg-windows-build-helpers.


barndawgie
Posts: 7
Joined: Sat Mar 23, 2013 7:44 pm

Re: FFmpeg Failing to Run Due to Missing libstdc++-6 When Cross-Compiling

Post by barndawgie » Thu Jul 18, 2019 9:01 pm

I based my script on those, but neither had an example that worked.

It looks like I managed to resolve this by adding the following to my ./configure for ffmpeg:

Code: Select all

compiler_params="-static-libgcc -static-libstdc++ -static -O3 -s"
--extra-cflags="$compiler_params" --extra-cxxflags="$compiler_params" --extra-ldflags="$compiler_params" --extra-ldexeflags="$compiler_params" --extra-ldsoflags="$compiler_params"

Post Reply
'