Make b_lto work with libav/FFmpeg again in 1.24.x
The below occurs on any shared (not static) build compiling FFmpeg while using -Db_lto=true
(was not the case in GStreamer 1.22.x):
[5823/5825] Generating subprojects/gst-plugins-rs/gst-plugins-rs-pc-files with a custom command
[5825/5825] Linking target subprojects/gst-libav/ext/libav/libgstlibav.so
FAILED: subprojects/gst-libav/ext/libav/libgstlibav.so
cc -o subprojects/gst-libav/ext/libav/libgstlibav.so subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstav.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavprotocol.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavcodecmap.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavutils.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavaudenc.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavvidenc.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavauddec.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavviddec.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavcfg.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavdemux.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavmux.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavdeinterlace.c.o subprojects/gst-libav/ext/libav/libgstlibav.so.p/gstavvidcmp.c.o -flto -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,-soname,libgstlibav.so -Wl,-z,nodelete -Wl,--exclude-libs=ALL '-Wl,-rpath,$ORIGIN/../../../gstreamer/gst:$ORIGIN/../../../gstreamer/libs/gst/base:$ORIGIN/../../../gst-plugins-base/gst-libs/gst/video:$ORIGIN/../../../orc/orc:$ORIGIN/../../../gst-plugins-base/gst-libs/gst/audio:$ORIGIN/../../../gst-plugins-base/gst-libs/gst/tag:$ORIGIN/../../../gst-plugins-base/gst-libs/gst/pbutils' -Wl,-rpath-link,/tmp/gstreamer/builddir/subprojects/gstreamer/gst -Wl,-rpath-link,/tmp/gstreamer/builddir/subprojects/gstreamer/libs/gst/base -Wl,-rpath-link,/tmp/gstreamer/builddir/subprojects/gst-plugins-base/gst-libs/gst/video -Wl,-rpath-link,/tmp/gstreamer/builddir/subprojects/orc/orc -Wl,-rpath-link,/tmp/gstreamer/builddir/subprojects/gst-plugins-base/gst-libs/gst/audio -Wl,-rpath-link,/tmp/gstreamer/builddir/subprojects/gst-plugins-base/gst-libs/gst/tag -Wl,-rpath-link,/tmp/gstreamer/builddir/subprojects/gst-plugins-base/gst-libs/gst/pbutils -Wl,--start-group subprojects/FFmpeg/libavfilter.a subprojects/FFmpeg/libavutil.a subprojects/FFmpeg/libavformat.a subprojects/FFmpeg/libavcodec.a subprojects/FFmpeg/libswresample.a subprojects/FFmpeg/libswscale.a subprojects/FFmpeg/libpostproc.a subprojects/gstreamer/gst/libgstreamer-1.0.so.0.2400.0 subprojects/gstreamer/libs/gst/base/libgstbase-1.0.so.0.2400.0 subprojects/gst-plugins-base/gst-libs/gst/video/libgstvideo-1.0.so.0.2400.0 subprojects/orc/orc/liborc-0.4.so.0.37.0 subprojects/gst-plugins-base/gst-libs/gst/audio/libgstaudio-1.0.so.0.2400.0 subprojects/gst-plugins-base/gst-libs/gst/tag/libgsttag-1.0.so.0.2400.0 subprojects/gst-plugins-base/gst-libs/gst/pbutils/libgstpbutils-1.0.so.0.2400.0 -pthread -lm -latomic -lz -lbz2 -ldl /usr/lib/x86_64-linux-gnu/libglib-2.0.so /usr/lib/x86_64-linux-gnu/libgobject-2.0.so /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so /usr/lib/x86_64-linux-gnu/libz.so -latomic -lz -lbz2 -latomic -latomic -lz -lbz2 -latomic -lz -latomic -latomic -latomic -Wl,--end-group
../subprojects/FFmpeg/libswscale/x86/rgb2rgb_template.c:1821:6: warning: type of ‘ff_nv12ToUV_avx’ does not match original declaration [-Wlto-type-mismatch]
1821 | void RENAME(ff_nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
| ^
../subprojects/FFmpeg/libswscale/x86/swscale.c:323:1: note: type mismatch in parameter 8
323 | INPUT_FUNCS(avx);
| ^
../subprojects/FFmpeg/libswscale/x86/swscale.c:323:1: note: ‘ff_nv12ToUV_avx’ was previously declared here
../subprojects/FFmpeg/libswscale/x86/rgb2rgb_template.c:1821:6: warning: type of ‘ff_nv12ToUV_sse2’ does not match original declaration [-Wlto-type-mismatch]
1821 | void RENAME(ff_nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
| ^
../subprojects/FFmpeg/libswscale/x86/swscale.c:321:1: note: type mismatch in parameter 8
321 | INPUT_FUNCS(sse2);
| ^
../subprojects/FFmpeg/libswscale/x86/swscale.c:321:1: note: ‘ff_nv12ToUV_sse2’ was previously declared here
/usr/bin/ld: subprojects/FFmpeg/libavutil.a(tx_float.asm.o): relocation R_X86_64_PC32 against symbol `ff_tx_tab_32_float' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Build pipeline: https://github.com/selkies-project/selkies-gstreamer/blob/main/addons/gstreamer/Dockerfile