Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obs-studio: Add builtin support for browser source #99284

Merged
merged 3 commits into from Nov 12, 2020

Conversation

@Munksgaard
Copy link
Contributor

@Munksgaard Munksgaard commented Oct 1, 2020

Motivation for this change

Bump obs-studio and enable builtin support for browser source.

Since version 25, OBS Studio has shipped with a version of obs-browser that includes linux support (which means that we don't need the obs-linuxbrowser any more). However, previously, we didn't built obs-studio with that support enabled. This PR enables it.

For some reason, I'm getting a patchelf: open: Permission denied at the end of my nix-build -A obs-studio, but I can run the binary manually, and I have confirmed that the browser source is present and working. Does anyone have an idea how I can fix the permission issue?

This PR removes the need for the obs-linuxbrowser package (obs-linuxbrowser has also been archived and discontinued, as detailed here)

Fixes #98035

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@Munksgaard Munksgaard changed the title Bump obs Update obs-studio to 26.0.0 and add builtin support for browser source Oct 1, 2020
@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Oct 1, 2020

Oh damn, I'm late to the party! #99242

I'll update my PR to only add support for the browser source.

@ofborg ofborg bot requested review from puffnfresh, MP2E and jb55 Oct 1, 2020
@Munksgaard Munksgaard changed the title Update obs-studio to 26.0.0 and add builtin support for browser source obs-studio: Add builtin support for browser source Oct 1, 2020
@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Oct 1, 2020

I've updated it now. Should I also remove obs-linuxbrowser, now that it's no longer needed? If so, how do I do that?

@mohe2015
Copy link
Contributor

@mohe2015 mohe2015 commented Oct 2, 2020

@Munksgaard I would assume you would need to remove

obs-linuxbrowser = callPackage ../applications/video/obs-studio/linuxbrowser.nix { };
and https://github.com/NixOS/nixpkgs/blob/84cf00f98031e93f389f1eb93c4a7374a33cc0a9/pkgs/applications/video/obs-studio/linuxbrowser.nix

@mohe2015
Copy link
Contributor

@mohe2015 mohe2015 commented Oct 2, 2020

@Munksgaard
Also I fixed the patchelf thing by using the following patch

diff --git a/pkgs/applications/video/obs-studio/default.nix b/pkgs/applications/video/obs-studio/default.nix
index 35c7ce93c6d..93eecae8d5c 100644
--- a/pkgs/applications/video/obs-studio/default.nix
+++ b/pkgs/applications/video/obs-studio/default.nix
@@ -80,12 +80,13 @@ in mkDerivation rec {
   postUnpack = ''
     mkdir -p cef/Release cef/Resources cef/libcef_dll_wrapper/
     for i in ${libcef}/share/cef/*; do
-      ln -s $i cef/Release/
-      ln -s $i cef/Resources/
+      cp -r $i cef/Release/
+      cp -r $i cef/Resources/
     done
-    ln -s ${libcef}/lib/libcef.so cef/Release/
-    ln -s ${libcef}/lib/libcef_dll_wrapper.a cef/libcef_dll_wrapper/
-    ln -s ${libcef}/include cef/
+    cp -r ${libcef}/lib/libcef.so cef/Release/
+    cp -r ${libcef}/lib/libcef_dll_wrapper.a cef/libcef_dll_wrapper/
+    cp -r ${libcef}/include cef/
+    ls -R cef
   '';
 
   # obs attempts to dlopen libobs-opengl, it fails unless we make sure

I don't know if this is a proper fix but this works. I think the underlying issues is that obs-studio's findCEF.cmake is flawed.

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Oct 2, 2020

Copy link
Contributor

@mohe2015 mohe2015 left a comment

Tested it locally - the changes in #99284 (comment) could still be done in my opinion. I don't think a migration of the package is necessary.

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Oct 3, 2020

Tested it locally - the changes in #99284 (comment) could still be done in my opinion. I don't think a migration of the package is necessary.

Oh yes, I forgot! Fixed that now :)

@mohe2015
Copy link
Contributor

@mohe2015 mohe2015 commented Oct 3, 2020

Not pushed yet? @Munksgaard

Munksgaard added a commit to Munksgaard/nixpkgs that referenced this issue Oct 3, 2020
No longer needed since NixOS#99284
@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Oct 3, 2020

Sorry! Should be done now :)

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Oct 12, 2020

What's needed for this to get merged?

Munksgaard added a commit to Munksgaard/nixpkgs that referenced this issue Oct 30, 2020
No longer needed since NixOS#99284
@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Oct 30, 2020

Rebased on top of current master (to support 26.0.2)

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Nov 1, 2020

Can we get this merged? @mohe2015

Copy link
Contributor

@mohe2015 mohe2015 left a comment

Otherwise it should be good do go.
I don't have merge permissions btw.

cp -r ${libcef}/lib/libcef.so cef/Release/
cp -r ${libcef}/lib/libcef_dll_wrapper.a cef/libcef_dll_wrapper/
cp -r ${libcef}/include cef/
ls -R cef
Copy link
Contributor

@mohe2015 mohe2015 Nov 1, 2020

This line should probably be removed

Copy link
Contributor Author

@Munksgaard Munksgaard Nov 1, 2020

Fixed and rebased

Munksgaard added a commit to Munksgaard/nixpkgs that referenced this issue Nov 1, 2020
No longer needed since NixOS#99284
Copy link
Contributor

@mohe2015 mohe2015 left a comment

This can be merged in my opinion. @Munksgaard Where did you get the version of cef from? Because I couldn't find any recommendation at obs-studio's repository and http://opensource.spotify.com/cefbuilds/index.html#linux64 shows that version 86 would be available. Or is cef also used by other packages? Anyways this would be something for a later pull request.

Copy link
Contributor

@mohe2015 mohe2015 left a comment

I think you broke something. My rebuild took a bit longer because I also rebased to master but I can't find the browser source option. Please check yourself.
Edit: Submodule fetching seems to be broken @Munksgaard

If we're at it you could also change the commit messages according to the contributing guide. I think "libcef: oldversion -> 75.1.14" should be better. See https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md

@@ -44,8 +45,9 @@ in mkDerivation rec {
src = fetchFromGitHub {
owner = "obsproject";
repo = "obs-studio";
rev = version;
rev = "refs/tags/${version}";
sha256 = "1d502f80whh686mvq0yn6zpa5nvmnlzxwp5sjz43vpbbvhpbrdqj";
Copy link
Contributor

@mohe2015 mohe2015 Nov 1, 2020

Suggested change
sha256 = "1d502f80whh686mvq0yn6zpa5nvmnlzxwp5sjz43vpbbvhpbrdqj";
sha256 = "vMrPMuZPeFefpbtQykeWifLBkhkSM47tDPid5cU3xa0=";

something changed the hash and this didn't get attention because we both had the old version in cache probably.

Munksgaard added 3 commits Nov 1, 2020
Update libcef package to 75.1.14

This will allow us to enable browser source in the obs-studio build. It will
also mean that obs-linuxbrowser probably doesn't work, but it's not needed any
longer, so that shouldn't be a problem.
Since version 25, OBS Studio has shipped with a version of obs-browser that
includes linux support (which means that we don't need the obs-linuxbrowser any
more). This commit enables the builtin browser source.

Fixes NixOS#98035

Thanks to @mohe2015 for fixing a patchelf issue I had!
No longer needed since NixOS#99284
@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Nov 1, 2020

This can be merged in my opinion. @Munksgaard Where did you get the version of cef from? Because I couldn't find any recommendation at obs-studio's repository and http://opensource.spotify.com/cefbuilds/index.html#linux64 shows that version 86 would be available. Or is cef also used by other packages? Anyways this would be something for a later pull request.

I took it from the build instructions on the obs-studio wiki: https://github.com/obsproject/obs-studio/wiki/Install-Instructions#linux-build-directions.

Trying to build with cef 86.0.2 causes problems I don't know how to fix:


/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: warning: libdrm.so.2, needed by /build/cef/Release/libcef.so, not found (try using -rpath or -rpath-link)
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: warning: libgbm.so.1, needed by /build/cef/Release/libcef.so, not found (try using -rpath or -rpath-link)
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_get_stride'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_get_handle'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_get_height'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_device_destroy'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_create_device'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_destroy'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_import'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_device_is_format_supported'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `drmPrimeHandleToFD'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_get_device'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_device_get_fd'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_create'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /build/cef/Release/libcef.so: undefined reference to `gbm_bo_get_width'
collect2: error: ld returned 1 exit status
make[2]: *** [plugins/obs-browser/CMakeFiles/obs-browser-page.dir/build.make:150: plugins/obs-browser/obs-browser-page] Error 1
make[1]: *** [CMakeFiles/Makefile2:1381: plugins/obs-browser/CMakeFiles/obs-browser-page.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I've updated the sha now, and it should compile correctly again. Please take a look when you have time @mohe2015

Edit: And thank you, once again, for helping me out!

Copy link
Contributor

@mohe2015 mohe2015 left a comment

LGTM!

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Nov 2, 2020

@puffnfresh How can I push this forward?

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Nov 12, 2020

@MP2E, @jb55, @puffnfresh: You guys were automatically assigned as reviewers on this PR, what can I do to push it forward? Is there someone else I should be nudging instead?

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Nov 12, 2020

@mweinelt, I saw you merged #101710, could you also merge this one, so we don't need to rely on obs-linuxbrowser anymore?

@jb55
Copy link
Contributor

@jb55 jb55 commented Nov 12, 2020

@mweinelt
Copy link
Member

@mweinelt mweinelt commented Nov 12, 2020

Result of nixpkgs-review pr 99284 1

1 package failed to build:
  • obs-ndi
4 packages built:
  • libcef
  • obs-studio
  • obs-v4l2sink
  • obs-wlrobs

@mweinelt mweinelt merged commit a6c7b75 into NixOS:master Nov 12, 2020
19 checks passed
@mweinelt
Copy link
Member

@mweinelt mweinelt commented Nov 12, 2020

Thanks, tested and LGTM.

@Munksgaard
Copy link
Contributor Author

@Munksgaard Munksgaard commented Nov 12, 2020

Thank you @mweinelt :)

@Munksgaard Munksgaard deleted the bump-obs branch Nov 12, 2020
@mweinelt
Copy link
Member

@mweinelt mweinelt commented Nov 12, 2020

Happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants