Bug 258346 - graphics/libdrm: add runtime dependency on pthread-stubs
Summary: graphics/libdrm: add runtime dependency on pthread-stubs
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-x11 (Nobody)
URL:
Keywords: patch
: 258296 258298 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-09-07 18:36 UTC by Jan Beich
Modified: 2021-09-08 15:15 UTC (History)
2 users (show)

See Also:
manu: maintainer-feedback+


Attachments
v1: adjust RUN_DEPENDS (645 bytes, patch)
2021-09-07 18:36 UTC, Jan Beich
no flags Details | Diff
v2: drop pthread-stubs (1.38 KB, patch)
2021-09-07 18:45 UTC, Jan Beich
no flags Details | Diff
v2.1 (apply via "git am") (1.90 KB, patch)
2021-09-08 10:27 UTC, Jan Beich
no flags Details | Diff
v2.2 (apply via "git am") (2.01 KB, patch)
2021-09-08 10:39 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2021-09-07 18:36:27 UTC
Created attachment 227741 [details]
v1: adjust RUN_DEPENDS

$ pkg install libdrm
$ pkg-config libdrm_intel --cflags
Package pthread-stubs was not found in the pkg-config search path.
Perhaps you should add the directory containing `pthread-stubs.pc'
to the PKG_CONFIG_PATH environment variable
Package 'pthread-stubs', required by 'libdrm_intel', not found
Comment 1 Jan Beich freebsd_committer freebsd_triage 2021-09-07 18:45:30 UTC
Created attachment 227742 [details]
v2: drop pthread-stubs

Alternatively, pthread-stubs dependency can be dropped.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2021-09-07 18:54:32 UTC
*** Bug 258296 has been marked as a duplicate of this bug. ***
Comment 3 Jan Beich freebsd_committer freebsd_triage 2021-09-07 18:56:55 UTC
*** Bug 258298 has been marked as a duplicate of this bug. ***
Comment 4 Jan Beich freebsd_committer freebsd_triage 2021-09-07 19:05:10 UTC
.private in .pc files is only used by pkg-config --static but it's nop in libdrm because .a files (static libraries) are not installed.

https://man.freebsd.org/pc/5
Comment 5 Jan Beich freebsd_committer freebsd_triage 2021-09-07 19:07:04 UTC
libdrm_<vendor>.a never existed but libdrm.a did until ports d423519fdb82.
Comment 6 Evgenii Khramtsov 2021-09-07 20:00:40 UTC
I confirm, both v1 and v2 fix PR 258296.
Comment 7 Emmanuel Vadot freebsd_committer freebsd_triage 2021-09-08 09:03:32 UTC
v2 looks ok.
Even without the libpthread-stubs dep a -lpthread is added so no need to depends on this package.
Can you open an MR upstream please ?
Comment 8 Jan Beich freebsd_committer freebsd_triage 2021-09-08 10:12:44 UTC
(In reply to Emmanuel Vadot from comment #7)
> Can you open an MR upstream please ?

https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/193

Here's a list of consumers where pthread-stubs dependency leaked to. Often non-issue due to bootlegging pthread-stubs via x11/libxcb.

$ pkg rquery %o\ %B | awk '/libdrm_/ { print $1 }' | sort -u
graphics/intel-backlight
graphics/mesa-devel
graphics/mesa-dri
graphics/mesa-gallium-va
graphics/mesa-gallium-vdpau
graphics/piglit
lang/clover
multimedia/cmrt
multimedia/intel-media-sdk
multimedia/libva-intel-driver
multimedia/libva-intel-hybrid-driver
sysutils/radeontop
x11-drivers/xf86-video-amdgpu
x11-drivers/xf86-video-ati
x11-drivers/xf86-video-intel
Comment 9 Jan Beich freebsd_committer freebsd_triage 2021-09-08 10:27:38 UTC
Created attachment 227755 [details]
v2.1 (apply via "git am")

- Replace with the version submitted upstream (larger due to cleanup)
- Drop ports 1c02555442ed leftover per https://gitlab.freedesktop.org/mesa/drm/-/commit/90c9175c8197
Comment 10 Jan Beich freebsd_committer freebsd_triage 2021-09-08 10:39:55 UTC
Created attachment 227756 [details]
v2.2 (apply via "git am")

v2 -> v2.1 accidentally lost BUILD_DEPENDS removal as I rewrote the patch from scratch.
Comment 11 Jan Beich freebsd_committer freebsd_triage 2021-09-08 10:56:12 UTC
(In reply to Jan Beich from comment #9)
> - Drop ports 1c02555442ed leftover per https://gitlab.freedesktop.org/mesa/drm/-/commit/90c9175c8197

I've split this into a separate commit locally but propagating to Bugzilla is PITA (Phabricator is no better, requiring tons of scripts just for basic workflow).
Comment 12 Jan Beich freebsd_committer freebsd_triage 2021-09-08 11:08:43 UTC
And the cleanup is only necessary because manu@ made a style mistake (let's ignore variable order which was also wrong) a year ago using his fork in PATCH_SITES instead of upstream which now conflicts with the fix here as it needs different fork. GitLab unlike GitHub only allows referencing hashes from forks when part of a merge-request. For example, https://gitlab.freedesktop.org/manu/drm/-/commit/9ef84bbc6269 doesn't exist because it wasn't submitted to manu's fork but rather to its upstream.
Comment 13 Jan Beich freebsd_committer freebsd_triage 2021-09-08 13:53:06 UTC
Do I need another approval for v2.2 or comment 7 covers it? Ideally, it should land before 01:00 UTC today to avoid annoying "poudriere bulk -b <branch>" users after harfbuzz update obsoleted some heavy dependencies only to be obseleted again by libdrm update.
Comment 14 Emmanuel Vadot freebsd_committer freebsd_triage 2021-09-08 14:38:11 UTC
Go for it.
Comment 15 commit-hook freebsd_committer freebsd_triage 2021-09-08 15:13:52 UTC
A commit in branch main references this bug:

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

commit 1a01638104b4a6f4b72483d00ce817bb2a64c7a9
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-09-07 18:45:30 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-09-08 15:11:37 +0000

    graphics/libdrm: drop dependency on pthread-stubs

    Avoid empty private library (only passes -pthread) leaking into consumers.

    PR:             258346
    Tested by:      Evgeniy Khramtsov
    Approved by:    manu

 graphics/libdrm/Makefile | 5 ++++-
 graphics/libdrm/distinfo | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
Comment 16 commit-hook freebsd_committer freebsd_triage 2021-09-08 15:13:53 UTC
A commit in branch main references this bug:

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

commit 7c2f9e20523fe097d644c9d11547df7811abaa61
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-09-08 10:50:59 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-09-08 15:11:37 +0000

    graphics/libdrm: drop upstreamed patch after 1c02555442ed

    https://gitlab.freedesktop.org/mesa/drm/-/commit/90c9175c8197

    PR:             258346
    Approved by:    manu

 graphics/libdrm/Makefile | 3 ---
 graphics/libdrm/distinfo | 2 --
 2 files changed, 5 deletions(-)