Build fails with Apple M1 chip when using `arm64` on iOS simulator
See original GitHub issueThis is on a Mac Mini using the new M1 Apple Silicon chip.
It seems that the pods fail to compile when the arm64
architecture is enabled, which is by default. I am not sure why this happens, but it seems to be related to swift.
If I add arm64
to Excluded Architectures
the build completes properly, but the entire app gets arm64
disabled and it performs poorly on the simulator.
These warnings appear:
ld: warning: Could not find or use auto-linked library 'swiftCoreLocation'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
And afterwards it lists 100+ errors similar to:
Undefined symbols for architecture arm64:
"method descriptor for Foundation._BridgedStoredNSError.init(_nsError: __C.NSError) -> A", referenced from:
l_got.$s10Foundation21_BridgedStoredNSErrorP8_nsErrorxSo0D0C_tcfCTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"base conformance descriptor for Foundation._BridgedStoredNSError: Foundation.CustomNSError", referenced from:
l_got.$s10Foundation21_BridgedStoredNSErrorPAA06CustomD0Tb in libreact-native-geolocation-service.a(RNFusedLocation.o)
"associated type descriptor for Foundation._ErrorCodeProtocol._ErrorType", referenced from:
l_got.$s10_ErrorType10Foundation01_A12CodeProtocolPTl in libreact-native-geolocation-service.a(RNFusedLocation.o)
"associated conformance descriptor for Foundation._BridgedStoredNSError.Foundation._BridgedStoredNSError.Code: Foundation._ErrorCodeProtocol", referenced from:
l_got.$s10Foundation21_BridgedStoredNSErrorP4CodeAC_AA06_ErrorE8ProtocolTn in libreact-native-geolocation-service.a(RNFusedLocation.o)
"base conformance descriptor for Foundation._ErrorCodeProtocol: Swift.Equatable", referenced from:
l_got.$s10Foundation18_ErrorCodeProtocolPSQTb in libreact-native-geolocation-service.a(RNFusedLocation.o)
"method descriptor for static Foundation.CustomNSError.errorDomain.getter : Swift.String", referenced from:
l_got.$s10Foundation13CustomNSErrorP11errorDomainSSvgZTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"base conformance descriptor for Foundation.CustomNSError: Swift.Error", referenced from:
l_got.$s10Foundation13CustomNSErrorPs5ErrorTb in libreact-native-geolocation-service.a(RNFusedLocation.o)
"protocol descriptor for Foundation.CustomNSError", referenced from:
l_got.$s10Foundation13CustomNSErrorMp in libreact-native-geolocation-service.a(RNFusedLocation.o)
"method descriptor for Foundation._ObjectiveCBridgeableError.init(_bridgedNSError: __shared __C.NSError) -> A?", referenced from:
l_got.$s10Foundation26_ObjectiveCBridgeableErrorP15_bridgedNSErrorxSgSo0F0Ch_tcfCTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"base conformance descriptor for Foundation._BridgedStoredNSError: Foundation._ObjectiveCBridgeableError", referenced from:
l_got.$s10Foundation21_BridgedStoredNSErrorPAA26_ObjectiveCBridgeableErrorTb in libreact-native-geolocation-service.a(RNFusedLocation.o)
"protocol descriptor for Foundation._ObjectiveCBridgeableError", referenced from:
l_got.$s10Foundation26_ObjectiveCBridgeableErrorMp in libreact-native-geolocation-service.a(RNFusedLocation.o)
"method descriptor for Swift.Error._getEmbeddedNSError() -> Swift.AnyObject?", referenced from:
l_got.$ss5ErrorP19_getEmbeddedNSErroryXlSgyFTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"method descriptor for Swift.Error._code.getter : Swift.Int", referenced from:
l_got.$ss5ErrorP5_codeSivgTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"method descriptor for Swift.RawRepresentable.rawValue.getter : A.RawValue", referenced from:
l_got.$sSY8rawValue03RawB0QzvgTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"associated type descriptor for Swift.RawRepresentable.RawValue", referenced from:
l_got.$s8RawValueSYTl in libreact-native-geolocation-service.a(RNFusedLocation.o)
"base conformance descriptor for Foundation._ObjectiveCBridgeableError: Swift.Error", referenced from:
l_got.$s10Foundation26_ObjectiveCBridgeableErrorPs0D0Tb in libreact-native-geolocation-service.a(RNFusedLocation.o)
"method descriptor for Swift.Hashable._rawHashValue(seed: Swift.Int) -> Swift.Int", referenced from:
l_got.$sSH13_rawHashValue4seedS2i_tFTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"method descriptor for Swift.Hashable.hashValue.getter : Swift.Int", referenced from:
l_got.$sSH9hashValueSivgTq in libreact-native-geolocation-service.a(RNFusedLocation.o)
"protocol descriptor for Swift.Equatable", referenced from:
l_got.$sSQMp in libreact-native-geolocation-service.a(RNFusedLocation.o)
"value witness table for Builtin.Int32", referenced from:
full type metadata for __C.CLAuthorizationStatus in libreact-native-geolocation-service.a(RNFusedLocation.o)
"_swift_deallocObject", referenced from:
l_objectdestroy in libreact-native-geolocation-service.a(RNFusedLocation.o)
l_objectdestroy.2 in libreact-native-geolocation-service.a(RNFusedLocation.o)
l_objectdestroy.5 in libreact-native-geolocation-service.a(RNFusedLocation.o)
l_objectdestroy.8 in libreact-native-geolocation-service.a(RNFusedLocation.o)
l_objectdestroy.11 in libreact-native-geolocation-service.a(RNFusedLocation.o)
l_objectdestroy.15 in libreact-native-geolocation-service.a(RNFusedLocation.o)
l_objectdestroy.18 in libreact-native-geolocation-service.a(RNFusedLocation.o)
Any suggestions for things to try would be appreciated!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Can't build to simulator on Apple … | Apple Developer Forums
Using Xcode 12.2, the specific error is "building for iOS Simulator, ... me): the Simulator should run on the arm64 architecture on an...
Read more >Apple M1 – Xcode error when build in simulator - Narlei Moreira
If you have seen this error: “Building for iOS Simulator, but linking in dylib built for iOS, file for architecture arm64.
Read more >Xcode error 'building for iOS Simulator, but linking in dylib built ...
Please correct me if I am wrong, but by default, it seems that Xcode running in Apple M1 silicon seems to launch iOS...
Read more >Compiling for iOS on Apple M1 - Mercari Engineering Blog
This will force Xcode to generate a x86_64-sim executable · The simulator will be running on Rosetta · The libraries will be compiled...
Read more >Xcode Error Building for iOS Simulator because of ... - Medium
The Apple M1 is an ARM-based chip. ... Any iOS Simulator SDK with value arm64 inside Excluded Architecture. ... Use Rosetta to launch...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to get it to build by adding an empty swift file to the project so that a bridging header is created.
And more importantly removing this:
From
project.pbxproj
for both debug and release. I haven’t tested for side effects, but now it builds and runs in arm64 mode on the simulator.I’m not sure why this is required, might be an issue with React Native.
For me it was this change
https://github.com/Agontuk/react-native-geolocation-service/commit/2502ffd082b610d78fd32ca987e256468ad90e4b
So fixing this and patching the package fixed it for me
In
node_modules/react-native-geolocation-service
Openreact-native-geolocation-service.podspec
Change
s.dependency "React"
back tos.dependency "React-Core"
Follow the steps to add a patch https://www.npmjs.com/package/patch-package
All worked fine after that after yarn install, pod install