Bug 267100

Summary: graphics/gstreamer1-plugins-gl: fails to build if graphics/libdrm is installed
Product: Ports & Packages Reporter: rkoberman
Component: Individual Port(s)Assignee: Thomas Zander <riggs>
Status: Closed FIXED    
Severity: Affects Some People CC: alex.volegov, bryan, fullermd, jcfyecrayz, jjb-b, joel, maksim.e.kozlov, michal.zielonka.8001, pa, peo, ps.ports, rhurlin, riggs, rozhuk.im, russo, vvd
Priority: --- Keywords: regression
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267132
Bug Depends on:    
Bug Blocks: 261585    
Attachments:
Description Flags
Guard against masked token in gst-libs/gst/allocators/meson.build
none
Guard against masked token in gst-libs/gst/allocators/meson.build
none
Guard against masked token in gst-libs/gst/allocators/meson.build none

Description rkoberman 2022-10-15 18:53:00 UTC
graphics/gstreamer1-plugins-gl fails to configure.

Has header "libdrm/drm_fourcc.h" : YES 

gst-libs/gst/gl/meson.build:558:6: ERROR: Unknown variable "allocators_dep".

This is on CURRENT on an Alder Lake system that lacks DRM support and is running scfb.
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2022-10-16 04:45:40 UTC
Same on 2 hosts with 13.1-p2 amd64: 1st with x11/nvidia-driver-390 and 2nd with x11/nvidia-driver-340.
Comment 2 John Hein 2022-10-17 11:46:36 UTC
This patch was added:

% cat /usr/ports/multimedia//gstreamer1-plugins/files/patch-gst-libs_gst_allocators_meson.build
--- gst-libs/gst/allocators/meson.build.orig    2022-09-06 20:56:00 UTC
+++ gst-libs/gst/allocators/meson.build
@@ -1,3 +1,4 @@
+if get_option('allocators').enabled()
 gst_allocators_headers = files([
   'allocators.h',
   'allocators-prelude.h',
@@ -58,3 +59,4 @@ allocators_dep = declare_dependency(link_with: gstallo
   sources : allocators_gen_sources)

 meson.override_dependency('gstreamer-allocators-1.0', allocators_dep)
+endif


So, unless 'allocators' is explicitly enabled, allocators_dep is not defined.  

It's not clear from the commit or review why that is there (committer, maintainter CC'd for comment).

But if you remove that patch, gstreamer1-plugins-gl gets past 'configure' when libdrm is installed.

Because the intent of the patch is not documented, I don't know what to test for breakage if the patch is removed.  It may be something that fails to build, or it could cause some run-time problem, or maybe the patch should just not be there at all and everything works fine without it.  An answer from the patch author would be helpful here.


By the way, the reason this only shows up when libdrm is installed is from this meson.build snippet in work/gst-plugins-base-1.20.3/gts-libs/gl/meson.build:

if egl_dep.found() and cc.has_header('libdrm/drm_fourcc.h')
  optional_deps += allocators_dep
endif
Comment 3 John Hein 2022-10-17 11:59:04 UTC
Passing -Dallocators=enabled to meson is an option (to get past the configure failure instead of deleting the patch) as well.

Before deciding how to proceed with a fix for this bug, it would be good to understand why the option to disable allocators was added.
Comment 4 Bryan Baldwin 2022-10-25 04:06:37 UTC
Created attachment 237598 [details]
Guard against masked token in gst-libs/gst/allocators/meson.build
Comment 5 Bryan Baldwin 2022-10-25 04:08:41 UTC
Created attachment 237599 [details]
Guard against masked token in gst-libs/gst/allocators/meson.build

If we are guarding the entire file here --> gst-libs/gst/allocators/meson.build
with

if get_option('allocators').enabled()

then the token `allocators_dep` remains undefined.
Should we not then guard the other calls to this token, as well?

See patches submitted:

patch-ext_gl_meson.build
patch-gst-libs_gst_gl_meson.build
Comment 6 Bryan Baldwin 2022-10-25 04:10:29 UTC
Created attachment 237600 [details]
Guard against masked token in gst-libs/gst/allocators/meson.build
Comment 7 Joel Rodriguez 2022-11-01 16:56:59 UTC
Running FreeBSD 12.3-RELEASE-p6 GENERIC

Will this issue be resolved soon? This issue is holding up all downstream dependencies.

Thanks
Joel
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-11-01 23:25:17 UTC
A commit in branch main references this bug:

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

commit 040e9e09916bc42675bb0d3aa94fee4787bb15c3
Author:     Thomas Zander <riggs@FreeBSD.org>
AuthorDate: 2022-11-01 22:36:11 +0000
Commit:     Thomas Zander <riggs@FreeBSD.org>
CommitDate: 2022-11-01 23:24:41 +0000

    multimedia/gstreamer1-plugins: Fix build in the presence of libdrm

    PR:             267100
    Reported by:    rkoberman@gmail.com

 .../files/patch-ext_gl_meson.build                 | 15 ++++++++++--
 .../files/patch-gst-libs_gst_gl_meson.build        | 28 +++++++++++++++-------
 2 files changed, 33 insertions(+), 10 deletions(-)
Comment 9 Thomas Zander freebsd_committer freebsd_triage 2022-11-01 23:32:45 UTC
https://cgit.freebsd.org/ports/commit/?id=040e9e09916bc42675bb0d3aa94fee4787bb15c3 should build the port without the allocator dependency despite the presence of libdrm, producing a plugin like from the package build in a clean environment.

We can reopen this bug if it still does not work after this change.