简体   繁体   中英

M1 Mac react-native iOS build error (in target 'RCT-Folly' from project 'Pods')

On an M1 Mac, with npm 8.3.1 & node 17.4 , when I run npx react-native run-ios I receive 2 errors:

The following build commands failed:
    CompileC /Users/Steven/Library/Developer/Xcode/DerivedData/HelloSteve-hghgfcwemhoaiacfwlophutqqzbh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/arm64/SysUio.o /Users/Steven/Documents/Projects/React\ Native/HelloSteve/ios/Pods/RCT-Folly/folly/portability/SysUio.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
    CompileC /Users/Steven/Library/Developer/Xcode/DerivedData/HelloSteve-hghgfcwemhoaiacfwlophutqqzbh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/arm64/NetOps.o /Users/Steven/Documents/Projects/React\ Native/HelloSteve/ios/Pods/RCT-Folly/folly/net/NetOps.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
(2 failures)

From this answer , the line flipper_post_install(installer) didn't exist in the Podfile.

From this answer , I commented out # use_flipper!() in the Podfile, ran pod install then npx react-native run-ios and received a similar error:

The following build commands failed:
        CompileC /Users/Steven/Library/Developer/Xcode/DerivedData/HelloSteve-hghgfcwemhoaiacfwlophutqqzbh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/arm64/SysUio.o /Users/Steven/Documents/Projects/React\ Native/HelloSteve/ios/Pods/RCT-Folly/folly/portability/SysUio.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
(1 failure)

I tried the solution here , (commenting out the line typedef uint8_t clockid_t; in Time.h ) but that didn't work either.

Help appreciated.

I followed the solution provided at this link , which:

  • cleans pod & yarn caches
  • then installs a lower version of react-native: npx react-native@0.64.2 init MyApp .

This solved the problem for me.

I also faced this issue but not on M1 Mac

I found that if I create a project in a folder that contain a white space Learning RN/NewProject , there're an error when we run pod install

I tried to remove the whitespace in folder name LearningRN/NewProject and it worked well.

I ran into a similar issue when updating the project target OS version.

Actually Xcode will ask you to change the target OS version for the different packages, which then lead to not finding the RCT package anymore for me.

So when xcode tells you there is a good option to change the target settings for different pods, be very careful with that. Either do it step by step and try out or leave it as is, as long as it is building and running.

npm install then pod install respectively arch -x86_64 pod install since I am also running on M1.

Since it might have to do something with that as well I would also disable arm64 in xcode your projects target build phases under build settings "excluded architectures" and only install pods with arch -x86_64 pod install .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM