Skip to content

Fix trailing comma in OBSShader causing a build error in mac#13384

Open
danrossi wants to merge 1 commit into
obsproject:masterfrom
danrossi:libobs-metal-fix
Open

Fix trailing comma in OBSShader causing a build error in mac#13384
danrossi wants to merge 1 commit into
obsproject:masterfrom
danrossi:libobs-metal-fix

Conversation

@danrossi
Copy link
Copy Markdown

@danrossi danrossi commented May 1, 2026

Description

There is a build error on mac which the error only shows up in xcode not the command line. The trailing comma in OBSShader in libobs-metal causes an "unexpected separator" error.

Screenshot 2026-05-02 014858

Related: #13383

Motivation and Context

Discovered trying to build for macos. Under macOS 14 and XCode 16.1

How Has This Been Tested?

cmake --preset macos
cd build_macos
xcodebuild                                                 \
  -configuration RelWithDebInfo \
  -scheme obs-studio                                       \
  -parallelizeTargets                                      \
  -destination "generic/platform=macOS,name=Any Mac"

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [ x] I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • [ x] My code is not on the master branch.
  • [ x] My code has been tested.
  • [ x] All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@jcm93
Copy link
Copy Markdown
Contributor

jcm93 commented May 1, 2026

Trailing commas in parameter lists are a Swift 6.1 feature.

The current libobs-metal CMake code prescribes 6.0.

This fix should be correct if that version requirement is supposed to remain. If the project wishes to require 6.1 for any reason though, then the CMake code should instead be changed.

It seems Xcode doesn't actually disambiguate between 6 and 6.1 using this setting; rather it seems like the simplest way to enforce Swift 6.1 would be to enforce Xcode 16.3, the version that ships it.

All this in the context that the project build instructions might need a general refresh to reflect current minimums, so there may be some evaluation needed of what OBS wants to require moving forward.

cc @PatTheMav

@danrossi
Copy link
Copy Markdown
Author

danrossi commented May 1, 2026

Ok. Please close if this a backwards compatibility issue. Sorry about that. What is the fix ?

@jcm93
Copy link
Copy Markdown
Contributor

jcm93 commented May 1, 2026

Sorry, my point got a bit muddled with the edit.

Overall I'm saying: This fix seems correct if the project doesn't want to require Swift 6.1. If the project does want to require Swift 6.1, it should probably enforce Xcode 16.3. I would leave this open until maintainers establish which course is correct.

@danrossi
Copy link
Copy Markdown
Author

danrossi commented May 2, 2026

OK I get you. So I need to upgrade my system to macOS 15 and XCode 16.3. Will try that.

@danrossi
Copy link
Copy Markdown
Author

danrossi commented May 2, 2026

I've updated to macOS 15.7.7 and XCode 16.3 and the trailing comma issue isn't a problem. What is the set environment for the release build system ? I can update to that. Probably can close this.

@WizardCM WizardCM added kind/bug Categorizes issue or PR as related to a bug. platform/macos Categorizes issue or PR as affecting macOS specifically labels May 3, 2026
@Warchamp7
Copy link
Copy Markdown
Member

I am not a mac user but the workflow looks to use XCode 26.1

print '::group::Enable Xcode 26.1'
sudo xcode-select --switch /Applications/Xcode_26.1.app/Contents/Developer
print '::endgroup::'

@danrossi
Copy link
Copy Markdown
Author

danrossi commented May 4, 2026

OK should I set the minimum to 26.1 in the plugin project. I will upgrade to that. Not a problem. We should close this then. Xcode 16.1 was old anyway.

I set the minimum in the plugin template which I fixed up with the Swift language patch. And another plugin project I am working on. I'm not sure what minimum macOS SDK to set it to or target. It's set to 15.4 to match what 16.3 supports. According to the workflow it seems to be targeting SDK 15 runs-on: macos-15

https://github.com/danrossi/obs-plugintemplate/blob/update-spec/cmake/common/buildspec_common.cmake#L65/cmake/macos/compilerconfig.cmake#L20
https://github.com/danrossi/obs/blob/win-build-fix/cmake/macos/compilerconfig.cmake#L20

The instructions to update potentially is this. App Store Xcode is only delivering 16.1. Grab XCode 26.1 or higher from this which needs an Apple developer account. OBS is setup for a universal build. So it needs to be the XCode universal. The mimimum macOS needed is 15.6. So SDK targeted is now 26.1. The version shift is confusing as the previous SDK was 15.7.

##13250 is needed or else configure will fail. So the workflow should be failing right now ? I have an automated patch for it with the plugin setups.

https://github.com/danrossi/obs-plugintemplate/blob/update-spec/cmake/common/buildspec_common.cmake#L65

https://xcodereleases.com/

@danrossi
Copy link
Copy Markdown
Author

danrossi commented May 6, 2026

@danrossi
Copy link
Copy Markdown
Author

I'm confused which way is the best to go. Somebody took an issue in #13406 setting the minimum xcode in cmake to 26.1 to match the CI environment. So there is no more confusion when going to build it yourself.

This change should be backwards compatible with Xcode 16.1 or 16.3 and above is needed with the newer Swift. But further code changes that work in 26.1 and pass the CI builds may not work in 16.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. platform/macos Categorizes issue or PR as affecting macOS specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants