Skip to content

Mac Catalyst builds pick the macOS Sentry.xcframework slice ([sdk=maccatalyst*] never matches) #6755

Description

@alessandro-zanni

What React Native libraries do you use?

Expo Router

Are you using sentry.io or on-premise?

sentry.io (SaS)

Are you using any other error monitoring solution alongside Sentry?

No

@sentry/react-native SDK Version

8.23.0 (sentry-cocoa 9.24.0). The same code is still in 8.27.0.

How does your development environment look like?

macOS 27, Xcode 27.0 (27A266a), CocoaPods 1.17.0, Expo SDK 57, React Native 0.86 (react-native-tvos), use_frameworks! :linkage => :static, the default prebuilt Sentry.xcframework (SENTRY_USE_XCFRAMEWORK unset). App: Streamyfin built as a Mac Catalyst app.

Sentry.init()

Not relevant: this fails at build time, before any JS runs.

Steps to Reproduce

  1. Take an iOS app using @sentry/react-native via CocoaPods and enable Mac Catalyst on the app target (SUPPORTS_MACCATALYST = YES).
  2. pod install
  3. xcodebuild -workspace App.xcworkspace -scheme App -destination 'platform=macOS,variant=Mac Catalyst' build

Expected Result

The Catalyst build compiles and links against Sentry.xcframework/ios-arm64_arm64e_x86_64-maccatalyst.

Actual Result

RNSentry fails to compile:

RNSentryInternal.swift:40:53: error: 'Options' is unavailable: cannot find Swift declaration for this class
RNSentryInternal.swift:69:65: error: cannot find type 'SentryScreenFrames' in scope
RNSentryInternal.swift:210:27: error: type 'SentrySDK' has no member 'internal'

After forcing the Catalyst slice for RNSentry alone, the app link fails with:

ld: building for 'macCatalyst', but linking in object file (.../Sentry.xcframework/macos-arm64_arm64e_x86_64/Sentry.framework/Versions/A/Sentry[arm64][3](SentryMessage-....o)) built for 'macOS'

Cause. SENTRY_XCFRAMEWORK_SLICES_BY_SDK in scripts/sentry_utils.rb maps the Catalyst slice to an SDK called maccatalyst:

'maccatalyst' => %w[ios-arm64_arm64e_x86_64-maccatalyst],
'macosx'      => %w[macos-arm64_arm64e_x86_64],

No such SDK exists. Mac Catalyst builds use the macosx SDK (SDKROOT = macosx, IS_MACCATALYST = YES), so FRAMEWORK_SEARCH_PATHS[sdk=maccatalyst*] never matches and FRAMEWORK_SEARCH_PATHS[sdk=macosx*] hands Catalyst builds the AppKit slice. This affects both pod_target_xcconfig and user_target_xcconfig, i.e. RNSentry.*.xcconfig and the app's Pods-<App>.*.xcconfig.

Workaround we use in a Podfile post_integrate hook. It has to be post_integrate, because the aggregate xcconfig is written after post_install. It is only valid because our app never builds for native macOS:

post_integrate do |installer|
  Dir.glob(File.join(installer.sandbox.target_support_files_root, '**', '*.xcconfig')).each do |path|
    xcconfig = File.read(path)
    fixed = xcconfig.gsub('Sentry.xcframework/macos-arm64_arm64e_x86_64', 'Sentry.xcframework/ios-arm64_arm64e_x86_64-maccatalyst')
    File.write(path, fixed) if fixed != xcconfig
  end
end

Possible fix (untested): the sdk= condition can't tell macOS and Catalyst apart, so the macosx entry could pick the slice through IS_MACCATALYST instead, e.g.

SENTRY_MACOSX_SLICE_NO = macos-arm64_arm64e_x86_64
SENTRY_MACOSX_SLICE_YES = ios-arm64_arm64e_x86_64-maccatalyst
FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(inherited) ".../Sentry.xcframework/$(SENTRY_MACOSX_SLICE_$(IS_MACCATALYST))"

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions