Building for Simulator works in Xcode 12 beta but not with xcodebuild

Hi there, folks! I’m running into an issue migrating an app from Xcode 11.3.1 to Xcode 12 beta 6. I can build and run the app on Simulator using Xcode but if I try to create a Simulator archive using xcodebuild it fails with messages something like


ld: in [path]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o), building for iOS Simulator, but linking in object file ([path]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o)) built for iOS, file '[path]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics' for architecture arm64

Some things I’ve tried:
  • Confirmed that xcodebuild is using the Xcode 12 beta toolchain (xcode-select -p == /Applications/Xcode-beta.app/Contents/Developer)

  • Update CocoaPods to 1.10.0.beta.2, their first release with Xcode 12 support

  • Force the IPHONEOS_DEPLOYMENT_TARGET of all pods to iOS 13, our base supported SDK

  • Force ONLY_ACTIVE_ARCH to YES for all pods

  • Set ARCHS to $(ARCHS_STANDARD) for all pods

  • Set EXCLUDED_ARCHS to arm64 for all pods and the app project

  • Searched these dev forums for similar arm64 errors

The xcodebuild command I’m using looks something like this:

Code Block
xcodebuild -workspace "App.xcworkspace" -scheme "SomeScheme" -configuration "Debug" -sdk "iphonesimulator" -destination "generic/platform=iOS Simulator" SYMROOT=./builds clean build



Any ideas? I can’t seem to find the build plan that Xcode uses. I wonder if there’s some kind of environment variable being set when Xcode builds that I’m missing in my hand-typed command.

Accepted Reply

For anyone else that discovers this question the root problem, as far as I can tell, is using SYMROOT to force a destination for the archive. This has worked in all other versions of xcodebuild that I can remember but it seems to break the linker’s understanding in the Xcode 12 beta 5 toolchain.

Without defining SYMROOT the project builds and archives as expected. I still haven’t figured out how to override the archive destination, though.

Replies

For anyone else that discovers this question the root problem, as far as I can tell, is using SYMROOT to force a destination for the archive. This has worked in all other versions of xcodebuild that I can remember but it seems to break the linker’s understanding in the Xcode 12 beta 5 toolchain.

Without defining SYMROOT the project builds and archives as expected. I still haven’t figured out how to override the archive destination, though.
I am experiencing the same error when trying to build a framework for the simulator SDK on Xcode 12. This seems that it is an issue related to the linker or xcodebuild command itself, this was not an issue for me on Xcode 11.

In my case, adding the arm64 architecture to the excluded architecture build setting worked so that we were able to send a provisional framework for our client only supporting simulator on Xcode 12.

This seems that the error is being found on Crashlytics in your case. Adding arm64 to the excluded architectures should help with this issue, sadly this does not seem to be the case.

I also reported this as a bug using the Feedback assistant. I'm hoping this helps for its resolution.
Final update, for anybody who finds this. Replace the use of SYMROOT with BUILD_DIR and you’re back on track. Easy!
I tried some approach that worked for me and I have described it here. Still finding its loopholes though.