I was trying to install React Native on my system, and found that it failed to install CocoaPods dependencies which is required by that template error.
sudo arch -x86_64 gem install ffi
fixed this issue but ended up with event-config.h" file not found
error.
I changed the changed the flipper version in pod file to use_flipper!({'Flipper'=>'0.76.0'})
and then I reached to the error mentioned above. Any help on this issue would be appreciated.
node version : 15.10.0
react-native version: 0.63.4
Xcode version: 12.4
Error description below:
Showing Recent Messages
Could not find or use auto-linked library 'swiftCoreGraphics'
Could not find or use auto-linked library 'swiftUIKit'
Could not find or use auto-linked library 'swiftDarwin'
Could not find or use auto-linked library 'swiftFoundation'
Could not find or use auto-linked library 'swiftMetal'
Could not find or use auto-linked library 'swiftObjectiveC'
Could not find or use auto-linked library 'swiftCoreFoundation'
Could not find or use auto-linked library 'swiftDispatch'
Could not find or use auto-linked library 'swiftCoreImage'
Could not find or use auto-linked library 'swiftQuartzCore'
Could not find or use auto-linked library 'swiftCore'
Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral
Undefined symbol: associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType
Undefined symbol: associated conformance descriptor for Swift.ExpressibleByIntegerLiteral.Swift.ExpressibleByIntegerLiteral.IntegerLiteralType: Swift._ExpressibleByBuiltinIntegerLiteral
Undefined symbol: method descriptor for Swift.ExpressibleByFloatLiteral.init(floatLiteral: A.FloatLiteralType) -> A
Undefined symbol: protocol descriptor for Swift.ExpressibleByIntegerLiteral
Undefined symbol: value witness table for Builtin.Int32
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreImage
Undefined symbol: associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType
Undefined symbol: __swift_FORCE_LOAD_$_swiftQuartzCore
Undefined symbol: __swift_FORCE_LOAD_$_swiftDispatch
Undefined symbol: method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreFoundation
Undefined symbol: protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift
Undefined symbol: __swift_FORCE_LOAD_$_swiftObjectiveC
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreGraphics
Undefined symbol: _swift_getForeignTypeMetadata
Undefined symbol: __swift_FORCE_LOAD_$_swiftFoundation
Undefined symbol: associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral
Undefined symbol: __swift_FORCE_LOAD_$_swiftUIKit
Undefined symbol: __swift_FORCE_LOAD_$_swiftMetal
Undefined symbol: Swift.Float.init(Swift.Double) -> Swift.Float
Undefined symbol: __swift_FORCE_LOAD_$_swiftDarwin
Undefined symbol: protocol witness table for Swift.Float : Swift._ExpressibleByBuiltinFloatLiteral in Swift
8
Answers
I managed to resolve this issue by adding an empty swift file to the project in Xcode. This had the side effect of creating a bridging header file which (for me at least) got my project to compile.
You need to exclude architecture arm64 if you are using M1 mac.
Also add this code at the end of the pod file
Do pod install, Clean the build folder and restart the build it will resolve the issue.
Update: for xCode 13 use the following configurations:
if you are facing
Command PhaseScriptExecution failed with a nonzero exit code in react native xcode 13
This is caused because your project contains frameworks/libraries of both Swift and Objective c.
Add a swift file(If you see Objective C files already in your project) or Objective C file(If you see Objective C files already in your project). Select the targets those give above error.
This step will ask to create a bridging header. Create bridging header
Say yes and compile and run.
What really worked for me, only add this Excluded Architectures and you will be fine, if you are using a Mac with M1 of course
What ended up working for me is removing the LIBRARY_SEARCH_PATHS from Xcode…
https://github.com/facebook/react-native/issues/31438#issuecomment-865180401
When using Dipan Sharmas solution I couldn’t build for devices or "Any iOS Device" anymore. What resolved this issue for me was just excluding arm64 for the "Any iOS Simulator SDK" instead of excluding it in the upper level. Even removing arm64 from the upper level of excluded architectures, did not get the project building again for Devices and "Any iOS Device". Had to pull an older project file from my git.
Working "Excluded Architectures" settings on Apple Silicon M1
If you are on m1 Mac
arch -x86_64 pod install
in iOS folderDipan’s excellent answer initially worked for but then because of forces beyond my control, I had to update a bunch of React libraries and it no longer worked.
Eventually I was able to solve this problem by removing the two references to
in
<my project name>.xcodeproj/project.pbxproj
file. I then ran my project again and it got through the last few files.NOTE: In the interest of full disclosure, I don’t know what the ramifications of this change will be