react-native: New React Native project won't build on Xcode 13.
Description
Running a new React Native project on Xcode 13 beta throws the following error:
ld: warning: Could not find or use auto-linked library 'swift_Concurrency'
ld: warning: Could not find or use auto-linked library 'swiftFileProvider'
Undefined symbols for architecture x86_64:
"__swift_FORCE_LOAD_$_swiftFileProvider", referenced from:
__swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/Users/admin/testpro/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'Flipper-Glog' from project 'Pods')
/Users/admin/testpro/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.4, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'Flipper-PeerTalk' from project 'Pods')
/Users/admin/testpro/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'YogaKit' from project 'Pods')
/Users/admin/testpro/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'boost-for-react-native' from project 'Pods')
/Users/admin/testpro/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'Flipper-DoubleConversion' from project 'Pods')
2021-06-16 14:18:52.665 xcodebuild[28989:583546] [MT] DVTPlugInManager: Required plug-in compatibility UUID 42E1F17B-27B3-4DE8-92A8-DC76BA4F5921 for DVTCoreGlyphs.framework (com.apple.dt.DVTCoreGlyphs) not present
** BUILD FAILED **
The following build commands failed:
Ld /Users/admin/Library/Developer/Xcode/DerivedData/testpro-bhjbeszkrctxppesyqiyhzyvzilq/Build/Products/Debug-iphonesimulator/testpro.app/testpro normal (in target 'testpro' from project 'testpro')
React Native version:
System:
OS: macOS 11.4
CPU: (4) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 4.20 GB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.3.0 - /usr/local/bin/node
Yarn: Not Found
npm: 7.15.1 - /usr/local/bin/npm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.0, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 13.0/13A5154h - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.2 => 0.64.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
- Initialize a project with
npx react-native init testproject
. - Run the project with
npx react-native run-ios
.
Expected Results
I expected the application to build.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 22
- Comments: 29 (6 by maintainers)
Links to this issue
- xcode - The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 - Stack Overflow
- xcode13 - React Native 0.64-65 with XCode 13 build error - could not find auto-linked library swift_Concurrency or swiftFileProvider - Stack Overflow
- macos - Xcode build failure due to Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider - Stack Overflow
Seems related to flipper, disabling it builds successfully for now as a temporary workaround
Podfile
ios/MyApp/AppDelegate.m
I’ve raised the issue here: https://github.com/facebook/flipper/issues/2477
Doing the following fixed the issue for me in Xcode without disabling Flipper:
I’m using RN 0.64.2
Can flopper be opt in and not too invasive in project code? Too much problems for nothing. Project was not building on 12.5, removed it and it worked
Someone building a project with
expo run:ios
, that was bootstrapped with React Native community CLI, will encounter the same error, but formatted as:Solution
Create a bridging header, as described above.
xed ios
to open the project⌘+N
- select swift fileexpo run:ios
should work as expected.We believe this fixed it (in main): https://github.com/facebook/react-native/commit/eb938863063f5535735af2be4e706f70647e5b90
cc @sammy-SC
I completely agree, everytime I make a project I have to go through this hassle with Flipper. I dont understand why facebook does this, it’s absurd.
I just created a new Swift file + Bridging Header with literally nothing inside these files and the build completed successfully. Have no clue why this worked, but it did lol
Finally fixed this after so many headaches…
Using React Native 0.66 and in Podfile, if in the post_install section you have a line of code calling an “Xcode 12.5 M1 workaround” then you have to comment it out if you’re using Xcode 13 or higher (I’m using 13.2 Beta).
Just to note, I’m using macOS Monterey, which doesn’t allow Xcode 12.5.1 or other earlier versions. Also, I am using an M1 MacBook Air.
Looks like this will be fixed in 0.67 https://github.com/facebook/react-native/pull/32284/files but for anyone looking for a workaround see my comment on the Flipper thread: https://github.com/facebook/flipper/issues/3150#issuecomment-992936879
If you upgrade RN version and get to change the iOS target version to 11, don’t forget to change it from Xcode under Build Settings => iOS Deployment Target.
@alexisbronchart confirmed that https://github.com/facebook/react-native/commit/eb938863063f5535735af2be4e706f70647e5b90 fixes build issue in Xcode 13. I’m closing this.