FTBFS: ffmpeg >= 6.1 link order issue with pkgconfig 2.1.1
libavcodec's opus decoder now has dependency on libswresample.
This dependency is exposed through pkgconfig as
Name: libavcodec
Description: FFmpeg codec library
Version: 61.3.100
Requires: libswresample >= 5.1.100, libavutil >= 59.8.100
Requires.private:
Conflicts:
Libs: -L${libdir} -lavcodec -pthread -lm -latomic -llzma -lz -lva
Libs.private:
Cflags: -I${includedir}
Name: libavformat
Description: FFmpeg container format library
Version: 61.1.100
Requires: libavcodec >= 61.3.100, libswresample >= 5.1.100, libavutil >= 59.8.100
Requires.private:
Conflicts:
Libs: -L${libdir} -lavformat -lm -latomic -lbz2 -lz
Libs.private:
Cflags: -I${includedir}
Name: libavutil
Description: FFmpeg utility library
Version: 59.8.100
Requires:
Requires.private:
Conflicts:
Libs: -L${libdir} -lavutil -pthread -lva-drm -lva -lva-x11 -lva -lvdpau -lX11 -lm -ldrm -lva -latomic -lX11
Libs.private:
Cflags: -I${includedir}
Name: libswresample
Description: FFmpeg audio resampling library
Version: 5.1.100
Requires: libavutil >= 59.8.100
Requires.private:
Conflicts:
Libs: -L${libdir} -lswresample -lm -latomic
Libs.private:
Cflags: -I${includedir}
Which ends up on VLC's side
pkg_cv_AVCODEC_LIBS='-L/home/fcartegn/vlcsource/FFmpeg7.install/lib -lavcodec -lm -llzma -lz -lswresample -lavutil -pthread -lva-drm -lva-x11 -lvdpau -lm -ldrm -lva -latomic -lX11'
pkg_cv_AVFORMAT_LIBS='-L/home/fcartegn/vlcsource/FFmpeg7.install/lib -lavformat -lbz2 -lswresample -lavcodec -llzma -lz -lavutil -pthread -lva-drm -lva-x11 -lvdpau -lm -ldrm -lva -latomic -lX11'
It ends up inserting -lswresample
before -lavcodec
, triggering link order issue.
-lavformat -lbz2 -lswresample -lavcodec -llzma -lz -lavutil -pthread -lva-drm -lva-x11 -lvdpau -lm -ldrm -lva -latomic -lX11 -lm -lz
echo " CCLD " libavformat_plugin.la;../doltlibtool --silent --tag=CC --mode=link ccache gcc -I/home/fcartegn/vlcsource/FFmpeg7.install/include -g -O2 -pthread -I/home/fcartegn/vlcsource/vlc.contribs/x86_64-redhat-linux/include -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat -Wformat-security -Wduplicated-branches -Wduplicated-cond -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Werror-implicit-function-declaration -Winit-self -Wlogical-op -Wshadow=local -Wmultistatement-macros -pipe -fvisibility=hidden -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -funroll-loops -fstack-protector-strong -avoid-version -module -export-symbols-regex ^vlc_entry -shrext .so -no-undefined ../compat/libcompat.la ../src/libvlccore.la -Wl,-Bsymbolic -L/home/fcartegn/vlcsource/vlc.contribs/x86_64-redhat-linux/lib -Wl,-z,defs -o libavformat_plugin.la -rpath /home/fcartegn/vlcsource/vlc.build/install/lib/vlc/plugins/demux demux/avformat/libavformat_plugin_la-demux.lo demux/avformat/libavformat_plugin_la-avformat.lo demux/avformat/libavformat_plugin_la-mux.lo -L/home/fcartegn/vlcsource/FFmpeg7.install/lib -lavformat -lbz2 -lswresample -lavcodec -llzma -lz -lavutil -pthread -lva-drm -lva-x11 -lvdpau -lm -ldrm -lva -latomic -lX11 -lm -lz libavcodec_common.la
CCLD libavformat_plugin.la
/usr/bin/ld: /home/fcartegn/vlcsource/FFmpeg7.install/lib/libavcodec.a(opusdec.o): in function `opus_flush_resample':
/home/fcartegn/vlcsource/FFmpeg/libavcodec/opusdec.c:152:(.text+0x159): undefined reference to `swr_convert'
...
Switching -lswresample -lavcodec
allows to build manually
Edited by François Cartegnie