Opened 7 years ago
Closed 7 years ago
#7106 closed defect (invalid)
Compiling FFmpeg with VAAPI enabled results in failure at: /FFmpeg/libavutil/hwcontext_vaapi.c:1235: undefined reference to `vaSetErrorCallback' using libva master branch
Reported by: | Dennis E. Mungai | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | git-master | Keywords: | libva |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
Building FFmpeg with VAAPI enabled results in the error above. Attaching relevant logs below.
Notes: I installed libva from upstream, compiled from source: https://github.com/intel/libva/tree/master
How to reproduce:
Build libva and libva-utils from upstream, confirm all is working as expected via vainfo, then build FFmpeg:
- vainfo:
vainfo libva info: VA-API version 1.1.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_1_1 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.1 (libva 2.1.1.pre1) vainfo: Driver version: Intel i965 driver for Intel(R) Ivybridge Desktop - 2.1.1.pre1 (2.1.0-41-g99c3748) vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Simple : VAEntrypointEncSlice VAProfileMPEG2Main : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointEncSlice VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileH264StereoHigh : VAEntrypointVLD VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc VAProfileJPEGBaseline : VAEntrypointVLD
How libva and its' components were built:
Build platform: Ubuntu 16.04LTS
Installing the base dependencies:
sudo apt-get -y install autoconf automake build-essential libass-dev libtool pkg-config texinfo zlib1g-dev libva-dev cmake mercurial libdrm-dev
I then created a clean working directory and worked from there:
mkdir -p ~/vaapi mkdir -p ~/ffmpeg_build
Individual components:
- cmrt:
This is the C for Media Runtime GPU Kernel Manager for Intel G45 & HD Graphics family. it's a prerequisite for building the intel-hybrid-driver package.
cd ~/vaapi git clone https://github.com/01org/cmrt cd cmrt ./autogen.sh ./configure time make -j$(nproc) VERBOSE=1 sudo make -j$(nproc) install
- libva:
Libva is an implementation for VA-API (Video Acceleration API)
VA-API is an open-source library and API specification, which provides access to graphics hardware acceleration capabilities for video processing. It consists of a main library and driver-specific acceleration backends for each supported hardware vendor. It is a prerequisite for building the VAAPI driver components below.
cd ~/vaapi git clone https://github.com/01org/libva cd libva ./autogen.sh ./configure time make -j$(nproc) VERBOSE=1 sudo make -j$(nproc) install
- intel-hybrid-driver:
This package provides support for WebM project VPx codecs. GPU acceleration is provided via media kernels executed on Intel GEN GPUs. The hybrid driver provides the CPU bound entropy (e.g., CPBAC) decoding and manages the GEN GPU media kernel parameters and buffers.
This package grants access to the VPX-series hybrid decode capabilities on supported hardware configurations.
cd ~/vaapi git clone https://github.com/01org/intel-hybrid-driver cd intel-hybrid-driver ./autogen.sh ./configure time make -j$(nproc) VERBOSE=1 sudo make -j$(nproc) install
- intel-vaapi-driver:
This package provides the VA-API (Video Acceleration API) user mode driver for Intel GEN Graphics family SKUs. The current video driver back-end provides a bridge to the GEN GPUs through the packaging of buffers and commands to be sent to the i915 driver for exercising both hardware and shader functionality for video decode, encode, and processing. it also provides a wrapper to the intel-hybrid-driver when called up to handle VP8/9 hybrid decode tasks on supported hardware (when configured with the --enable-hybrid-codec option as shown below:).
cd ~/vaapi git clone https://github.com/01org/intel-vaapi-driver cd intel-vaapi-driver ./autogen.sh ./configure --enable-hybrid-codec time make -j$(nproc) VERBOSE=1 sudo make -j$(nproc) install
- libva-utils:
This package provides a collection of tests for VA-API, such as vainfo, needed to validate a platform's supported features (encode, decode & postproc attributes on a per-codec basis by VAAPI entry points information).
cd ~/vaapi git clone https://github.com/intel/libva-utils cd libva-utils ./autogen.sh ./configure time make -j$(nproc) VERBOSE=1 sudo make -j$(nproc) install
I then set the environment variables for the VAAPI drivers as shown below:
Check if LIBVA environment variables are correctly configured:
set | grep LIBVA
Should output something like:
LIBVA_DRIVER_NAME=i965 LIBVA_DRIVERS_PATH=/usr/local/lib/dri
If not (as expected), set them on your system environment variables (/etc/environment) and reboot.
sudo systemctl reboot
After the reboot, I then proceeded to build FFmpeg as shown:
Preparing the workspace directories:
mkdir -p $HOME/bin chown -Rc $USER:$USER $HOME/bin mkdir -p ~/ffmpeg_sources
Including extra components as needed:
(a). Build and deploy nasm: Nasm is an assembler for x86 optimizations used by x264 and FFmpeg. Highly recommended or your resulting build may be very slow.
Note that we've now switched away from Yasm to nasm, as this is the current assembler that x265,x264, among others, are adopting.
cd ~/ffmpeg_sources wget wget http://www.nasm.us/pub/nasm/releasebuilds/2.14rc0/nasm-2.14rc0.tar.gz tar xzvf nasm-2.14rc0.tar.gz cd nasm-2.14rc0 ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make -j$(nproc) VERBOSE=1 make -j$(nproc) install make -j$(nproc) distclean
(b). Build and deploy libx264 statically: This library provides a H.264 video encoder. See the H.264 Encoding Guide for more information and usage examples. This requires ffmpeg to be configured with --enable-gpl --enable-libx264.
cd ~/ffmpeg_sources git clone http://git.videolan.org/git/x264.git -b stable cd x264/ PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --enable-static --disable-opencl PATH="$HOME/bin:$PATH" make -j$(nproc) VERBOSE=1 make -j$(nproc) install VERBOSE=1 make -j$(nproc) distclean
(c). Build and configure libx265: This library provides a H.265/HEVC video encoder. See the H.265 Encoding Guide for more information and usage examples.
cd ~/ffmpeg_sources hg clone https://bitbucket.org/multicoreware/x265 cd ~/ffmpeg_sources/x265/build/linux PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source make -j$(nproc) VERBOSE=1 make -j$(nproc) install VERBOSE=1 make -j$(nproc) clean VERBOSE=1
(d). Build and deploy the libfdk-aac library: This provides an AAC audio encoder. See the AAC Audio Encoding Guide for more information and usage examples. This requires ffmpeg to be configured with --enable-libfdk-aac (and --enable-nonfree if you also included --enable-gpl).
cd ~/ffmpeg_sources wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master tar xzvf fdk-aac.tar.gz cd mstorsjo-fdk-aac* autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make -j$(nproc) make -j$(nproc) install make -j$(nproc) distclean
(e). Build and configure libvpx
cd ~/ffmpeg_sources git clone https://chromium.googlesource.com/webm/libvpx cd libvpx ./configure --prefix="$HOME/ffmpeg_build" --enable-runtime-cpu-detect --enable-vp9 --enable-vp8 \ --enable-postproc --enable-vp9-postproc --enable-multi-res-encoding --enable-webm-io --enable-better-hw-compatibility --enable-vp9-highbitdepth --enable-onthefly-bitpacking --enable-realtime-only --cpu=native --as=nasm time make -j$(nproc) time make -j$(nproc) install time make clean -j$(nproc) time make distclean
(f). Build LibVorbis
cd ~/ffmpeg_sources wget -c -v http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.tar.xz tar -xvf libvorbis-1.3.6.tar.xz cd libvorbis-1.3.6 ./configure --enable-static --prefix="$HOME/ffmpeg_build" time make -j$(nproc) time make -j$(nproc) install time make clean -j$(nproc) time make distclean
(g). Build FFmpeg:
cd ~/ffmpeg_sources git clone https://github.com/FFmpeg/FFmpeg -b master cd FFmpeg PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig:/usr/local/lib/pkgconfig" ./configure \ --pkg-config-flags="--static" \ --prefix="$HOME/bin" \ --extra-cflags="-I$HOME/bin/include" \ --extra-ldflags="-L$HOME/bin/lib" \ --bindir="$HOME/bin" \ --enable-vaapi \ --disable-debug \ --enable-libvorbis \ --enable-libvpx \ --enable-libdrm \ --enable-gpl \ --cpu=native \ --enable-opengl \ --enable-libfdk-aac \ --enable-libx264 \ --enable-libx265 \ --extra-libs=-lpthread \ --enable-nonfree PATH="$HOME/bin" make -j$(nproc) make -j$(nproc) install make -j$(nproc) distclean hash -r
Failures encountered:
The build runs and as it almost finishes, it halts with an error as shown below:
INSTALL libavcodec/libavcodec.a libavutil/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_create': hwcontext_vaapi.c:(.text+0x1883): undefined reference to `vaSetErrorCallback' hwcontext_vaapi.c:(.text+0x1893): undefined reference to `vaSetInfoCallback' libavutil/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_derive': hwcontext_vaapi.c:(.text+0x24c3): undefined reference to `vaSetErrorCallback' hwcontext_vaapi.c:(.text+0x24d3): undefined reference to `vaSetInfoCallback' libavutil/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_create': hwcontext_vaapi.c:(.text+0x1883): undefined reference to `vaSetErrorCallback' hwcontext_vaapi.c:(.text+0x1893): undefined reference to `vaSetInfoCallback' libavutil/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_derive': hwcontext_vaapi.c:(.text+0x24c3): undefined reference to `vaSetErrorCallback' hwcontext_vaapi.c:(.text+0x24d3): undefined reference to `vaSetInfoCallback' collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status Makefile:107: recipe for target 'ffmpeg_g' failed make: *** [ffmpeg_g] Error 1 make: *** Waiting for unfinished jobs.... Makefile:107: recipe for target 'ffprobe_g' failed make: *** [ffprobe_g] Error 1 libavutil/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_create': hwcontext_vaapi.c:(.text+0x1883): undefined reference to `vaSetErrorCallback' hwcontext_vaapi.c:(.text+0x1893): undefined reference to `vaSetInfoCallback' libavutil/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_derive': hwcontext_vaapi.c:(.text+0x24c3): undefined reference to `vaSetErrorCallback' hwcontext_vaapi.c:(.text+0x24d3): undefined reference to `vaSetInfoCallback' collect2: error: ld returned 1 exit status Makefile:107: recipe for target 'ffplay_g' failed make: *** [ffplay_g] Error 1
Attachments (1)
Change History (4)
by , 7 years ago
Attachment: | config.log added |
---|
comment:1 by , 7 years ago
You have a pre-libva2 version of libva before the one you actually want to use in the library path. You need to link with the same version as you have headers for.
comment:2 by , 7 years ago
Thanks, adding the options below fixed the build:
--extra-cflags="-I/usr/local/include" \ --extra-ldflags="-L/usr/local/lib" \
Marking as solved.
comment:3 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
config.log (generated by ./configure in fftools/config.log)