getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
773 stars 306 forks source link

MacCatalyst build initially fails with: invalid version number in '-target arm64-apple-ios10.15-macabi' #3984

Open jknlsn opened 2 weeks ago

jknlsn commented 2 weeks ago

Platform

iOS, macOS

Environment

Production

Installed

Swift Package Manager

Version

8.26.0

Did it work on previous versions?

No response

Steps to Reproduce

Building always fails for MacCatalyst initially before succeeding on Xcode 15.4, whereas it succeeds on first try on 15.3.

Steps

  1. Create a new iOS app.
  2. Remove Mac for iPad, add MacCatalyst target.
  3. Add Sentry SDK package from https://github.com/getsentry/sentry-cocoa.git, adding Sentry and SentrySwiftUI to target.
  4. Clean build folder, build and run to Mac.

Expected Result

Build succeeds and runs (happens on Xcode 15.3)

Actual Result

Initially fails. Build and run again immediately after, works.

On Xcode 15.4, any time that I clean and then build, it first fails and then will succeed. After this the build will always succeed, unless cleaned in between. This has caused our Xcode Cloud builds that recently updated to using Xcode 15.4 to fail, as they just fail and don't try to build again.

I found this related discussion on the Apple Developer Forums, and added this information there as well, as it may not be able to be fixed but I don't know if there is a workaround that could be implemented. In the meantime I am using Xcode 15.3 for Xcode Cloud.

Are you willing to submit a PR?

No, I haven't figured out a fix!

jaderyang-sms commented 2 weeks ago

Same here.

philipphofmann commented 2 weeks ago

@jaderyang-sms and @jknlsn, with the following steps, I can run an empty iOS app on MacCatalyst:

  1. Performa a build clean
  2. Quit Xcode
  3. Delete the contents of the derived data folder. That's usually under ~/Library/Developer/Xcode/DerivedData.
  4. Start Xcode and build the project
  5. Xcode complains with the mentioned error above
  6. Hit run app in Xcode. The build error persists, but I can run the app.

I'm using an M2 MacBook Pro with Xcode 15.4 on macOS 14.4.1.

philipphofmann commented 2 weeks ago

According to Apple staff in the Apple forum this an issue with Xcode, and the recommendation is to stick to Xcode 15.3.

choulepoka commented 1 week ago

I do not know if this helps, but reverting to Sentry 8.21.0 seems to fix the issue.