PR #25734 opened by Kilian (lusoris)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25734
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25734.patch

Three filters call into a library that the conditional library dependency list 
in configure does not name for them. A shared build with only one of these 
filters enabled links libavfilter without that library, so a consumer that 
links with `-Wl,--no-allow-shlib-undefined` or loads with `LD_BIND_NOW=1` fails 
on undefined symbols.

- **scale_vulkan → libswscale:** `sws_alloc_context()`, `sws_scale_frame()` and 
`sws_free_context()` in vf_scale_vulkan.c.
- **metadata, ametadata → libavformat:** `avio_open()` and `avio_vprintf()` in 
f_metadata.c.

Each filter's `_deps` line already lists the library; only the `prepend 
avfilter_deps` entry was missing. Reported in the review of pull request 25638.

## Measurements

Shared build, `--disable-everything --disable-programs --disable-doc 
--enable-shared --disable-static` plus the one filter. A small consumer calls 
`avfilter_get_by_name()` and `avfilter_graph_alloc_filter()` for the filter, 
linked with `-Wl,--no-allow-shlib-undefined` against `-lavfilter -lavutil` only.

| Filter | Without this series | With this series |
|---|---|---|
| scale_vulkan | `avfilter_FFLIBS=avutil`, link fails: `sws_alloc_context`, 
`sws_free_context`, `sws_scale_frame` | `avfilter_FFLIBS=swscale avutil`, 
libswscale NEEDED, link and run rc 0 |
| metadata | `avfilter_FFLIBS=avutil`, link fails on the avio symbols | 
`avfilter_FFLIBS=avformat avcodec avutil`, libavformat NEEDED, link and run rc 
0 |
| ametadata | same as metadata | same as metadata |

The scale_vulkan row was measured on top of pull request 25638, because a 
standalone scale_vulkan build on master also lacks scale_eval.o; that pull 
request adds it. The metadata rows were measured on master. `make fate-source` 
passes.

## Other filters checked

All 31 filters whose configure dependencies reach libavcodec, libavformat, 
libswscale or libswresample were compared against the list (44 filter/library 
pairs). Every other pair already has its entry. The four DNN filters (derain, 
dnn_classify, dnn_detect, dnn_processing) also have no entry for libavformat 
and libswscale, but no DNN backend is available here to build them, so they are 
left out of this series rather than changed untested.



From 91f3c1830a4e3e85e45f57b4eeee0ab43a72aa26 Mon Sep 17 00:00:00 2001
From: lusoris <[email protected]>
Date: Tue, 3 Nov 2026 21:41:09 +0100
Subject: [PATCH 1/2] configure: add the libswscale dependency of scale_vulkan

scale_vulkan calls sws_alloc_context(), sws_scale_frame() and
sws_free_context(), and scale_vulkan_filter_deps lists swscale, but
the conditional library dependency list has no entry for the filter.
A build with only this filter enabled sets avfilter_FFLIBS=avutil, so
a shared libavfilter has no libswscale NEEDED entry and a consumer
linked with -Wl,--no-allow-shlib-undefined fails on the three sws_*
symbols.

With this entry avfilter_FFLIBS=swscale avutil and the consumer links
and runs with LD_BIND_NOW=1. A standalone scale_vulkan build also
needs scale_eval.o, which "avfilter/Makefile: add missing objects for
standalone Vulkan filters" adds.

Signed-off-by: lusoris <[email protected]>
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 4f920a4f553..c1950f6c5dc 100755
--- a/configure
+++ b/configure
@@ -8252,6 +8252,7 @@ enabled qrencodesrc_filter  && prepend avfilter_deps 
"swscale"
 enabled removelogo_filter   && prepend avfilter_deps "avformat avcodec swscale"
 enabled sab_filter          && prepend avfilter_deps "swscale"
 enabled scale_filter        && prepend avfilter_deps "swscale"
+enabled scale_vulkan_filter && prepend avfilter_deps "swscale"
 enabled scale2ref_filter    && prepend avfilter_deps "swscale"
 enabled showcqt_filter      && prepend avfilter_deps "avformat swscale"
 enabled signature_filter    && prepend avfilter_deps "avcodec"
-- 
2.54.0


From 2f336eea63db54261dcce606e9c57180bcbf255f Mon Sep 17 00:00:00 2001
From: lusoris <[email protected]>
Date: Tue, 3 Nov 2026 21:41:17 +0100
Subject: [PATCH 2/2] configure: add the libavformat dependency of metadata and
 ametadata

f_metadata.c opens its output file with avio_open() and writes it
with avio_vprintf(). metadata_filter_deps and ametadata_filter_deps
list avformat, but the conditional library dependency list has no
entry for either filter, so a build with only one of them enabled sets
avfilter_FFLIBS=avutil and a shared libavfilter has no libavformat
NEEDED entry; a consumer linked with -Wl,--no-allow-shlib-undefined
fails on the avio symbols.

With these entries avfilter_FFLIBS=avformat avcodec avutil and the
consumer links and runs with LD_BIND_NOW=1.

Signed-off-by: lusoris <[email protected]>
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index c1950f6c5dc..2bbc7812eb3 100755
--- a/configure
+++ b/configure
@@ -8237,6 +8237,7 @@ done
 enabled zlib && add_cppflags -DZLIB_CONST
 
 # conditional library dependencies, in any order
+enabled ametadata_filter    && prepend avfilter_deps "avformat"
 enabled amovie_filter       && prepend avfilter_deps "avformat avcodec"
 enabled aresample_filter    && prepend avfilter_deps "swresample"
 enabled cover_rect_filter   && prepend avfilter_deps "avformat avcodec"
@@ -8245,6 +8246,7 @@ enabled elbg_filter         && prepend avfilter_deps 
"avcodec"
 enabled find_rect_filter    && prepend avfilter_deps "avformat avcodec"
 enabled fsync_filter        && prepend avfilter_deps "avformat"
 enabled mcdeint_filter      && prepend avfilter_deps "avcodec"
+enabled metadata_filter     && prepend avfilter_deps "avformat"
 enabled movie_filter        && prepend avfilter_deps "avformat avcodec"
 enabled pan_filter          && prepend avfilter_deps "swresample"
 enabled qrencode_filter     && prepend avfilter_deps "swscale"
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to