Bug 276469 - multimedia/ffmpeg4: build error with GLSLANG option set
Summary: multimedia/ffmpeg4: build error with GLSLANG option set
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-multimedia (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-20 05:49 UTC by Ale
Modified: 2024-02-01 04:31 UTC (History)
3 users (show)

See Also:
jbeich: merge-quarterly+


Attachments
Fix compilation failure for ffmpeg4 on LLVM17 (249 bytes, text/plain)
2024-01-31 16:45 UTC, Travis Hunter
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ale 2024-01-20 05:49:31 UTC
After the PORTREVISION bump due to "multimedia/libvpx: update 1.14.0" (589aaaeb09b7daeb6a2053a684f5056d9fcfed0e) I'm facing an error while building multimedia/ffmpeg4 with GLSLANG option set:

libavfilter/glslang.cpp:164:5: error: use of undeclared identifier 'assert'
  164 |     assert(glslang_refcount);
      |     ^
2 warnings and 1 error generated.
gmake[2]: *** [ffbuild/common.mak:70: libavfilter/glslang.o] Error 1

Adding
    #include <assert.h>
in libavfilter/glslang.cpp fixed the build, but I'm not sure that is correct.


The ports has been previously built (from updated ports) on 31st Dec. 2023 with success and the only change is the PORTREVISION bump 9=>10.

If that could be of interest, in the meanwhile...
- graphics/glslang has been updated (twice, on 4th Jan. 2024)
- I updated my box tracking stable/13 on 8th Jan. 2024, so llvm project in base has been upgraded from version 16 to 17
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-20 11:54:18 UTC
Same on 13.2-p9 amd64 with latest graphics/glslang from ports.
If I find time, I'll test with previous versions of graphics/glslang.
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-21 11:08:21 UTC
Commit log for graphics/glslang is here: https://cgit.freebsd.org/ports/log/graphics/glslang

Test result (build multimedia/ffmpeg4 with different version of the graphics/glslang):
13.0.0 build fine.
13.1.0 configure fails: can't find libglslang.
14.0.0 build fails: use of undeclared identifier 'assert'.
Comment 3 Travis Hunter 2024-01-31 16:45:34 UTC
Created attachment 248092 [details]
Fix compilation failure for ffmpeg4 on LLVM17

After upgrading the compiler toolchain to LLVM17, some header files changed. Somehow assert.h doesn't find its way into glslang.cpp anymore, whereas previously it did.

This patch will get it to build again. This probably should go upstream as well, but is ffmpeg4 maintained anymore?

See attached patch
Comment 4 Travis Hunter 2024-01-31 16:51:38 UTC
(In reply to Ale from comment #0)

I think it is the solution (though it really ought to be merged upstream, if they'll accept it). It should have no effect on previous compilers since it was already included implicitly, but now that some system headers have changed it no longer is. It needs to be included explicitly. 

For now I did the same, and created a patch against it that I attached.
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-31 19:01:07 UTC
Build fine on live system 13.2 with this patch, but fails in poudriere…
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-31 19:40:44 UTC
This is incorrect:
VULKAN_IMPLIES=        GLSLANG
This is correct:
GLSLANG_IMPLIES=        VULKAN

Build without errors after this change + attached patch and with option GLSLANG.
Comment 7 commit-hook freebsd_committer freebsd_triage 2024-02-01 04:14:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4fae7617b7396542c4436eddbbf65c52f825c516

commit 4fae7617b7396542c4436eddbbf65c52f825c516
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-02-01 03:40:26 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-02-01 04:13:44 +0000

    multimedia/ffmpeg: swap _IMPLIES for VULKAN and GLSLANG

    - Vulkan Video doesn't need either glslang or shaderc
    - For consistency with graphics/libplacebo

    PR:             276469
    Suggested by:   vvd

 multimedia/ffmpeg/Makefile  | 5 +++--
 multimedia/ffmpeg4/Makefile | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2024-02-01 04:14:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d5183fa79df24e0716ab928298d161804e8530de

commit d5183fa79df24e0716ab928298d161804e8530de
Author:     Travis Hunter <cth-freebsd@pm.me>
AuthorDate: 2024-01-31 16:45:34 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-02-01 04:13:42 +0000

    multimedia/ffmpeg4: unbreak GLSLANG=on build after d35ea7b74f4a

    libavfilter/glslang.cpp:164:5: error: use of undeclared identifier 'assert'
        assert(glslang_refcount);
        ^

    PR:             276469
    Tested by:      vvd
    Regressed by:   https://github.com/KhronosGroup/glslang/commit/6f9ab3c2deb6
    See also:       https://github.com/ffmpeg/ffmpeg/commit/246f841b53e1

 multimedia/ffmpeg4/files/patch-libavfilter_glslang.cpp (new) | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 9 commit-hook freebsd_committer freebsd_triage 2024-02-01 04:15:44 UTC
A commit in branch 2024Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6e5fbe03627457232a9e6de9f52eddae1f715ebf

commit 6e5fbe03627457232a9e6de9f52eddae1f715ebf
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-02-01 03:40:26 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-02-01 04:15:19 +0000

    multimedia/ffmpeg: swap _IMPLIES for VULKAN and GLSLANG

    - Vulkan Video doesn't need either glslang or shaderc
    - For consistency with graphics/libplacebo

    PR:             276469
    Suggested by:   vvd

    (cherry picked from commit 4fae7617b7396542c4436eddbbf65c52f825c516)

 multimedia/ffmpeg/Makefile  | 5 +++--
 multimedia/ffmpeg4/Makefile | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2024-02-01 04:15:45 UTC
A commit in branch 2024Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f403d78e327f3c57255e25a7243ecc3493427812

commit f403d78e327f3c57255e25a7243ecc3493427812
Author:     Travis Hunter <cth-freebsd@pm.me>
AuthorDate: 2024-01-31 16:45:34 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-02-01 04:15:19 +0000

    multimedia/ffmpeg4: unbreak GLSLANG=on build after d35ea7b74f4a

    libavfilter/glslang.cpp:164:5: error: use of undeclared identifier 'assert'
        assert(glslang_refcount);
        ^

    PR:             276469
    Tested by:      vvd
    Regressed by:   https://github.com/KhronosGroup/glslang/commit/6f9ab3c2deb6
    See also:       https://github.com/ffmpeg/ffmpeg/commit/246f841b53e1

    (cherry picked from commit d5183fa79df24e0716ab928298d161804e8530de)

 multimedia/ffmpeg4/files/patch-libavfilter_glslang.cpp (new) | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 11 Jan Beich freebsd_committer freebsd_triage 2024-02-01 04:31:36 UTC
Thanks. Landed.

VULKAN is disabled by default in ffmpeg4 unlike ffmpeg >= 6 due to missing many features, fewer filters, no libplacebo support and inadequate runtime QA. See bug 275360 for an easy way to test compared to crafting long CLI lines when using filters.

(In reply to Travis Hunter from comment #3)
> This probably should go upstream as well, but is ffmpeg4 maintained anymore?

Probably maintained due to being offered in https://ffmpeg.org/download.html#release_4.4 unlike https://ffmpeg.org/olddownload.html Looking at https://github.com/ffmpeg/ffmpeg/commits/release/4.4 it mainly contains cherry-picks or security-related fixes.