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

Fresh install - build fails on M1 Mac #31438

Closed
setharell opened this issue Apr 26, 2021 · 16 comments
Closed

Fresh install - build fails on M1 Mac #31438

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

Comments

@setharell
Copy link

setharell commented Apr 26, 2021

Description

If I try build a fresh RN app for iOS, I get linking errors.

ld: warning: Could not find or use auto-linked library 'swiftFoundation'
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 'swiftCoreFoundation'
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 'swiftMetal'

There are also about 23 errors, all related to not being able to find these libraries

Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral

React Native version:

System:
OS: macOS 11.2.3
CPU: (8) arm64 Apple M1
Memory: 578.42 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.0.0 - /usr/local/bin/node
Yarn: Not Found
npm: 7.10.0 - /opt/homebrew/bin/npm
Watchman: 4.9.0 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.4/12D4e - /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.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

  1. npx react-native init TestProject
  2. create a .swift file in the project root, and add the bridging header
  3. clean the build folder
  4. npx react-native run-ios

Expected Results

The app should build and run on the iOS emulator

@VishalMahesh
Copy link

Did you find any solution ? Facing same issue.

@rampellisrinu
Copy link

rampellisrinu commented Apr 28, 2021

Having same issue after updating macOS (11.3 (20E232)) on M1. My project was working fine before update and now am seeing lots of these error while building app for iOS and not able to run it.

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 14.5.99. (in target 'Flipper-Glog' from project 'Pods').

Have tried all solutions like these CocoaPods/CocoaPods#9884 but no luck.

@setharell
Copy link
Author

I ended up getting my app to build by using Rosetta2 for everything. I opened the terminal using Rosetta2, deleted the node_modules directory, deleted Pods directory, deleted podfile.lock. Then ran npm install and pod install using the Rosetta2 terminal. Once I did that, npx react-native run-ios builds successfully. I should mention that when I tried to build using Flipper, the build failed. When I remove use_flipper!() from my Podfile, that's when my build succeeded.

I guess that software packages still haven't caught up to be compatible with M1 chips, so for now Rosetta2 is the solution.

@rampellisrinu
Copy link

Thank you so much for the help, I have managed to run the app with above steps. I have tried the same steps before but the order was a bit different. Steps I followed to fix the problem.

  • Delete node_modules
  • Delete Podfile.lock and Pods/ folder
  • update Pod file and comment use_flipper() #use_flipper!()
  • Install node dependencies with npm install
  • Install pod dependencies with pod install in ios folder.

it worked.

@VadimDyliko
Copy link

Yeah, facing the same issue. Commenting use_flipper!() solved that issue, but it's not a solution. I like to use flipper :)

@Helyios
Copy link

Helyios commented May 25, 2021

Facing the same issue, I hope it get resolved soon because don't really want to do without flipper...

@JosePBrotons
Copy link

JosePBrotons commented Jun 5, 2021

Description

If I try build a fresh RN app for iOS, I get linking errors.

ld: warning: Could not find or use auto-linked library 'swiftFoundation'
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 'swiftCoreFoundation'
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 'swiftMetal'

There are also about 23 errors, all related to not being able to find these libraries

Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral

React Native version:

System:
OS: macOS 11.2.3
CPU: (8) arm64 Apple M1
Memory: 578.42 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.0.0 - /usr/local/bin/node
Yarn: Not Found
npm: 7.10.0 - /opt/homebrew/bin/npm
Watchman: 4.9.0 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.4/12D4e - /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.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

  1. npx react-native init TestProject
  2. create a .swift file in the project root, and add the bridging header
  3. clean the build folder
  4. npx react-native run-ios

Expected Results

The app should build and run on the iOS emulator

I was able to run the project by commenting the use_flipper line in the Podfile and also by removing the Library Search Paths in the project, I don't know how It could impact deleting those properties but for now the project is running without any issues and the linking warnings are completely gone.

@tintheanh
Copy link

^ Facing the same issue (already commented use_flipper()), My guess is maybe it's because of XCode 12.5

@JosePBrotons
Copy link

@tintheanh Try removing the LIBRARY_SEARCH_PATHS from the Xcode project. After that I will run in M1 Macs.

@handipriyono
Copy link

handipriyono commented Jun 28, 2021

I also experienced same issue before. But, Now i can compile and build react native run-ios sucessfully.
I already resume and create guide article on how to run react native iOS Macbook with M1 Chip.

Quick step:

  • set terminal to use Rosetta
  • set XCode to use Rosetta
  • small adjust on podFile if you have problem with react native flipper.
    image?url=%2Fstatic%2Fimages%2Fterminal-mac-os-rosetta png w=200 q=75

full guide in this article: https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon

@tintheanh
Copy link

Running XCode in Rosetta now solves the issue for me

@joeyfigaro
Copy link

joeyfigaro commented Jul 6, 2021

@tintheanh How did you manage to do this? I've seen this suggested in a few different spots, but the option for rosetta never shows up for me in the info for XCode.

Nope, turns out I was looking at the info for a random xcodeproj 🤦🏻 – been a long day.

@deerLoves
Copy link

I also experienced same issue before. But, Now i can compile and build react native run-ios sucessfully.
I already resume and create guide article on how to run react native iOS Macbook with M1 Chip.

Quick step:

  • set terminal to use Rosetta
  • set XCode to use Rosetta
  • small adjust on podFile if you have problem with react native flipper.
    image?url=%2Fstatic%2Fimages%2Fterminal-mac-os-rosetta png w=200 q=75

full guide in this article: https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon

https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon
This article solved my all issues that occurred in my macbook uses m1 chip, thanks a lot

@kelset
Copy link
Contributor

kelset commented Jul 29, 2021

hey folks, I don't have an M1 machine so I can't really help with this, but I found in another issue this guide by @aiba linked https://github.com/aiba/react-native-m1, and I was wondering if anyone could test those steps and let the rest of us know if they work

@kelset
Copy link
Contributor

kelset commented Aug 4, 2021

hey folks, following up on this; we've created a troubleshooting guide with what we think is the best approach to solve the build issue for M1 -> #31941

please check it out and let us know if it works for you

@iSamuelBarney
Copy link

try sudo xcode-select --switch /Applications/Xcode.app

@facebook facebook locked as resolved and limited conversation to collaborators Aug 4, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 4, 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