https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: media-video/obs-studio-31.0.0 fails to compile. Discovered on: amd64 (internal ref: ci) Info about the issue: https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#CF0014
Created attachment 913522 [details] build.log build log and emerge --info
Error(s) that match a know pattern in addition to what has been reported in the summary: FAILED: plugins/obs-ffmpeg/ffmpeg-mux/obs-ffmpeg-mux FAILED: plugins/obs-x264/obs-x264-test /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: libobs/libobs.so.30: undefined reference to `XCloseDisplay' /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: libobs/libobs.so.30: undefined reference to `XDefaultScreen' /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: libobs/libobs.so.30: undefined reference to `XLookupString' /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: libobs/libobs.so.30: undefined reference to `XOpenDisplay' collect2: error: ld returned 1 exit status
Same exact issue here. My initial assumption was that the issue was me using FFMpeg 7 or that I have USE="-X" set where possible (Wayland desktop) but apparently not.
ci has reproduced this issue with version 31.0.0-r1 - Updating summary.
(In reply to Avraham Hollander from comment #3) > Same exact issue here. My initial assumption was that the issue was me using > FFMpeg 7 or that I have USE="-X" set where possible (Wayland desktop) but > apparently not. Do you also have 'media-video/ffmpeg[-opengl]'? I can re-produce this if I remove 'x11-libs/libX11' forcibly, build 'media-video/ffmpeg' with USE="-X -opengl", then build 'media-video/obs-studio'. Even though 'media-video/obs-studio' will pull in 'x11-libs/libX11' again, 'libavutil.so.58' is not linked to it, hence the failure. Looks like there might be some issues with the 'media-video/ffmpeg' ebuild, automagically linking with 'x11-libs/libX11' if it's installed, even with USE="-X" and if 'x11-libs/libX11' is not installed but USE="opengl" it will result into ERROR: opengl not found. but I'll need to have a closer look to be sure.
(In reply to Chiitoo from comment #5) > (In reply to Avraham Hollander from comment #3) > > Same exact issue here. My initial assumption was that the issue was me using > > FFMpeg 7 or that I have USE="-X" set where possible (Wayland desktop) but > > apparently not. > > Do you also have 'media-video/ffmpeg[-opengl]'? > > I can re-produce this if I remove 'x11-libs/libX11' forcibly, build > 'media-video/ffmpeg' with USE="-X -opengl", then build > 'media-video/obs-studio'. > > Even though 'media-video/obs-studio' will pull in 'x11-libs/libX11' again, > 'libavutil.so.58' is not linked to it, hence the failure. > > Looks like there might be some issues with the 'media-video/ffmpeg' ebuild, > automagically linking with 'x11-libs/libX11' if it's installed, even with > USE="-X" and if 'x11-libs/libX11' is not installed but USE="opengl" it will > result into > > ERROR: opengl not found. > > but I'll need to have a closer look to be sure. I do indeed. Enabling it didn't make a difference though. Neither did enabling X.
*** Bug 946670 has been marked as a duplicate of this bug. ***
(In reply to Avraham Hollander from comment #6) > I do indeed. Enabling it didn't make a difference though. Neither did > enabling X. Hm, yeah, 'opengl' isn't required per se, I think, it's just that I couldn't build 'ffmpeg' with USE="-X opengl" (if I removed 'libX11' first there's that possible automagic). Whether or not I enable 'X' and recompile 'ffmpeg' with 'libX11' installed, the issue goes away (that automagic), and I see 'libX11.so.6' again in, for example, 'lddtree /usr/lib64/libavutil.so.58'. That said, if you enabled 'X', then 'ffmpeg' would have been rebuilt with 'libX11' installed, and I might imagine 'libX11' is pulled in by a lot of other packages as well, even on as much Wayland-only as possible, so maybe there is something else to it though I re-produce the exact same errors the way I tried.
Created attachment 914614 [details] /var/tmp/portage/media-video/obs-studio-31.0.0-r1/temp/build.log
Created attachment 914615 [details] emerge -pqv '=media-video/obs-studio-31.0.0-r1::gentoo'
Created attachment 914616 [details] emerge -pqv '=media-video/obs-studio-31.0.0-r1::gentoo'
Looks like before the upstream CMake changes, 'libobs' was directly linked to 'libX11', but now, at least for me, only via 'libavutil'... perhaps by luck. I still don't know why that does not happen elsewhere aside from the CI example here, where 'x11-libs/libX11' was installed /after/ 'media-video/ffmpeg', and in which case depending on 'ffmpeg[X]' would be a solution... though I definitely don't know if that is actually needed by OBS Studio functionally. In any case, I suppose this may be by upstream design, but someone who is seeing the issue could probably at least try something like --- libobs/cmake/os-linux.cmake +++ libobs/cmake/os-linux.cmake @@ -47,6 +47,7 @@ target_link_libraries( libobs PRIVATE + X11::X11 X11::x11-xcb xcb::xcb LibUUID::LibUUID
Looks like the automagic I'm seeing comes from USE="vdpau" (thanks to a hint by e-mail correspondent who had looked into ffmpeg more than I), probably from here: https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/configure#l7381 I've now tested building ffmpeg with USE="-X -opengl -vdpau" and verified I see no 'libX11.so' in 'lddtree /usr/lib64/libavutil.so.58', then added the 'X11::X11' link to 'libobs' and everything seems to be fine. I suppose I'll take it to upstream and see what they think.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06f179962d70c06c3df26d562b16fbdae19c2215 commit 06f179962d70c06c3df26d562b16fbdae19c2215 Author: Jimi Huotari <chiitoo@gentoo.org> AuthorDate: 2024-12-30 17:31:13 +0000 Commit: Jimi Huotari <chiitoo@gentoo.org> CommitDate: 2024-12-30 17:37:49 +0000 media-video/obs-studio: fix libX11 linking Closes: https://bugs.gentoo.org/946057 Signed-off-by: Jimi Huotari <chiitoo@gentoo.org> .../files/obs-studio-31.0.0-libx11-link.patch | 28 +++ media-video/obs-studio/obs-studio-31.0.0-r2.ebuild | 277 +++++++++++++++++++++ 2 files changed, 305 insertions(+)