linux – Compile ffmpeg 5.1 with libopenjpeg
I’m trying to enable libopenjpeg in ffmpeg 5.1. I have compiled openjpeg from OpenJPEG git repository, and it is installed in the system as per the instructions in Installation Guide. I can verify the installation with “pkg-config” using,
pkg-config --libs --cflags "libopenjp2 >= 2.1.0".
This outputs:
-I/ffmpeg_build/include/openjpeg-2.5 -L/ffmpeg_build/lib -lopenjp2
However, when trying to run ./configure to compile ffmpeg,I get the following error
ERROR: libopenjp2 >= 2.1.0 not found using pkg-config
The ./configure command I’m using is:
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --pkg-config-flags="--static" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -L$HOME/ffmpeg_build/lib64" --extra-libs=-lpthread --extra-libs=-lm --bindir="$HOME/bin" --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-openssl --enable-demuxer=spdif --enable-decoder=dolby_e --enable-decoder=ac3 --enable-gpl --enable-decoder=eac3 --enable-indev=alsa --enable-outdev=alsa --enable-libsrt --enable-nonfree --enable-openssl --enable-shared --enable-libopenjpeg
The ffbuild/config.log output which contain the error shows the following.
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I/home/ffmpeg_build/include -I/home/ffmpeg_build/include/openjpeg-2.5 -std=c11 -fomit-frame-pointer -fPIC -pthread -I/home/ffmpeg_build/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -pthread -I/home/ffmpeg_build/include/openjpeg-2.5 -DOPJ_STATIC -L/home/ffmpeg_build/lib -DOPJ_STATIC -c -o /tmp/ffconf.ZnMEl1ya/test.o /tmp/ffconf.ZnMEl1ya/test.c
gcc -L/home/ffmpeg_build/lib -L/home/ffmpeg_build/lib64 -Wl,–as-needed -Wl,-z,noexecstack -I/home/ffmpeg_build/include/openjpeg-2.5 -DOPJ_STATIC -L/home/ffmpeg_build/lib -DOPJ_STATIC -o /tmp/ffconf.ZnMEl1ya/test /tmp/ffconf.ZnMEl1ya/test.o -lopenjp2 -lm -lm -lpthread
/usr/bin/ld: /tmp/ffconf.ZnMEl1ya/test.o: in functioncheck_opj_version': test.c:(.text+0x3): undefined reference to
opj_version’
/usr/bin/ld: /tmp/ffconf.ZnMEl1ya/test: hidden symbol `opj_version’ isn’t defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ERROR: libopenjp2 >= 2.1.0 not found using pkg-config
I’m on Fedora 38, with Linux kernel 6.8.9. How do I get pkg-config in ffmpeg’s configure to see the existence of libopenjp2?
Read more here: Source link