FFmpeg for Super Resolution : libtensorflow_framework Relink Error & vaSyncBuffer undefined symbol
I am trying to do Super Resolution with FFmpeg following this thread from Video Stackexchange : How do the super resolution filters in FFmpeg work ?.
SYSTEM :
- Ubuntu 20.04
- Nvidia 510 (verified using
nvidia-smi) - CUDA 11.6 (verified using (
nvcc --version) - CUDNN 8.4 (installation method and running verification following their official website)
- Tensorflow 2.7.0 (installation method and running verification following their official website)
- TensorRT (installed from
pip3) - Installed
zlib1gandzlib1g-dev(viaapt-get)
I had to build ffmpeg with tensorflow, here's the complete settings from the tutorial :
./configure \ --prefix="$HOME/ffmpeg_build" \ --pkg-config-flags="--static" \ --extra-cflags="-I$HOME/ffmpeg_build/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ --extra-libs="-lpthread -lm" \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-gnutls \ --enable-libass \ --enable-libfdk-aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-libx265 \ --enable-libtensorflow \ --enable-nonfreeERROR :There was no error during building & installing FFmpeg from source. However, running FFmpeg (including ffmpeg --version) result in this error :
ffmpeg: Relink `/usr/local/lib/libtensorflow_framework.so.2' with `/lib/x86_64-linux-gnu/libz.so.1' for IFUNC symbol `crc32_z'
ffmpeg: symbol lookup error: ffmpeg: undefined symbol: vaSyncBufferLooks like it's tensorflow-related, however I have verified that tensorflow is working properly on my system. I could find nothing on Google, there's just one thread discussing exactly the same error (here), however there is still no solution as well. I am aware the error is not symlink related, but just in case this information is needed :
$ ls -l /usr/local/lib | grep "libtensor*"
lrwxrwxrwx 1 root root 28 Apr 10 05:17 libtensorflow_framework.so -> libtensorflow_framework.so.2
lrwxrwxrwx 1 root root 32 Apr 10 05:19 libtensorflow_framework.so.2 -> libtensorflow_framework.so.2.7.0
-r-xr-xr-x 1 root root 38362936 Apr 10 05:14 libtensorflow_framework.so.2.7.0
lrwxrwxrwx 1 root root 18 Apr 10 05:18 libtensorflow.so -> libtensorflow.so.2
lrwxrwxrwx 1 root root 22 Apr 10 05:19 libtensorflow.so.2 -> libtensorflow.so.2.7.0
-r-xr-xr-x 1 root root 784355912 Apr 10 05:14 libtensorflow.so.2.7.0
$ ldd /usr/local/lib/libtensorflow_framework.so.2 linux-vdso.so.1 (0x00007ffdd598e000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc9f93bd000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc9f926e000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc9f9264000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc9f9241000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc9f9027000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc9f900c000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc9f8e18000) /lib64/ld-linux-x86-64.so.2 (0x00007fc9fb31a000)
$ ls -l /lib/x86_64-linux-gnu | grep "libz.*"
lrwxrwxrwx 1 root root 14 Oct 15 2020 libz.so.1 -> libz.so.1.2.11
-rw-r--r-- 1 root root 108936 Oct 15 2020 libz.so.1.2.11
$ ldd /lib/x86_64-linux-gnu/libz.so.1 linux-vdso.so.1 (0x00007ffc693bf000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3935cfb000) /lib64/ld-linux-x86-64.so.2 (0x00007f3935f5c000) [UPDATE]
Error 1 is solved (see answer below). Now what remains is Error 2 :
$ ffmpeg --version
ffmpeg: symbol lookup error: ffmpeg: undefined symbol: vaSyncBufferAny suggestion ?
1 Answer
FIX FOR ERROR 1 :
ffmpeg: Relink `/usr/local/lib/libtensorflow_framework.so.2' with `/lib/x86_64-linux-gnu/libz.so.1' for IFUNC symbol `crc32_z'I have zlib1g installed via apt-get and I guess that was the problem because it wasn't the version that FFmpeg wanted. I'm following answer from this question with some modifications :
Look for information regarding symbolic link on
libz.so.1ls -ls /lib/x86_64-linux-gnu | grep "libz*" 0 lrwxrwxrwx 1 root root 14 Mar 27 01:21 libz.so.1 -> libz.so.1.2.11 116 -rw-r--r-- 1 root root 116960 Mar 27 01:21 libz.so.1.2.11Open this website and look for a package following the symbolic link (mine is
libz.so.1.2.11). I downloaded all packages (3 of them :zlib1g,zlib1g-devandzlib1g-dbg).Remove and purge already installed
zlib1gandzlib1g-devwithapt-get remove --purge, then fix anything withsudo apt --fix-broken installif necessary.Install 3 packages from point 2 with :
sudo dpkg -isudo ldconfig.
Done, error 1 is gone.
PS : If you do apt-get dist-upgrade you will be asked to upgrade zlib1g and/or zlib1g-dev, well, don't upgrade them otherwise you will encounter this error again. I hold mine from upgrade with apt-mark hold.
FIX FOR ERROR 2 :
$ ffmpeg --version
ffmpeg: symbol lookup error: ffmpeg: undefined symbol: vaSyncBufferRemove all
libva*installation from machine.Install libva and libva-utils from Intel Github.
libvain particular will get installed in a directory that FFmpeg won't find. Therefore, during configuration of both, add prefix/usr./configure --prefix=/usrReboot.
No more vaSyncBuffer error. FFmpeg managed to find libva