react-native: After updating to Xcode 12 I get The linked library 'libPods-*****.a' is missing one or more architectures required by this target: arm64.

Description

After updating to Xcode 12 I get this error:

The linked library 'libPods-*****.a' is missing one or more architectures required by this target: arm64.

Anyone knows how can solve it?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 86
  • Comments: 68 (20 by maintainers)

Commits related to this issue

Most upvoted comments

For everyone running into

building for iOS Simulator, but linking in object file built for iOS for architecture arm64

Please upgrade to the latest CocoaPods (at least 1.10.0).

If doesn’t work:

Note: If you are using Hermes, this will not work. Go to the next workaround.

Please go to Build Settings -> Excluded Architectures -> Debug (or the schema you are using to run on an iOS Simulator) and add arm64 there. See https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios for more.

If doesn’t work:

Do it for both your project and Pods. If your project is named RNTestProject (react-native init RNTestProject), you will have to do it for RNTestProject and Pods. Remember to do it in both places, otherwise, the error will keep happening.

More information on this workaround is available in this StackOverflow issue: https://stackoverflow.com/a/64139830

Please keep in mind that this is workaround and not an official answer to the problem. We will investigate this and publish a recommendation once we have analysed all the pros and cons of each alternative solutions.

Running into this after I updated Xcode to v12.

ld: in /Users/user/Projects/example/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/user/Projects/example/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

On "react-native": "0.62.2"

This thread is a little messy, so I’m unsure if this addresses the issue of all of the people that have chimed in. For those that have been dealing with build failures like:

[some file path], building for iOS Simulator, but linking in object file built for iOS, file '[some file path]' for architecture arm64

This issue has started coming up with Xcode 12 and support for the new ARM based Macs, as arm64 now no longer can be assumed to only be for iOS devices. This means Xcode 12 will now also build for arm64 simulator SDKs and it has become ambiguous if an arch slice in a prebuilt binary is meant for a simulator or device.


In any case, for now this means that you can configure your Xcode project to exclude arm64 when building for any iOS simulator SDK:

Screenshot 2020-12-02 at 18 12 11

(To those of you that use the new ARM based Macs, it would be good to know if this works for you too.)

Watching this issue. Can’t compile react-native projects after upgraded to xcode12

For me what solved it was opening Xcode in Rosetta mode.

Screenshot 2021-09-23 at 9 04 15

Upgrading to CocoaPods 1.10 will fix it for all of you. I have updated my previous comment as well to indicate that it is fixed: #29984 (comment)

If you are curious, here is an original issue that talks a bit more about it CocoaPods/CocoaPods#10026

my cocopads version is the latest and i still have that problem

@grabbou That really fixes the build but it’s wrong - you can’t submit the app to the app store, arm64 cannot be in excluded architecture.

If you keep this exclusion you’ll get this error:

ERROR ITMS-90086: “Missing 64-bit support. iOS apps submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK or later. We recommend using the default “Standard Architectures” build setting for “Architectures” in Xcode, to build a single binary with both 32-bit and 64-bit support.”

So, I managed to set it manually in dev mode (even release), but when I want to upload to the store I removed that.

Whats the conclusion on excluding arm64 being a proper solution or a workaround? I’m not a native iOS developer and not sure what the implications are when doing this. How did you fix this error or worked around it? (i get this from a detox-build too)

I also have the same issue after updating to Xcode 12.0

RN 0.63.2 Xcode Version 12.0 (12A7209) macOS Catalina 10.15.5 (19F101)

Running into this after I updated Xcode to v12.

ld: in /Users/user/Projects/example/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/user/Projects/example/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

On "react-native": "0.62.2"

Same error, here. I’ve met it when I run detox build ios.

env) RN 0.63.2 Xcode 12.0, Build version 12A7209

command) /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ios/HelloDetox.xcworkspace -scheme HelloDetox -configuration Release -sdk iphonesimulator -derivedDataPath ios/build

@lehuuthoct should we be removing Flipper though?

Well, RN is not relying on Flipper, so it’s safe to remove unless you’re actively using it. You can always add it back later once the issues have been resolved.

I’ve tried a few different things now and finally managed to get a build up and running by removing Flipper (I’m currently not using it anyway), since Flipper required OpenSSL, which causes the issue. I’m honestly still very confused regarding what should be run using Rosetta, whether it matters or to use Rosetta when installing something etc etc, but I guess that’s unrelated to this issue.

My setup

Everything has been installed without using Rosetta.

All commands in normal terminal (non Rosetta). RN project was created using npx react-native init AwesomeProject.

Attempt 1 (failed)

Attempting to build the project using yarn run ios or using xcode (with simulator as designation) both result in the same error:

ld: in /Users/user/Desktop/AwesomeProject/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file built for iOS, file ‘/Users/user/Desktop/AwesomeProject/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a’ for architecture arm64

Attempt 2 (succeeded)

Same as Attempt 1, but after removing Flipper from iOS/Podfile and re-installing pods.

No flipper for me atm, but at least my project is up and running again.

Upgrading to CocoaPods 1.10 will fix it for all of you. I have updated my previous comment as well to indicate that it is fixed: https://github.com/facebook/react-native/issues/29984#issuecomment-696328815

If you are curious, here is an original issue that talks a bit more about it https://github.com/CocoaPods/CocoaPods/issues/10026

Confirmed removing use_flipper! in Podfile + Pod Install -> it builds without error

Removing CocoaAsyncSocket Removing CocoaLibEvent Removing Flipper Removing Flipper-DoubleConversion Removing Flipper-Folly Removing Flipper-Glog Removing Flipper-PeerTalk Removing Flipper-RSocket Removing FlipperKit Removing OpenSSL-Universal Removing YogaKit

thx @grabbou . It worked for me . Gracias!!

For everyone running into

building for iOS Simulator, but linking in object file built for iOS for architecture arm64

Please go to Build Settings -> Excluded Architectures -> Debug and add arm64 there. See https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios for more.

@mrousavy Try updating all pod name references from Folly to RCT-Folly in the reanimated podspec. See some of the current React podspecs that refer to it as an example.

I just noticed that there is a ongoing discussion here https://github.com/react-native-community/discussions-and-proposals/issues/295 - shall we keep it there?

While the original issue has been fixed for all those not running on latest Apple M1 (with a workaround), the support for Apple M1 is still an open topic and needs work.

I am going to create a separate issue to clean up the discussion a bit here.

@alloy:

~ 
➜ /usr/sbin/sysctl -n machdep.cpu.brand_string
Apple processor

~ 
➜ /usr/sbin/sysctl -n hw.optional.arm64
1

So as others have mentioned updating to cocoapods 1.10.0 in combination with the arm64 exclusion on debug builds works. But don’t forget to run pod update !! If you don’t run pod update your podfile won’t be updated !!

1. update cocoa pods -> check version -> pod --version
2. Build Settings -> Excluded Architectures -> Debug and add arm64 there.
3. pod update

@alloy Thanks for the hint, just tested this on Apple M1, I excluded the ‘arm64’ architecture in the Debug setting, and it worked! (I’m using Flutter instead of React Native, but I assume it’s a similar issue)

Has anyone checked if this issue is still present with the react native 0.64 rc?

It fails for me only when building a release version for the iOS simulator: Clean RN project used: npx react-native init RN064 --version 0.64.0-rc.1 on my laptop running macOS Big Sur 11.0.1 (20B29) with the Xcode Version 12.2 (12B45b)

Debug-iphoneos:

Release-iphoneos:

Debug-iphonesimulator:

Release-iphonesimulator:

ld: in /xxx/RN064/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file built for iOS, file '/xxx/RN064/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

As to my understanding, the OpenSSL-Universal pod version needs to be updated. The latest version should include all artefacts needed for the new targets.

Flipper (0.54.0):
    - Flipper-Folly (~> 2.2)
Flipper-Folly (2.3.0):
    - OpenSSL-Universal (= 1.0.2.20) // current latest: 1.1.171

Seems like OpenSSL-Universal missing artifacts seems to be the common denominator. Here is the relevant ticket on its repo: https://github.com/krzyzanowskim/OpenSSL/issues/89

Same for me, unfortunately. Updating cocoapods did not seem to address the issue one way or the other. @grabbou your original solution worked for me though (even if I can’t keep it for production), so it might be a good idea to make a 3rd edit

Removing VALID_ARCH from Build settings under User-Defined group work for me.

@lennardboehnke one thing to be aware of: if you exclude arm64, and run on the M1, swipe events and scrolling will be glitching in the simulator. It might be a temporary bug that Apple will fix, but it is something to be aware of. I ran into this: https://developer.apple.com/forums/thread/668488

Also, the performance won’t be as great as compiling/running native arm64.

Same report here: https://stackoverflow.com/q/65179721/114732

@alloy I got the exact same results as @andreialecu

(To those of you that use the new ARM based Macs, it would be good to know if this works for you too.)

Forgive me if this is a stupid question, but isn’t the simulator on the ARM based macs also based on the new architecture? I.e. wouldn’t it make sense to exclude x86 instead of excluding arm64?

@kelset the issue has more to do with Xcode 12 (added new simulator target) than RN itself and will most likely affect other versions too.

Seems like OpenSSL-Universal missing artifacts seems to be the common denominator. Here is the relevant ticket on its repo: krzyzanowskim/OpenSSL#89

I ended up removing Flipper for now as it was only causing me troubles, mainly due to OpenSSL. I can confirm than once I did and also removed the “excluded ARM64 hack”, everything is working fine with CocoaPods 1.10.

It is the cross compilation issue. I solve the issue by appending x86_64 to VALID_ARCHS or just removing VALID_ARCHS from User-Defined data with xcode 12.0.1 and react-native 0.63.3.

You might also need to modify Podfile by changing VALID_ARCHES for pod projects to fix the issue.

For people who want more info on this build settings change and what it does, go through this link https://apontious.com/2020/08/23/arm-wrestling-your-ios-simulator-builds/

For everyone running into

building for iOS Simulator, but linking in object file built for iOS for architecture arm64

Please go to Build Settings -> Excluded Architectures -> Debug and add arm64 there. See https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios for more.

It worked for me, but this solution is a workaround, am I right? We still need to be able to make build for arm64 architectures.