m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.56k stars 266 forks source link

ffmpeg: ERROR: libvvenc >= 1.6.1 not found using pkg-config #2756

Closed LigH-de closed 3 months ago

LigH-de commented 3 months ago

Commit #2753 is supposed to add support vor libvvenc to ffmpeg in case of the complete preset configuration (INI option ffmpegChoice=4).

I set up the suite to use the custom configuration file (build/ffmpeg_options.txt) with INI option ffmpegChoice=1, so I added --enable-libvvenc to it manually.

┌ ffmpeg git  ......................................... [Recently updated]
├ Changing options to comply to gplv3...
master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
    Patch could not be applied with `git am`. Continuing without patching.
├ Compiling static FFmpeg...
├ Running uninstall...
├ Running configure...
Likely error (tail of the failed operation logfile):
CXXFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1
LDFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++ -L/local64/lib -L/mingw64/lib
../configure --prefix=/local64 --bindir=/local64/bin-video --pkg-config=pkgconf --pkg-config-flags=--keep-system-libs --keep-system-cflags --static --cc=ccache gcc --cxx=ccache g++ --ld=ccache g++ --extra-cxxflags=-fpermissive --extra-cflags=-Wno-int-conversion --disable-autodetect --disable-doc --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --enable-ffnvcodec --enable-nvdec --enable-cuda-llvm --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-libaom --disable-debug --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libopenmpt --enable-librav1e --enable-libsrt --enable-libgsm --enable-libvmaf --enable-libsvtav1 --enable-chromaprint --enable-frei0r --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfribidi --enable-libgme --enable-libilbc --enable-libsvthevc --enable-libkvazaar --enable-libmodplug --enable-librist --enable-librtmp --enable-librubberband --enable-libtesseract --enable-libxavs --enable-libzmq --enable-libzvbi --enable-openal --enable-libcodec2 --enable-ladspa --enable-vapoursynth --enable-libglslang --enable-vulkan --enable-libdavs2 --enable-libxavs2 --enable-libuavs3d --enable-libplacebo --enable-libjxl --enable-libvvenc --enable-libxeve --enable-libxevd --enable-opencl --enable-opengl --enable-libopenh264 --enable-gnutls --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DCACA_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCHROMAPRINT_NODLL --extra-cflags=-DZMQ_STATIC --extra-libs=-lpsapi --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads --extra-cflags=-DKVZ_STATIC_LIB --extra-cflags=-DAL_LIBTYPE_STATIC --extra-cflags=-IG:/MABS/local64/include --extra-cflags=-IG:/MABS/local64/include/AL --extra-version=g817c6a6762+3
ERROR: libvvenc >= 1.6.1 not found using pkg-config

logs.zip

local64/lib/pkgconfig/libvvenc.pc

prefix=G:/MABS/local64
exec_prefix=G:/MABS/local64/bin-video
libdir=G:/MABS/local64/lib
includedir=G:/MABS/local64/include

Name: libvvenc
Description: Fraunhofer Versatile Video Encoder (VVenC)
Version: 1.12.0
Libs: -L${libdir} -lvvenc
Libs.private: -lG:/MABS/msys64/mingw64/lib/libstdc++.a -lmingw32 -lgcc -lmingwex -lkernel32 -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmingwex -lkernel32
Cflags: -I${includedir}
KokonoeTooru commented 3 months ago

Apparently https://github.com/fraunhoferhhi/vvenc/commit/18af3bb794e2b7fbf48cc066eb6d6a00654202d9 resolve all library to its path, which may or may not exist.

For me, remove "-lG:/MABS/msys64/mingw64/lib/libstdc++.a" works.

Here's my temporary fix:

     do_cmakeinstall video -DVVENC_ENABLE_LINK_TIME_OPT=OFF -DVVENC_INSTALL_FULLFEATURE_APP=ON
+    _path=`cygpath -m $MINGW_PREFIX/lib/libstdc++.a`
+    sed -i "10 s#-l${_path//#\\#}\s##1" "$LOCALDESTDIR/lib/pkgconfig/libvvenc.pc"
     do_checkIfExist
+    unset _path
L4cache commented 3 months ago

And these libraries should be added implicitly by compiler, like this, if I'm not mistaken https://github.com/m-ab-s/media-autobuild_suite/commit/11cdb5dc3ac3d73a158755d53e320cd9374fd278

lhksoft commented 3 months ago

Follow instructions as mentioned at following page : vvenc ffmpeg integration

I did so for the windows-section (instructions for m-ab-s) and the compilation succeeded completely

LigH-de commented 3 months ago

Aaaaand ... it's gone. I believe.

Add-support-for-H266-VVC.patch
    Patch could not be applied with `git am`. Continuing without patching.

Testing again after completely removing build/ffmpeg-git to enforce a complete re-download.

L4cache commented 3 months ago

That patch is no longer compatible with FFmpeg git master.

L4cache commented 3 months ago

I think -l with absolute path is incorrect syntax? ~This may be a CMake bug, or msys2's.~ Oh the -l is added by their cmake code, not cmake itself. So yeah, they should be more careful when prepending -l.

lehmann-c commented 3 months ago

I think -l with absolute path is incorrect syntax? ~This may be a CMake bug, or msys2's.~ Oh the -l is added by their cmake code, not cmake itself. So yeah, they should be more careful when prepending -l.

It´s a bug in VVenC for pkgconfig as '-l' mustn´t be use for absolute paths. A fix will be out today hopefully.

lehmann-c commented 3 months ago

The vvenc installation bug should be fixed by now. https://github.com/fraunhoferhhi/vvenc/pull/414

LigH-de commented 3 months ago

PR has been merged, testing...

LigH-de commented 3 months ago

That patch is no longer compatible with FFmpeg git master.

Without that patch, there is no vvdec support yet. But vvenc can be linked in ffmpeg now.

lhksoft commented 3 months ago

Compilation takes with me over 3 hours, even I selected to use 18 cores (my cpu has 28 cores so that should be fine). The solution I gave at sunday makes the compilation continue and finish. The patch was not included but at least the compilation dind't break. Afterwards I had vvdec included, vvenc was skiped. I will try again as they say the patch should now be working..

KokonoeTooru commented 3 months ago

Without that patch, there is no vvdec support yet. But vvenc can be linked in ffmpeg now.

With vvdec, you have to fix their cmake like this: https://github.com/fraunhoferhhi/vvenc/pull/414. And linking vvdec with ffmpeg needs the rebased version of this newer patch.

lehmann-c commented 3 months ago

Without that patch, there is no vvdec support yet. But vvenc can be linked in ffmpeg now.

With vvdec, you have to fix their cmake like this: fraunhoferhhi/vvenc#414. And linking vvdec with ffmpeg needs the rebased version of this newer patch.

The cmake bug is also fixed for VVdeC now and build should work again: https://github.com/fraunhoferhhi/vvdec/pull/192

LigH-de commented 3 months ago

Only after that patch got rebased or committed. Not yet.

KokonoeTooru commented 3 months ago

Only after that patch got rebased or committed. Not yet.

In the comments of the patch, the author won't update/rebased the patch, and the patch won't be gotten committed because:

In this project we prefer internal decoders to external libs.

Now that we have an internal vvc decoder, we can focus on improving it.

But looking at the linux section of 'FFmpeg Integration', the rebased patch is pretty easy (the only thing that needs change is ./configure), and then maybe add it to https://github.com/m-ab-s/mabs-patches ?

L4cache commented 3 months ago

~It's not that easy (anymore) because ffmpeg's native vvc decoder introduces some conflicts, but should be fixable with some fairly simple tweaking.~ I must had been using the old patch, new patch is compatible.

lhksoft commented 3 months ago

It's been solved. Follow instructions at #416

LigH-de commented 3 months ago

Works. I will try to make a PR of it...

LigH-de commented 3 months ago

Unfortunately I have no practical experience in working in github. I have no clue how to merge the edit of media-autobuild_suite.bat and the edit of build/media-suite_compile.sh into one common branch before creating a pull request. So there are: https://github.com/m-ab-s/media-autobuild_suite/pull/2761 https://github.com/m-ab-s/media-autobuild_suite/pull/2762

KokonoeTooru commented 3 months ago

Unfortunately I have no practical experience in working in github. I have no clue how to merge the edit of media-autobuild_suite.bat and the edit of build/media-suite_compile.sh into one common branch before creating a pull request. So there are: #2761 #2762

Here my version of it https://github.com/m-ab-s/media-autobuild_suite/pull/2763

KokonoeTooru commented 3 months ago

I have no clue how to merge the edit of media-autobuild_suite.bat and the edit of build/media-suite_compile.sh into one common branch before creating a pull request.

After you finished the commit for media-autobuild_suite.bat, you can just git push to add another commit to your branch.

LigH-de commented 3 months ago

I don't use the CLI, only the github web portal. I edit the files online in my fork after syncing that.

Now I believe I should have tried not to submit the single branches as separate PRs, but the master branch of my fork, or similar.

KokonoeTooru commented 3 months ago

So there are: #2761 #2762

Your version has been merged so we should close this issue for now.