Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New React Native project won't build on Xcode 13. #31733

Closed
adrianbartyczak opened this issue Jun 16, 2021 · 29 comments
Closed

New React Native project won't build on Xcode 13. #31733

adrianbartyczak opened this issue Jun 16, 2021 · 29 comments
Labels
Needs: Triage 🔍 Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@adrianbartyczak
Copy link

adrianbartyczak commented Jun 16, 2021

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.

@kelset
Copy link
Contributor

kelset commented Jun 18, 2021

👋 Adrian, couple of quick questions:

  1. are you building against iOS 14 or 15?
  2. can you try with 0.65-rc.2 and see if it breaks there too?

Some folks have reported that their project have been building fine with Xcode 13

leotm pushed a commit to leotm/react-native-template-new-architecture that referenced this issue Jun 19, 2021
Via CLI and manually
- android/app/build.gradle
- ios/Podfile
And update
- package.json

https://react-native-community.github.io/upgrade-helper/?from=0.64.2&to=0.65.0-rc.2

Builds on XCode 12.5

Build fails on XCode 13.0 beta:

Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider

facebook/react-native#31733
@leotm
Copy link
Contributor

leotm commented Jun 19, 2021

Same error logs here with XCode 13.0 beta and 0.65-rc.2 referenced above ^

XCode 12.5 builds fine on both 0.64.2 and 0.65.0-rc.2

I'm on macOS Monterey 12.0 Beta too

@leotm
Copy link
Contributor

leotm commented Jun 20, 2021

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: facebook/flipper#2477

@gazedash
Copy link

gazedash commented Jun 24, 2021

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

@peterkuiper
Copy link

peterkuiper commented Jul 15, 2021

@leotm You might want to checkout this comment: zalando/SwiftMonkey#80 (comment)

@fkgozali
Copy link
Contributor

We believe this fixed it (in main): eb93886

cc @sammy-SC

@alexisbronchart
Copy link

We believe this fixed it (in main): eb93886

cc @sammy-SC

Just tested. It works™️

@sammy-SC
Copy link
Contributor

@alexisbronchart confirmed that eb93886 fixes build issue in Xcode 13. I'm closing this.

@nithinyell
Copy link

@alexisbronchart confirmed that eb93886 fixes build issue in Xcode 13. I'm closing this.

This PR did not fixed my pipeline

@sammy-SC

Mac OS 11
Xcode 13 

⚠️  /Users/runner/work/1/s/myApp/ios/Pods/Headers/Private/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h:1519:38: implicit conversion loses integer precision: 'unsigned long long' to 'std::uintptr_t' (aka 'unsigned long') [-Wshorten-64-to-32]

        tryWake(publishing, current, value, next, waker, sleepers, iter, task);
        ^


    no rule to process file '/Users/runner/work/1/s/myApp/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'arm64' (in target 'Flipper-RSocket' from project 'Pods')
    no rule to process file '/Users/runner/work/1/s/myApp/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'arm64' (in target 'Flipper-RSocket' from project 'Pods')
    no rule to process file '/Users/runner/work/1/s/myApp/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'arm64' (in target 'Flipper-RSocket' from project 'Pods')
    no rule to process file '/Users/runner/work/1/s/myApp/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'armv7' (in target 'Flipper-RSocket' from project 'Pods')
    no rule to process file '/Users/runner/work/1/s/myApp/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'armv7' (in target 'Flipper-RSocket' from project 'Pods')
    no rule to process file '/Users/runner/work/1/s/myApp/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'armv7' (in target 'Flipper-RSocket' from project 'Pods')
** BUILD FAILED **


The following build commands failed:
	CompileC /Users/runner/Library/Developer/Xcode/DerivedData/myApp-gnzuyhqjbxtcmgdefpewjfijhdya/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Flipper-Folly.build/Objects-normal/armv7/DistributedMutex.o /Users/runner/work/1/s/myApp/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Flipper-Folly' from project 'Pods')

@gcrozariol
Copy link

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

@heberuriegas
Copy link

Same, swift file and bridge header works.

@debianw
Copy link

debianw commented Sep 21, 2021

Same here, just created a new Swift file + Bridging Header and it worked!!. I don't know why Lol

@nithinyell
Copy link

I have updated to react-native 0.65.0 and able to build in Xcode 13(13A233)

@ksarna
Copy link

ksarna commented Sep 23, 2021

Bridging Header didn't help in rn 0.63. I had to turn off flipper

@debianw
Copy link

debianw commented Sep 23, 2021

Bridging Header didn't help in rn 0.63. I had to turn off flipper

I'm also using 0.63, Try this for flipper:

use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })

@EvanBacon
Copy link
Contributor

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.

@AbdelrahmanTealab
Copy link

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.

@nriccar
Copy link

nriccar commented Sep 30, 2021

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.

@nithinyell
Copy link

#32301

@danidaryaweesh
Copy link

danidaryaweesh commented Oct 1, 2021

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

@eliataylor
Copy link

eliataylor commented Oct 1, 2021

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.

@nriccar, what packages are you using and how many broke during the upgrade?

@nriccar
Copy link

nriccar commented Oct 1, 2021

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.

@nriccar, what packages are you using and how many broken during the upgrade?

Only one, react-native-view-pager. Why?

@JeffPatricio
Copy link

I'm using native react 0.64.0 and it worked for me after commenting out the use_flipper!() line In Podfile.

@nikolavujkovic
Copy link

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

@Applizone
Copy link

I have follow leotm here and gcrozariol here and samridhgupta here and Saveen here but I'm still having the error while build.

I already publish the app last month and turn off mac. And when I open to do some change to code, the error shows up.
These are the less error after I comment flipper. If not, it will show more than this on the Xcode issue navigator

Showing Recent Messages
Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
Could not find or use auto-linked library 'swiftObjectiveC'
Could not find or use auto-linked library 'swiftCoreGraphics'
Could not find or use auto-linked library 'swiftCore'
Could not find or use auto-linked library 'swiftDispatch'
Could not find or use auto-linked library 'swiftCoreFoundation'
Could not find or use auto-linked library 'swiftFoundation'
Could not find or use auto-linked library 'swiftDarwin'
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreFoundation
Undefined symbol: __swift_FORCE_LOAD_$_swiftDispatch
Undefined symbol: __swift_FORCE_LOAD_$_swiftDarwin
Undefined symbol: __swift_FORCE_LOAD_$_swiftObjectiveC
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreGraphics
Undefined symbol: __swift_FORCE_LOAD_$_swiftFoundation

Why is it suddenly happening?

@mercpls
Copy link

mercpls commented Dec 2, 2021

  • ⌘+N - select swift file
  • Select "Create Bridging Header"

Hi Evan, I don't see the 'Create bridging header' option after creating a swift file. I just get a blank swift file in the root dir it looks like.

@personjerry
Copy link

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: facebook/flipper#3150 (comment)

@EvanBacon
Copy link
Contributor

@mercpls Xcode can be buggy, create a bridging header manually or use Expo's new custom managed workflow to fix.

@Rebsos
Copy link

Rebsos commented Jun 16, 2022

If you recently upgraded nodejs with nvm and got this error. Try this:
https://stackoverflow.com/a/72652877/3585272

@facebook facebook locked as resolved and limited conversation to collaborators Sep 13, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests