Re: Fwd: multimedia/ffmpeg: fix symbol versioning problem on stable/14

Andriy Gapon <[email protected]>
Newsgroups gmane.os.freebsd.devel.ports
Message-ID <[email protected]>
On 31/10/2025 12:21, Andriy Gapon wrote:
> 
> Noone reacted to this on [email protected], maybe people here would be 
> interested.
> It seems that now some official package builds are affected by this.

Just in case, this is the same kind of issue as discussed at length in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285401
Multiple ports had to be (individually) patched for it.

> -------- Forwarded Message --------
> Subject: multimedia/ffmpeg: fix symbol versioning problem on stable/14
> Date: Thu, 25 Sep 2025 16:16:01 +0300
> From: Andriy Gapon <[email protected]>
> To: [email protected]
> 
> 
> Preamble: I made this change a while ago but couldn't find time to share it.
> Now I see that ffmpeg 8 is in the works, so maybe I am too late or, at least, 
> the change will need some rework.
> The change addresses an issue similar to https://bugs.freebsd.org/bugzilla/ 
> show_bug.cgi?id=284651 and multiple others.
> 
> commit 7f9d8df0bafbb3ffbe0399a28b8d232bb2c58612
> Author:     Andriy Gapon <[email protected]>
> AuthorDate: Sat Jun 21 17:16:33 2025 +0300
> Commit:     Andriy Gapon <[email protected]>
> CommitDate: Sat Sep 6 15:47:50 2025 +0300
> 
>      multimedia/ffmpeg: fix symbol versioning problem on stable/14
> 
>      This is a well-known issue related to visibility of environ and __progname
>      symbols from /usr/lib/crt1.o.
> 
>      This change patches configure to give those symbols global visibility
>      when testing --version-script support.
>      Otherwise, the port would produce broken libraries without symbol versions.
> 
>      This change also adds HAS_SYMBOL_VERSION to catch the problem using
>      libavcodec.so as a canary.
> 
> diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile
> index f7c5d80adeac..fd25b9238021 100644
> --- a/multimedia/ffmpeg/Makefile
> +++ b/multimedia/ffmpeg/Makefile
> @@ -28,6 +28,7 @@ USE_PERL5=    build
>   SHEBANG_FILES=    doc/texi2pod.pl
>   NOPRECIOUSMAKEVARS=    yes # ARCH
> 
> +HAS_SYMBOL_VERSION=    ${PREFIX}/lib/libavcodec.so
>   PORTSCOUT=    limit:^6\.
> 
>   # Option CHROMAPRINT disabled, it cannot work and people are baffled.
> diff --git a/multimedia/ffmpeg/files/patch-configure b/multimedia/ffmpeg/files/ 
> patch-configure
> index 9654237228cc..c3a166b984ca 100644
> --- a/multimedia/ffmpeg/files/patch-configure
> +++ b/multimedia/ffmpeg/files/patch-configure
> @@ -28,3 +28,12 @@
>                                -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV- 
> Tools -lpthread -lstdc++ -lm; }
>    enabled libgme            && { check_pkg_config libgme libgme gme/gme.h 
> gme_new_emu ||
>                                   require libgme gme/gme.h gme_new_emu -lgme - 
> lstdc++; }
> +@@ -7307,7 +7301,7 @@
> + EOF
> +
> + if enabled proper_dce; then
> +-    echo "X { local: *; };" > $TMPV
> ++    echo "X { global: environ; __progname; local: *; };" > $TMPV
> +     if test_ldflags -Wl,${version_script},$TMPV; then
> +         append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
> +         quotes='""'
> 
> 
> 


-- 
Andriy Gapon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.