Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build iOS due to -arch arm64 flag if xcode project has EXCLUDED_ARCHS = "arm64" #811

Open
LMakshow opened this issue Dec 3, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@LMakshow
Copy link

LMakshow commented Dec 3, 2024

Description
The app build fails on iOS if it has the EXCLUDED_ARCHS = "arm64" setting in Xcode.
It builds Android normally, the app also builds okay in the simulator from the react-native run-ios command.

Logs
The build logs show a multitude of errors for every CocoaPod used, an example:

2024-12-03 02:15:35.035 [info] warning: None of the architectures in ARCHS (arm64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (arm64, arm64e, i386, x86_64) which is not in EXCLUDED_ARCHS (arm64). (in target 'glog' from project 'Pods')
2024-12-03 02:15:35.035 [info] warning: None of the architectures in ARCHS (arm64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (arm64, arm64e, i386, x86_64) which is not in EXCLUDED_ARCHS (arm64). (in target 'Base64' from project 'Pods')

Our Podfile includes the lines:

installer.pods_project.build_configurations.each do |config|
  config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end

Thus the arm64 is the excluded arch. This setting is quite common in React Native projects with legacy code.

But the command line invocation of the Radon IDE for xcodebuild has -arch arm64 flag which conflicts with the setting and causes the build to fail:

2024-12-03 02:02:47.134 [info] Command line invocation:
2024-12-03 02:02:47.134 [info]     /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace /Users/.../example.xcworkspace -configuration Debug -scheme Staging -arch arm64 -sdk iphonesimulator -showBuildTimingSummary -destination-timeout 0 build

A suggestion would be to allow setting custom command line invocation parameters.

Environment

  • Version of currently used Radon IDE: 1.0.0
  • Version of React Native/Expo used in the project: RN 0.75.4 / No Expo
@LMakshow LMakshow added the bug Something isn't working label Dec 3, 2024
@LMakshow
Copy link
Author

LMakshow commented Dec 3, 2024

Update: while I wrote the issue, I restarted the build without EXCLUDED_ARCHS both in the Podfile and XCode settings. The build succeeded.

I guess we no longer have the legacy code that required that EXCLUDED_ARCHS setting. Still, the issue might be relevant for other developers.

@kmagiera
Copy link
Member

kmagiera commented Dec 3, 2024

Thanks for reporting and for investing time to troubleshot. I'd assume that in such setting you also need to use rosetta for running simulator on arm-based macs?

Do you have some example repositories with this configuration that we could try? I wonder what expo/rn cli could do differently here to allow this. Building for all possible architecture doesn't seem like a sensible choice as this makes the whole build twice as slow. Therefore I'm surprised these tools don't rely on some configuration options for this to work

@LMakshow
Copy link
Author

LMakshow commented Dec 4, 2024

Yes, this, old cocoapods which aren't updated to use arm, by excluding arm64 from arch are forced to build and run through rosetta. I looked through the pods we use, it's only Flipper that is not updated and thus the app won't build without that EXCLUDED_ARCHS in the Podfile.

Also, I found that the EXCLUDED_ARCHS setting makes the iOS 18 simulator behave unstable and hangs up the app on any modal window (iOS 17.5 works fine, it's XCode 16 introduced this bug). So guess, in the future no one will use it, and we simply should get rid of Flipper.

So it's not a high-priority bug for you to fix. I still can make a sample repository for you to try if you would like to. :)

@LMakshow
Copy link
Author

LMakshow commented Dec 4, 2024

Building for all possible architecture doesn't seem like a sensible choice as this makes the whole build twice as slow.

No, the build won't run for all possible architectures as most XCode projects have ONLY_ACTIVE_ARCH set to YES. That's probably why there's no need for this configuration option in expo/rn cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants