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
- Fix Xcode12 cli build Xcode 12 now tries to build both arm64 and x86_64 slices for the simulator See: - https://stackoverflow.com/a/63955114/158525 - https://github.com/facebook/react-native/issues/2... — committed to celo-org/celo-monorepo by jeanregisser 4 years ago
- Jeanregisser/xcode12 (#5686) * Fix Xcode12 cli build Xcode 12 now tries to build both arm64 and x86_64 slices for the simulator See: - https://stackoverflow.com/a/63955114/158525 - https://gith... — committed to celo-org/celo-monorepo by jeanregisser 4 years ago
- [Wallet] Changes to work with Xcode 12 (#5670) ### Description Updating to Xcode 12 command lines tools requires these changes Xcode 12 now tries to build both arm64 and x86_64 slices for the s... — committed to celo-org/celo-monorepo by cmcewen 4 years ago
- Bump OpenSSL-Universal pod dependency to 1.1.171 (#1735) Summary: This should fix the react-native issue with building on Xcode 12: https://github.com/facebook/react-native/issues/29984 ## Changelog... — committed to facebook/flipper by deleted user 4 years ago
- fix: building in release mode for simulator (#30543) Summary: Fixes https://github.com/facebook/react-native/issues/29984 Right now, running a React Native application with Xcode 12 in Release mode ... — committed to facebook/react-native by grabbou 4 years ago
- fix: arm64をbuild targetから除外してみる - cf. - https://qiita.com/peka2/items/73ee82fe3555217ff712 - https://github.com/facebook/react-native/issues/29984 — committed to youriko-fanclub/KANJI-client by direct1889 3 years ago
- Merge from upstream 0.64-stable to v0.64.0 (#863) * chore: ignore broken Hermes job * Upgrade metro to 0.64.0 Summary: Upgrade metro to 0.64.0 Changelog: [Internal] Reviewed By: cpojer ... — committed to microsoft/react-native-macos by amgleitman 3 years ago
For everyone running into
Please upgrade to the latest CocoaPods (at least
1.10.0
).If doesn’t work:
Please go to Build Settings -> Excluded Architectures ->
Debug
(or the schema you are using to run on an iOS Simulator) and addarm64
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 forRNTestProject
andPods
. 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.
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:
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 forarm64
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:(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.
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:
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)
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
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: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-696328815If 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!!
@mrousavy Try updating all pod name references from
Folly
toRCT-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:
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 !!
@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)
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 runningmacOS Big Sur 11.0.1 (20B29)
with theXcode Version 12.2 (12B45b)
Debug-iphoneos: ✅
Release-iphoneos: ✅
Debug-iphonesimulator: ✅
Release-iphonesimulator: ❗
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.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/89Same 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
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.
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
toVALID_ARCHS
or just removingVALID_ARCHS
fromUser-Defined
data withxcode 12.0.1
andreact-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/
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.