rdp / ffmpeg-windows-build-helpers

Helper script for cross compiling some media tools for windows, like customizable ffmpeg.exe (with or without non-free components, etc), and some other bonuses like mplayer, mp4box, mxf, etc.
GNU General Public License v3.0
1.08k stars 412 forks source link

build failed on colab!! #706

Open sg0771 opened 1 year ago

sg0771 commented 1 year ago

A

!apt update !apt install subversion ragel curl texinfo g++ ed bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full meson clang python3-distutils python-is-python3 -y !git clone https://github.com/rdp/ffmpeg-windows-build-helpers.git

B !cd ffmpeg-windows-build-helpers && bash ./cross_compile_ffmpeg.sh input 1, build x64 and Win32

when build frei0r

In file included from /content/ffmpeg-windows-build-helpers/sandbox/win32/frei0r_git/src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:28: /content/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/i686-w64-mingw32/include/c++/10.2.0/future:125:11: note: declaration of 'std::iterator_traits<std::future*>::value_type' {aka 'class std::future'} 125 | class future; | ^~ make[2]: [src/filter/kaleid0sc0pe/CMakeFiles/kaleid0sc0pe.dir/build.make:92: src/filter/kaleid0sc0pe/CMakeFiles/kaleid0sc0pe.dir/kaleid0sc0pe.cpp.obj] Error 1 make[1]: [CMakeFiles/Makefile2:3441: src/filter/kaleid0sc0pe/CMakeFiles/kaleid0sc0pe.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 29%] Linking CXX shared module lightgraffiti.dll [ 29%] Built target lightgraffiti make: [Makefile:136: all] Error 2

sg0771 commented 1 year ago

frei0r build error!!

mitchcapper commented 1 year ago

This is a new module added to frei0r. To avoid needing to use a threads support lib you can disable the module. sed -i.bak -E 's/^([^#].+kaleid0sc0pe.*)/#\1/g' src/filter/CMakeLists.txt can be added to the build_frei0r near the other sed call.

xengine-qyt commented 1 year ago

...and me has a same error

mitchcapper commented 1 year ago

yes make the above change to the main helper script and it will work

timothymowens commented 1 year ago

Another alternative, I made the following edit to the build_frei0r() function in the cross_compile_ffmpeg.sh script and was able to successfully move on past the frei0r issue. This simply downloads the previous v2.3.0 build instead of latest, which doesn't have the offending kaleid0sc0pe module:

build_frei0r() {
  #do_git_checkout https://github.com/dyne/frei0r.git
  #cd frei0r_git
  download_and_unpack_file https://github.com/dyne/frei0r/archive/refs/tags/v2.3.0.tar.gz frei0r-2.3.0
  cd frei0r-2.3.0
    sed -i.bak 's/-arch i386//' CMakeLists.txt # OS X https://github.com/dyne/frei0r/issues/64
    do_cmake_and_install "-DWITHOUT_OPENCV=1" # XXX could look at this more...

    mkdir -p $cur_dir/redist # Strip and pack shared libraries.
    if [ $bits_target = 32 ]; then
      local arch=x86
    else
      local arch=x86_64
    fi
    archive="$cur_dir/redist/frei0r-plugins-${arch}-$(git describe --tags).7z"
    if [[ ! -f "$archive.done" ]]; then
      for sharedlib in $mingw_w64_x86_64_prefix/lib/frei0r-1/*.dll; do
        ${cross_prefix}strip $sharedlib
      done
      for doc in AUTHORS ChangeLog COPYING README.md; do
        sed "s/$/\r/" $doc > $mingw_w64_x86_64_prefix/lib/frei0r-1/$doc.txt
      done
      7z a -mx=9 $archive $mingw_w64_x86_64_prefix/lib/frei0r-1 && rm -f $mingw_w64_x86_64_prefix/lib/frei0r-1/*.txt
      touch "$archive.done" # for those with no 7z so it won't restrip every time
    fi
  cd ..
}
gbendy commented 1 year ago

This is due to the mingw cross-compiler you're building using the win32 thread model, not posix, and the win32 model doesn't support future

✔ ~/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin [master|…1]
09:28 $ ./x86_64-w64-mingw32-g++ -v
Using built-in specs.
COLLECT_GCC=./x86_64-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/home/bendy/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/libexec/gcc/x86_64-w64-mingw32/10.2.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../source/gcc-10.2.0/configure --build=x86_64-pc-linux-gnu --target=x86_64-w64-mingw32 --disable-shared --enable-static --disable-nls --disable-multilib --prefix=/home/bendy/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64 --with-sysroot=/home/bendy/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64 --with-mpc=/home/bendy/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/pkgs/mpc/mpc-1.2.1-x86_64 --with-mpfr=/home/bendy/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/pkgs/mpfr/mpfr-4.1.0-x86_64 --with-gmp=/home/bendy/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/pkgs/gmp/gmp-6.2.1-x86_64 --with-isl=/home/bendy/git/ffmpeg-windows-build-helpers/sandbox/cross_compilers/pkgs/isl/isl-0.23-x86_64 --enable-languages=c,c++ --enable-fully-dynamic-string --enable-lto
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)

I have in PR in for frei0r that detects this case and disables multithreading,

rdp commented 1 year ago

OK see #707 for now