Compile issues in Ubuntu-WSL2 environment on Windows
Closed this issue · 8 comments
On my Windows 11 machine I recently installed Windows Subsystem for Linux
(WSL2) from the Windows store and installed the latest version of Ubuntu that was available Ubuntu 22.04.2 LTS
.
I've used the update and upgrade commands before I got started to run the ffmpeg compile script.
I don't know whether I was suppose to do anything different when compiling in WSL2 environment.
Compile Issues
-
When running the script for the very first time I was prompted with an error message:
windows WSL detected: you must first disable 'binfmt' by running this sudo bash -c 'echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop' then try again
* I don't know whether disabling 'binfmt' would cause other implications in the WSL environment.
-
After disabling 'binfmt' and running the ffmpeg compile script again, I am returned with the following error message:
Making /home/user/ffmpeg-windows-build-helpers/sandbox/win64/ffmpeg_git_pre_x264_with_fdk_aac as $ PATH=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin:$PATH make -j 12 AR libavdevice/libavdevice.a AR libavfilter/libavfilter.a AR libavformat/libavformat.a AR libpostproc/libpostproc.a AR libavcodec/libavcodec.a AR libswresample/libswresample.a AR libswscale/libswscale.a AR libavutil/libavutil.a LD ffmpeg_g.exe LD ffplay_g.exe LD ffprobe_g.exe /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libSvtAv1Enc.a(EbSourceBasedOperationsProcess.c.obj):EbSourceBasedOperationsProcess.c:(.rdata+0x80): multiple definition of `AV1_VAR_OFFS'; /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libaom.a(encodeframe.c.obj):encodeframe.c:(.rdata+0x560): first defined here /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libSvtAv1Enc.a(EbSourceBasedOperationsProcess.c.obj):EbSourceBasedOperationsProcess.c:(.rdata+0x80): multiple definition of `AV1_VAR_OFFS'; /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libaom.a(encodeframe.c.obj):encodeframe.c:(.rdata+0x560): first defined here /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libSvtAv1Enc.a(EbSourceBasedOperationsProcess.c.obj):EbSourceBasedOperationsProcess.c:(.rdata+0x80): multiple definition of `AV1_VAR_OFFS'; /home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libaom.a(encodeframe.c.obj):encodeframe.c:(.rdata+0x560): first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:133: ffplay_g.exe] Error 1 make: *** Waiting for unfinished jobs.... collect2: error: ld returned 1 exit status make: *** [Makefile:133: ffmpeg_g.exe] Error 1 collect2: error: ld returned 1 exit status make: *** [Makefile:133: ffprobe_g.exe] Error 1 ~/ffmpeg-windows-build-helpers$
Environment
OS: Ubuntu 22.04.2 LTS on Windows 11 x86_64
Kernel: 5.15.90.1-microsoft-standard-WSL2
Uptime: 1 hour, 58 mins
Packages: 657 (dpkg), 6 (snap)
Shell: bash 5.1.16
Terminal: Relay(475)
CPU: AMD Ryzen 5 5600X (12) @ 3.700GHz
GPU: 0b98:00:00.0 Microsoft Corporation Device 008e
Memory: 575MiB / 15959MiB
Compile Option
./cross_compile_ffmpeg.sh --build-ffmpeg-static=y --build-ffmpeg-shared=n --disable-nonfree=n --build-x264-with-libav=y
Version: Win64 (64-bit only)
I have deleted the ~/ffmpeg-windows-build-helpers
directory and cloned this repo once again and now compiling with the following options:
./cross_compile_ffmpeg.sh --build-ffmpeg-static=y --build-ffmpeg-shared=n --gcc-cpu-count=6 --disable-nonfree=n --sandbox-ok=y --compiler-flavors=win64 --cflags=-march=znver3 --build-x264-with-libav=y --enable-gpl=y
Edit: It returned the following error message:
No working C compiler found.
failed configure xavs_svn
Detailed log:
svn checking out to xavs_svn
A xavs_svn.tmp/encoder
A xavs_svn.tmp/common
A xavs_svn.tmp/common/i386
A xavs_svn.tmp/common/i386/dct.h
A xavs_svn.tmp/common/i386/quant_sse2.asm
A xavs_svn.tmp/common/i386/deblock.asm
A xavs_svn.tmp/common/i386/cpu-a.asm
A xavs_svn.tmp/common/i386/dct-c.c
A xavs_svn.tmp/common/pixel.c
A xavs_svn.tmp/common/predict.h
A xavs_svn.tmp/common/i386/predict-c.c
A xavs_svn.tmp/common/i386/mc-a.asm
A xavs_svn.tmp/common/mc.h
A xavs_svn.tmp/encoder/encoder.c
A xavs_svn.tmp/encoder/macroblock.c
A xavs_svn.tmp/common/i386/mc-c.c
A xavs_svn.tmp/encoder/cavlc.c
A xavs_svn.tmp/encoder/analyse.c
A xavs_svn.tmp/encoder/rdo.c
A xavs_svn.tmp/common/i386/dct-sse2.asm
A xavs_svn.tmp/common/macroblock.h
A xavs_svn.tmp/common/i386/pixel-sse2.asm
A xavs_svn.tmp/common/osdep.h
A xavs_svn.tmp/common/common.h
A xavs_svn.tmp/tools
A xavs_svn.tmp/common/set.h
A xavs_svn.tmp/common/dct.h
A xavs_svn.tmp/common/cpu.c
A xavs_svn.tmp/encoder/macroblock.h
A xavs_svn.tmp/encoder/set.h
A xavs_svn.tmp/encoder/analyse.h
A xavs_svn.tmp/build
A xavs_svn.tmp/encoder/me.c
A xavs_svn.tmp/encoder/ratecontrol.h
A xavs_svn.tmp/encoder/slicetype.c
A xavs_svn.tmp/encoder/me.h
A xavs_svn.tmp/encoder/lookahead.c
A xavs_svn.tmp/encoder/set.c
A xavs_svn.tmp/encoder/ratecontrol.c
A xavs_svn.tmp/encoder/eval.c
A xavs_svn.tmp/build/win32
A xavs_svn.tmp/common/common.c
A xavs_svn.tmp/common/dct.c
A xavs_svn.tmp/common/macroblock.c
A xavs_svn.tmp/common/pixel.h
A xavs_svn.tmp/common/csp.h
A xavs_svn.tmp/extras
A xavs_svn.tmp/doc
A xavs_svn.tmp/common/quant.c
A xavs_svn.tmp/common/vlc.h
A xavs_svn.tmp/common/cpu.h
A xavs_svn.tmp/Makefile
A xavs_svn.tmp/common/set.c
A xavs_svn.tmp/tools/checkasm.c
A xavs_svn.tmp/common/frame.c
A xavs_svn.tmp/configure
A xavs_svn.tmp/tools/xavs-format
A xavs_svn.tmp/tools/regression-test.pl
A xavs_svn.tmp/tools/checkasm-a.asm
A xavs_svn.tmp/common/predict.c
A xavs_svn.tmp/common/mc.c
A xavs_svn.tmp/common/i386/deblock_intra.asm
A xavs_svn.tmp/common/i386/predict.h
A xavs_svn.tmp/common/i386/qpel.asm
A xavs_svn.tmp/common/i386/deblock_inter.asm
A xavs_svn.tmp/common/i386/predict-a.asm
A xavs_svn.tmp/common/i386/dct.c
A xavs_svn.tmp/common/i386/mc-a01.asm
A xavs_svn.tmp/common/i386/i386inc.asm
A xavs_svn.tmp/common/i386/pixel.h
A xavs_svn.tmp/common/i386/pixel-a.asm
A xavs_svn.tmp/common/quant.h
A xavs_svn.tmp/common/frame.h
A xavs_svn.tmp/common/bs.h
A xavs_svn.tmp/common/csp.c
A xavs_svn.tmp/common/mdate.c
A xavs_svn.tmp/xavs.c
A xavs_svn.tmp/tools/patcheck
A xavs_svn.tmp/tools/q_matrix_avs.cfg
A xavs_svn.tmp/build/win32/xavs.vcproj
A xavs_svn.tmp/build/win32/xavs.sln
A xavs_svn.tmp/build/win32/libxavs.vcproj
A xavs_svn.tmp/xavs.h
A xavs_svn.tmp/muxers.c
A xavs_svn.tmp/muxers.h
A xavs_svn.tmp/extras/getopt.c
A xavs_svn.tmp/extras/stdint.h
A xavs_svn.tmp/extras/getopt.h
A xavs_svn.tmp/tools/xyuv.c
A xavs_svn.tmp/tools/countquant_xavs.pl
A xavs_svn.tmp/build/win32/libxavs.sln
A xavs_svn.tmp/matroska.c
A xavs_svn.tmp/doc/regression_test.txt
A xavs_svn.tmp/doc/vui.txt
A xavs_svn.tmp/matroska.h
A xavs_svn.tmp/doc/ratecontrol.txt
A xavs_svn.tmp/doc/standards.txt
A xavs_svn.tmp/doc/threads.txt
A xavs_svn.tmp/config.guess
A xavs_svn.tmp/version.sh
A xavs_svn.tmp/config.sub
Checked out revision 55.
configuring xavs_svn (/home/user/ffmpeg-windows-build-helpers/sandbox/win64/xavs_svn) as $ PKG_CONFIG_PATH=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/pkgconfig PATH=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin:$PATH ./configure --host=x86_64-w64-mingw32 --prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --cross-prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-
all touch files already_configured* touchname= already_configured_9969f0555dc839d1cb007ddb15544253-
config options --host=x86_64-w64-mingw32 --prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --cross-prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- ./configure
No working C compiler found.
failed configure xavs_svn
~/ffmpeg-windows-build-helpers$
Worked for me recently, I think the xavs means the cross compilers failed, try again?
Worked for me recently, I think the xavs means the cross compilers failed, try again?
Unfortunately I get the same error when trying to cross-compile for Windows (win64) using a fresh clone of this repo in Ubuntu 22.04.3 LTS
on WSL. I've used the same configuration from #703 (comment).
svn checking out to xavs_svn
...
Checked out revision 55.
configuring xavs_svn (/home/user/ffmpeg-windows-build-helpers/sandbox/win64/xavs_svn) as $ PKG_CONFIG_PATH=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/lib/pkgconfig PATH=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin:$PATH ./configure --host=x86_64-w64-mingw32 --prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --cross-prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-
all touch files already_configured* touchname= already_configured_9969f0555dc839d1cb007ddb15544253-
config options --host=x86_64-w64-mingw32 --prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --cross-prefix=/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- ./configure
No working C compiler found.
failed configure xavs_svn
~/ffmpeg-windows-build-helpers$
I get the same error as issue #633.
When I change '--cflags=-march=znver3' from znver3
to x86-64
because gcc 10.2.0 doesn't support AMD Zen 3 processors I get the following error messages:
x86_64-w64-mingw32-gcc -march=x86-64 -Wall -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared -o ../bin/flite_sort flite_sort_main.o -L../build/x86_64-mingw32/lib -lflite -lm
x86_64-w64-mingw32-gcc -march=x86-64 -Wall -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared -o ../bin/find_sts find_sts_main.o -L../build/x86_64-mingw32/lib -lflite -lm
/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../build/x86_64-mingw32/lib/libflite.a(cst_tokenstream.o):cst_tokenstream.c:(.text+0x92c): undefined reference to `ts_utf8_sequence_length'
/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../build/x86_64-mingw32/lib/libflite.a(cst_val.o):cst_val.c:(.text+0xf37): undefined reference to `utf8_sequence_length'
/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../build/x86_64-mingw32/lib/libflite.a(cst_val.o):cst_val.c:(.text+0xfd1): undefined reference to `utf8_sequence_length'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:75: ../bin/flite_sort] Error 1
make[1]: *** Waiting for unfinished jobs....
/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../build/x86_64-mingw32/lib/libflite.a(cst_tokenstream.o):cst_tokenstream.c:(.text+0x92c): undefined reference to `ts_utf8_sequence_length'
/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../build/x86_64-mingw32/lib/libflite.a(cst_val.o):cst_val.c:(.text+0xf37): undefined reference to `utf8_sequence_length'
/home/user/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../build/x86_64-mingw32/lib/libflite.a(cst_val.o):cst_val.c:(.text+0xfd1): undefined reference to `utf8_sequence_length'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:73: ../bin/find_sts] Error 1
make: *** [config/common_make_rules:133: build/x86_64-mingw32/obj//.make_build_dirs] Error 2
I now use BtbN's FFmpeg Builder which builds without errors, probably because it doesn't have the AVS codec, but instead it has XAVS2 and AVS3D.
what's your output from xavs' config.log? What command are you using to run the script?
run the script?
I've already mentioned in the previous comment that I use the same commands:
./cross_compile_ffmpeg.sh --build-ffmpeg-static=y --build-ffmpeg-shared=n --gcc-cpu-count=6 --disable-nonfree=n --sandbox-ok=y --compiler-flavors=win64 --cflags=-march=znver3 --build-x264-with-libav=y --enable-gpl=y
When I changed znver3
to x86-64
I got different error, after removing --cflags=-march=
option it compiles just fine.
I'm guessing it might be related to this GCC version which might need to be updated to something like 11.4.0.
Compiled on CPU: AMD 5600X Vermeer (Zen 3 based)
OK I finally figured out the xavs failure (gotta actually manually run it to see the failure message apparently)
/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-gcc conftest.c -march=znver3 -Wall -I. -o conftest
cc1: error: bad value ('znver3') for '-march=' switch
cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake tigerlake cooperlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 native; did you mean
znver1'?
so I guess the gcc isn't new enough to recognizer znver3, as expected.
libflite seems to have a very weird condition where if the method is declared __inline in the .h and in the .c, "sometimes" gcc would export it and sometimes not (?) maybe it was able to inline it more easily with some -march ? gcc bug? what?
related ../../include/cst_tokenstream.h:134:14: warning: inline function 'ts_utf8_sequence_length' declared but never defined 134 | __inline int ts_utf8_sequence_length(char c0);
Anyway pull the latest libflite, thanks for the report. I'll try some newer gcc's but have had problems in the past so it may not be easy...cheers!
Unfortunately bumping to gcc 13.2.0 causes a few things to fail, so that's not going to be trivial or forthcoming quick... :)