Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 922163 - media-video/obs-studio - browser useflag fail to compile with LLVM profile with or without LTO (even fallback to gcc)
Summary: media-video/obs-studio - browser useflag fail to compile with LLVM profile wi...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chiitoo
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-15 11:18 UTC by Gonçalo Negrier Duarte
Modified: 2024-03-23 20:19 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
gcc-full-lto env file (gcc-full.conf,216 bytes, text/plain)
2024-01-15 11:18 UTC, Gonçalo Negrier Duarte
Details
gcc-full env file (gcc-full.conf,210 bytes, text/plain)
2024-01-15 11:21 UTC, Gonçalo Negrier Duarte
Details
1-clang-lto.log (build-obs-clang-lto.log,364.90 KB, text/x-log)
2024-01-15 12:09 UTC, Gonçalo Negrier Duarte
Details
2-clang_no_lto.log (build-obs-clang.log,355.01 KB, text/x-log)
2024-01-15 12:11 UTC, Gonçalo Negrier Duarte
Details
gcc-lto env file (gcc-lto.conf,188 bytes, text/plain)
2024-01-15 12:15 UTC, Gonçalo Negrier Duarte
Details
gcc env fle (gcc.conf,182 bytes, text/plain)
2024-01-15 12:16 UTC, Gonçalo Negrier Duarte
Details
1-clang-lto.log (build-obs-clang-lto.log,364.90 KB, text/x-log)
2024-01-15 12:26 UTC, Gonçalo Negrier Duarte
Details
2-clang_no_lto.log (build-obs-clang.log,355.01 KB, text/x-log)
2024-01-15 12:26 UTC, Gonçalo Negrier Duarte
Details
3-gcc_full_lto.log (build-obs-gcc-full-lto.log,714.28 KB, text/x-log)
2024-01-15 12:27 UTC, Gonçalo Negrier Duarte
Details
3-gcc_full.log (build-obs-gcc-full.log,708.71 KB, text/x-log)
2024-01-15 12:27 UTC, Gonçalo Negrier Duarte
Details
5-gcc_lto.log (build-obs-studio-gcc-compiler.log,708.71 KB, text/x-log)
2024-01-15 12:27 UTC, Gonçalo Negrier Duarte
Details
6-gcc_full.log (build-obs-studio-gcc-compiler.log,708.71 KB, text/x-log)
2024-01-15 12:28 UTC, Gonçalo Negrier Duarte
Details
emerge_info.log (emerge_info.log,20.30 KB, text/x-log)
2024-01-15 12:29 UTC, Gonçalo Negrier Duarte
Details
obs-studio-30.0.2.ebuild (obs-studio-30.0.2.ebuild,7.08 KB, application/vnd.gentoo.ebuild)
2024-02-22 20:43 UTC, David Carlos Manuelda
Details
clang-update-deprecated-builtins.patch (clang-update-deprecated-builtins.patch,420 bytes, patch)
2024-02-22 20:44 UTC, David Carlos Manuelda
Details | Diff
obs-studio-30.1.0.ebuild (obs-studio-30.1.0.ebuild,7.06 KB, application/vnd.gentoo.ebuild)
2024-03-23 20:19 UTC, David Carlos Manuelda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gonçalo Negrier Duarte 2024-01-15 11:18:50 UTC
Created attachment 882324 [details]
gcc-full-lto env file

I having problem compiling obs-studio since I change to the LLVM profile I gonna add in the attchments build log for:
1-Clang with lto
2-Clang without lto
3-Gcc (full toolchain) with lto
4-Gcc (full toolchain) without lto
Comment 1 Gonçalo Negrier Duarte 2024-01-15 11:20:36 UTC
(In reply to Gonçalo Negrier Duarte from comment #0)
> Created attachment 882324 [details]
> gcc-full-lto env file
> 
> I having problem compiling obs-studio since I change to the LLVM profile I
> gonna add in the attchments build log for:
> 1-Clang with lto
> 2-Clang without lto
> 3-Gcc (full toolchain) with lto
> 4-Gcc (full toolchain) without lto
Comment 2 Gonçalo Negrier Duarte 2024-01-15 11:21:00 UTC
Created attachment 882325 [details]
gcc-full env file
Comment 3 Gonçalo Negrier Duarte 2024-01-15 12:09:40 UTC
Created attachment 882327 [details]
1-clang-lto.log
Comment 4 Gonçalo Negrier Duarte 2024-01-15 12:11:40 UTC
Created attachment 882328 [details]
2-clang_no_lto.log
Comment 5 Gonçalo Negrier Duarte 2024-01-15 12:14:19 UTC
(In reply to Gonçalo Negrier Duarte from comment #0)
> Created attachment 882324 [details]
> gcc-full-lto env file
> 
> I having problem compiling obs-studio since I change to the LLVM profile I
> gonna add in the attchments build log for:
> 1-Clang with lto
> 2-Clang without lto
> 3-Gcc (full toolchain) with lto
> 4-Gcc (full toolchain) without lto

Also gonna add:
5-Gcc (only compiler) with lto
5-Gcc (only compiler) without lto
Comment 6 Gonçalo Negrier Duarte 2024-01-15 12:15:41 UTC
Created attachment 882330 [details]
gcc-lto env file
Comment 7 Gonçalo Negrier Duarte 2024-01-15 12:16:03 UTC
Created attachment 882331 [details]
gcc env fle
Comment 8 Gonçalo Negrier Duarte 2024-01-15 12:26:31 UTC
Created attachment 882333 [details]
1-clang-lto.log
Comment 9 Gonçalo Negrier Duarte 2024-01-15 12:26:46 UTC
Created attachment 882334 [details]
2-clang_no_lto.log
Comment 10 Gonçalo Negrier Duarte 2024-01-15 12:27:16 UTC
Created attachment 882335 [details]
3-gcc_full_lto.log
Comment 11 Gonçalo Negrier Duarte 2024-01-15 12:27:30 UTC
Created attachment 882336 [details]
3-gcc_full.log
Comment 12 Gonçalo Negrier Duarte 2024-01-15 12:27:56 UTC
Created attachment 882337 [details]
5-gcc_lto.log
Comment 13 Gonçalo Negrier Duarte 2024-01-15 12:28:14 UTC
Created attachment 882338 [details]
6-gcc_full.log
Comment 14 Gonçalo Negrier Duarte 2024-01-15 12:29:00 UTC
Created attachment 882339 [details]
emerge_info.log
Comment 15 Gonçalo Negrier Duarte 2024-01-15 12:29:25 UTC
Ok posted all log files including emerge --info
Comment 16 David Carlos Manuelda 2024-02-22 03:50:57 UTC
I can reproduce this issue on an LLVM profile and add more information:

This build failure seem to only happen with "browser" use flag, disabling it makes obs-studio compile again.

In my case, I successfully built it with media-video/obs-studio-30.0.2::gentoo  USE="alsa fdk nvenc pipewire pulseaudio python ssl truetype v4l websocket -browser -decklink -jack -lua (-mpegts) -qsv -speex -test -vlc -wayland" LUA_SINGLE_TARGET="luajit" PYTHON_SINGLE_TARGET="python3_11 -python3_10 -python3_12"

Perhaps masking this use flag for the moment on LLVM profile?
Comment 17 David Carlos Manuelda 2024-02-22 04:17:51 UTC
More info:

The bug happens because when using browser use flag the file cef_binary_5060_linux_x86_64_v3.tar.xz is extracted and it has precompiled libraries and a CMake system to compile against them.

The problem is that it hardcodes CMAKE_CXX_* compiler variables to gcc ones (/usr/bin/c++, /usr/bin/ar, etc).

Then, when trying to build obs-studio a mixture between c++/clang++ and between libstdc++ and libc++ happens, leading to these compiler errors.

With current build system, it is not possible to support LLVM profile without

a) Providing another precompiled cef_binary_5060_linux_x86_64_v3.tar.xz with clang/LLVM instead
b) Deleting build directory and make it build along obs-studio without any precompiled stuff

I would prefer b) but it seems also a thing of upstream so I think masking the use flag for LLVM profile is a better aproach to avoid compiler errors.
Comment 18 Gonçalo Negrier Duarte 2024-02-22 16:00:21 UTC
Yes I also tried yesterday with the browser useflag.

And it seems its the CEF Wrapper provided by OBS. 

I don't know if OBS will allow to make CEF wrapper being compiled since they only accept changes that not break there flatpack build system.

I could try to make it work in the ebuild but I dont know if that can break in the future
Comment 19 Gonçalo Negrier Duarte 2024-02-22 16:11:24 UTC
I looking at the build instruction is a pain to build this.
It allow to create a ebuild that build cef and saves the binary on the system to use with the obs package.

Or gentoo could start provided a distfile build for the llvm profile, but I dont know if that is a option.
Comment 20 David Carlos Manuelda 2024-02-22 16:47:26 UTC
It is even a more complicated because it does not even build with CLang without patching.

I'd also suggest moving it to a separate package because it has its own build system and it would be a better approach than to build both projects in same ebuild
Comment 21 David Carlos Manuelda 2024-02-22 20:43:49 UTC
Created attachment 885756 [details]
obs-studio-30.0.2.ebuild

I've modified the ebuild to discard CEF binary build and build it before configure phase so it is available without problems for current build system.
Comment 22 David Carlos Manuelda 2024-02-22 20:44:34 UTC
Created attachment 885757 [details, diff]
clang-update-deprecated-builtins.patch

Patch needed for CEF to be compiled with a CLang compiler.
Comment 23 Gonçalo Negrier Duarte 2024-02-22 22:24:25 UTC
The build can be made only with cmake, because I was seeing this and was quite complex:
https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart
Comment 24 David Carlos Manuelda 2024-02-23 03:19:51 UTC
(In reply to Gonçalo Negrier Duarte from comment #23)
> The build can be made only with cmake, because I was seeing this and was
> quite complex:
> https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart

In fact the ebuild uses cmake to build both: CEF first and OBS later
Comment 25 Gonçalo Negrier Duarte 2024-02-23 16:57:04 UTC
Ok I gonna try your ebuild to see if works on my machine, because I kinda need the obs browser plugin
Comment 26 Gonçalo Negrier Duarte 2024-02-23 17:19:01 UTC
Can confirm is working I think you can try make a PR to gentoo
Comment 27 Chiitoo gentoo-dev 2024-03-07 18:14:58 UTC
Thank you for all the testing and such!

I'll try to have a better look at this soon, but indeed, it would probably be best if it could be its own package, preferably with a dedicated maintainer since I don't have the time and/or energy to take up more work at this time (I'm generally not even using USE="browser" at all myself).

I wonder if the clang patch could be upstreamed?
Comment 28 Gonçalo Negrier Duarte 2024-03-07 18:48:30 UTC
Ok I gonna give a look of I can do a separate ebuild for it and add as dependency to obs, I some times use the browser useflag.
Comment 29 David Carlos Manuelda 2024-03-07 19:03:58 UTC
(In reply to Chiitoo from comment #27)
> Thank you for all the testing and such!
> 
> I'll try to have a better look at this soon, but indeed, it would probably
> be best if it could be its own package, preferably with a dedicated
> maintainer since I don't have the time and/or energy to take up more work at
> this time (I'm generally not even using USE="browser" at all myself).
> 
> I wonder if the clang patch could be upstreamed?

I wouldn't recommend to have it as a separated package because:

1) It is a static library only used (in portage) by obs
2) There are hardcoded paths in Findxxx.cmake script like looking specifically at a folder called $PATH/build so even if a separate package installs the .a library it will need to install it in $LIBDIR/xxx/build or patch the obs build system to indicate just given path (and maintain it)
Comment 30 Gonçalo Negrier Duarte 2024-03-07 19:09:15 UTC
Well if only obs needed is better to just use only on obs tho.
David you can try do a PR and then we see what can be improved.
Comment 31 Gonçalo Negrier Duarte 2024-03-07 19:09:58 UTC
*just use it on obs ebuild
Comment 32 Chiitoo gentoo-dev 2024-03-07 19:51:55 UTC
(In reply to David Carlos Manuelda from comment #29)
> I wouldn't recommend to have it as a separated package because:
> 
> 1) It is a static library only used (in portage) by obs
> 2) There are hardcoded paths in Findxxx.cmake script like looking
> specifically at a folder called $PATH/build so even if a separate package
> installs the .a library it will need to install it in $LIBDIR/xxx/build or
> patch the obs build system to indicate just given path (and maintain it)

Well there are things like 'media-video/obs-v4l2sink' too, though that one might not actually be relevant any longer.

Point being it's perhaps not an unusual things to do something like that.

But yeah, I will ponder upon it in any case.
Comment 33 David Carlos Manuelda 2024-03-23 20:19:57 UTC
Created attachment 888334 [details]
obs-studio-30.1.0.ebuild

While it is being fixed I provide updated ebuild for version 30.1.0 in case someone needs it beforehand