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

CI: Add capability for native Apple Silicon and Universal binary builds #5155

Merged
merged 11 commits into from
Mar 17, 2022

Conversation

PatTheMav
Copy link
Member

@PatTheMav PatTheMav commented Aug 18, 2021

Description

Adds the necessary changes to build OBS on macOS for x86_64, arm64, and universal binary builds. Heavy lifting is done by cmake itself (via the CMAKE_OSX_ARCHITECTURES flag) which allows compilation for single or dual architectures.

Notes:

  • This PR requires all the work done in the cmake overhaul PR, which is why its commits/changes are included here. Once that PR is merged, the rebase will make those additional changes disappear
  • For the time being this doesn't work with browser source enabled (which it is by default) as we don't have a native patched CEF build for arm64 available
  • That said, with browser source functionality disabled, this will compile a fully native Apple Silicon build
  • This PR uses the recently updated obs-deps version that contains universal libraries
  • Dependencies are not expanded to /tmp anymore but instead in the obs-build-dependencies directory used by all other build dependencies. This avoids the issue of obs-deps disappearing at reboot (as macOS empties /tmp) and also makes use of the new obs-deps not using absolute path IDs in signature anymore

Motivation and Context

  • Future-proof OBS for Apple Silicon machines
  • Proper multi-arch handling for macOS
  • Dependency cleanup

How Has This Been Tested?

  • Universal, x86_64, and arm64 builds created on x64_host
  • Builds running on their native archs
  • Universal builds running on both archs with their native runtimes
  • Further tests pending

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@WizardCM WizardCM added Enhancement Improvement to existing functionality Code Cleanup Non-breaking change which makes code smaller or more readable labels Aug 18, 2021
@PatTheMav
Copy link
Member Author

@GeorgesStavracas Can you make sense of this? The Flatpak step complains:

Build failed: Error: ENOENT: no such file or directory, open 'CI/flatpak/com.obsproject.Studio.json'

But the file is clearly there: https://github.com/PatTheMav/obs-studio/blob/universal-build/CI/flatpak/com.obsproject.Studio.json.

@iambenmitchell
Copy link

That said, with browser source functionality disabled, this will compile a fully native Apple Silicon build

So I assume we can now use BUILD_BROWSER=OFF to compile OBS for Apple Silicon? Where would I go about specifying this flag?

@Fenrirthviti
Copy link
Member

It is a cmake flag.

@iambenmitchell
Copy link

It is a cmake flag.

Yes but how do I actually apply it? Is it possible to apply it to the CI build script? Because I tried making a directory in the root called build and then running:

cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DDISABLE_PYTHON=ON -BUILD_BROWSER=OFF ..

But I got a luajit error. And there was no bottle to install it. Compiling it from source gave me an error so I gave up

@RytoEX
Copy link
Member

RytoEX commented Sep 14, 2021

It is a cmake flag.

Yes but how do I actually apply it? Is it possible to apply it to the CI build script? Because I tried making a directory in the root called build and then running:

cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DDISABLE_PYTHON=ON -BUILD_BROWSER=OFF ..

But I got a luajit error. And there was no bottle to install it. Compiling it from source gave me an error so I gave up

LuaJIT has nothing to do with the browser source. LuaJIT is used in the obs-scripting module. You need the latest LuaJIT 2.1 branch which should be included in our dependencies package. We don't use brew for dependencies.

Otherwise, you can disable the scripting module entirely by setting ENABLE_SCRIPTING to OFF, or disable Lua support by setting ENABLE_SCRIPTING_LUA to OFF.

@PatTheMav
Copy link
Member Author

This PR is based on the CMake rework - to disable browser sources you have to pass a value for the ENABLE_BROWSER_SOURCE cache variable.

CMake cache variables are passed using the -D switch (so in full you have to pass -DENABLE_BROWSER_SOURCE=OFF.

@PatTheMav PatTheMav force-pushed the universal-build branch 2 times, most recently from 960829b to 25321d5 Compare September 20, 2021 16:25
@PatTheMav PatTheMav force-pushed the universal-build branch 3 times, most recently from 29bbfb4 to 9adf898 Compare October 11, 2021 18:46
@PatTheMav PatTheMav force-pushed the universal-build branch 4 times, most recently from ba482ea to 568b4ba Compare October 20, 2021 17:02
@PatTheMav PatTheMav force-pushed the universal-build branch 8 times, most recently from 717dff3 to 01a3a53 Compare October 27, 2021 15:31
Also updates main CMakeLists.txt and CMakeLists.txt for unit tests,
also adds additional build directories to .gitignore file
@jp9000 jp9000 merged commit 188347d into obsproject:master Mar 17, 2022
@ArtemBernatskyy

This comment was marked as abuse.

@RytoEX
Copy link
Member

RytoEX commented Mar 18, 2022

Hi, is there a tutorial on how to use this PR to build/download binaries for apple silicon powered Mac? Thx!

Download the latest builds from the master branch by checking for the latest build from the obs-studio repository's main page.

  1. Click the green check mark.
  2. Click "Details" on any entry listed in the menu that appears.
  3. Click "Summary" on the page that loads.
  4. Scroll to the bottom of the page and download the macos-arm64 build, currently labeled "obs-macos-arm64".
    image

@tommyvct tommyvct mentioned this pull request Mar 18, 2022
19 tasks
@Chiitoo
Copy link
Contributor

Chiitoo commented Mar 18, 2022

I didn't have a chance to test this before merge in recent times (I guess I might have only tested #4560), so I only now noticed that VST will be required always. Sort of.

I do see the ENABLE_VST at https://github.com/obsproject/obs-vst/blob/master/CMakeLists.txt#L39 but that doesn't help if the module isn't there during build. This might be mostly an issue with source-based packaging only, so I wonder how desirable it will be if I (or someone else) includes the check in OBS Studio itself like how it used to be.

@gxalpha
Copy link
Member

gxalpha commented Mar 18, 2022

This looks intentional to me (and honestly there really isn't a reason to not have a submodule cloned).
However, we're looking to merge obs-vst into the main repo anyways, so this will just resolve itself.

@Chiitoo
Copy link
Contributor

Chiitoo commented Mar 18, 2022

Well, if nothing else, it seems like unnecessary traffic. :]

Looking more into it, it seems the same would happen if obs-browser is missing. Both of them are behind 'ENABLE_PLUGINS', but it's either all or nothing then.

@mrfruteroPR
Copy link

Is it posible to use the NDI and VLC playlist plugins?

@gxalpha
Copy link
Member

gxalpha commented May 16, 2022

All built in plugins (like VLC) work.
Third-party plugins, like NDI, have to be updated by their authors first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Code Cleanup Non-breaking change which makes code smaller or more readable Enhancement Improvement to existing functionality macOS Affects macOS Seeking Testers Build artifacts on CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libobs.so.0 doesn't have a SONAME [BUG] Can't click menu bar after program start