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

  1. Initialize a project with npx react-native init testproject.
  2. 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)

Commits related to this issue

Most upvoted comments

Seems related to flipper, disabling it builds successfully for now as a temporary workaround

Podfile

- use_flipper!()
+ # use_flipper!()
pod install

ios/MyApp/AppDelegate.m

+ // #ifdef FB_SONARKIT_ENABLED
+ // #import <FlipperKit/FlipperClient.h>
+ // #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
+ // #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
+ // #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
+ // #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
+ // #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

+ // static void InitializeFlipper(UIApplication *application) {
+ //   FlipperClient *client = [FlipperClient sharedClient];
+ //   SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
+ //   [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
+ //   [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
+ //   [client addPlugin:[FlipperKitReactPlugin new]];
+ //   [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
+ //   [client start];
+ // }
+ // #endif

...

+ // #ifdef FB_SONARKIT_ENABLED
+ //   InitializeFlipper(application);
+ // #endif

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:

  1. Go to Build Settings --> Search for “Search paths” and then add $(SDKROOT)/usr/lib/swift to “Library search paths”
  2. Change “iOS deployment target” in Xcode to 11
  3. Remove pods and build again , then it should work

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:

⚠️  ld: Could not find or use auto-linked library 'swift_Concurrency'
⚠️  ld: Could not find or use auto-linked library 'swiftFileProvider'
⚠️  ld: Could not find or use auto-linked library 'swiftDataDetection'
❌  Undefined symbols for architecture x86_64
┌─ Symbol: __swift_FORCE_LOAD_$_swiftDataDetection
└─ Referenced from: __swift_FORCE_LOAD_$_swiftDataDetection_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)

❌  ld: symbol(s) not found for architecture x86_64

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

Create a bridging header, as described above.

  • xed ios to open the project
  • ⌘+N - select swift file
  • Select “Create Bridging Header”
  • Rebuild expo run:ios should work as expected.

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

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.

clipboard_image_2246dcd3a97

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.