Skip to content

Cannot import Sentry and SentrySwiftUI via binary targets #4413

@nathanbeaumont

Description

@nathanbeaumont

Platform

iOS

Environment

Production

Installed

Swift Package Manager

Version

8.36.0

Xcode Version

15.1

Did it work on previous versions?

N/A

Steps to Reproduce

We import Sentry from an XCFramework, and when adding SentrySwiftUI today we got a runtime error when SentrySwiftUI was looking for the library. My understand is that SentrySwiftUI is recursively searching for Sentry as a dependency, but when it locates the binary, it does not have the correct arch, I believe because it contains x86 it crashes. Or at least that's my understanding of the error message (Full error message below).

file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'arm64,x86_64', need 'arm64')), 

How we import Sentry via binaries:

        .binaryTarget(
            name: "Sentry",
            url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.36.0/Sentry.xcframework.zip",
            checksum: "ca2140c6ef4986cd4f4436b23b3bd3cbe582a450fb62a9410efd3085f90be4c5"
        ),
        .binaryTarget(
            name: "SentrySwiftUI",
            url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.36.0/SentrySwiftUI.xcframework.zip",
            checksum: "0bbef68123e8122cbd72c89c151a6dea9d71d99f65c0e765079eff283a75b90b"
        ),

Expected Result

I would expect this way to import the dependencies this way to not crash.

Actual Result

Verbose Runtime Error:

dyld[33462]: Library not loaded: @rpath/Sentry.framework/Sentry
  Referenced from: <85F8A541-E012-37A1-A8C5-85C917A41480> /Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/SentrySwiftUI.framework/SentrySwiftUI
  Reason: tried: '/Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/Sentry.framework/Sentry' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'arm64,x86_64', need 'arm64')), '/Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/PackageFrameworks/Sentry.framework/Sentry' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/Sentry.framework/Sentry' (no such file), '/usr/lib/swift/Sentry.framework/Sentry' (no such file, not in dyld cache), '/Users/nathanbeaumont/Library/Developer/CoreSimulator/Devices/043BE2C9-7DB6-43AF-9174-930687F0E8EF/data/Containers/Bundle/Application/BA7F7F00-AC72-49D6-9254-5CE9E408985B/HistoricalTrendsTestApp.app/Frameworks/Sentry.framework/Sentry' (no such file), '/Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/SentrySwiftUI.framework/Frameworks/Sentry.framework/Sentry' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/PackageFrameworks/Sentry.framework/Sentry' (no such file), '/Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/PackageFrameworks/Sentry.framework/Sentry' (no such file), '/Users/nathanbeaumont/Library/Developer/CoreSimulator/Devices/043BE2C9-7DB6-43AF-9174-930687F0E8EF/data/Containers/Bundle/Application/BA7F7F00-AC72-49D6-9254-5CE9E408985B/HistoricalTrendsTestApp.app/Frameworks/Sentry.framework/Sentry' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/PackageFrameworks/Sentry.framework/Sentry' (no such file), '/Users/nathanbeaumont/Library/Developer/Xcode/DerivedData/HistoricalTrendsTestApp-hcnyccmunfsviyfeawiwqpfqysij/Build/Products/Debug-iphonesimulator/PackageFrameworks/Sentry.framework/Sentry' (no such file), '/Users/nathanbeaumont/Library/Developer/CoreSimulator/Devices/043BE2C9-7DB6-43AF-9174-930687F0E8EF/data/Containers/Bundle/Application/BA7F7F00-AC72-49D6-9254-5CE9E408985B/HistoricalTrendsTestApp.app/Frameworks/Sentry.framework/Sentry' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Sentry.framework/Sentry' (no such file)
Logging Connection Failed: Connection to Logging Facility lost. (Please try relaunching your Application)
Message from debugger: killed

Are you willing to submit a PR?

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions