react-native: Build on IOS failed

Description

I’m trying to build my app on Mac for iOS, when I try to build the app he gives me an error The following build commands failed: CompileC /Users/gbdev/Library/Developer/Xcode/DerivedData/GBWebApp-dgxghrfnprondmbkxeptlzyzcmeu/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-logger.build/Objects-normal/arm64/react_native_log.o /Users/gbdev/Desktop/ProgettiCA/rn-GBAppWeb/node_modules/react-native/ReactCommon/logger/react_native_log.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-logger' from project 'Pods') (1 failure) I have tried to clean cache and everything I can do and find on internet, but nothing of these works.

Version

0.69.3

Output of npx react-native info

System: OS: macOS 12.6 CPU: (8) arm64 Apple M1 Memory: 129.89 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.9.0 - /opt/homebrew/bin/node Yarn: Not Found npm: 8.19.1 - /opt/homebrew/bin/npm Watchman: 2022.09.19.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 14.0/14A309 - /usr/bin/xcodebuild Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: ^0.69.3 => 0.69.5 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

npm run iOS to run iOS app, on building phase he stops and gave me the error I wrote before.

Snack, code example, screenshot, or link to a repository

I don’t have any code to show, it’s not a my code problem

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 28 (7 by maintainers)

Most upvoted comments

@cipolleschi I’ve resolved it:

According to Firebase docs:

image

What I did:

  • cd ios and added to the top in Podfile: use_frameworks! :linkage => :static
  • in Podfile - commented :flipper_configuration => FlipperConfiguration.enabled
  • pod install --repo-update

And it is working for me 😉

Hi there, the same issue for me.

I faced same problem. It appeared after installing Firebase SDK and running pod install (faced error message that I need to use use_modular_headers! in Podfile).

After that I can’t build app.

0.71.1 same issue

//fix which works for me: in AppDelegate.mm i’ve changed #import “ReactNativeConfig.h” into #import “RNCConfig.h”

Could you try the following commands, from your app root:

  1. cd ios
  2. rm -rf Pods Podfile.lock <your_app_name>.xcworkspace build
  3. bundle install (if you haven’t already run this)
  4. bundle exec pod install
  5. cd ..
  6. npx react-native run-ios

The first 2 commands will clean up the dependencies for the iOS project The second 2 will reainstall them (notice that bundle will require you to use Ruby 2.7.5, so you may have to install a ruby version manager and update Ruby… You can read more here) The last two will try to build your app again.

So… as far as I can see, you are using a Cocoapods plugin that allow you to mix Static Frameworks and static libraries.

This is not required anymore. To simplify the setup, please remove the lines:

- use_frameworks!    # added by developer

# ...

- $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
-     'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
-     'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
-     'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']

- pre_install do |installer|
-     Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
-     installer.pod_targets.each do |pod|
-         if $static_framework.include?(pod.name)
-           def pod.build_type;
-             Pod::BuildType.static_library
-           end
-         end
-       end
-  end

Now, there is the react-native-video framework that is causing problems. Let’s try to add the following line:

+ pod 'react-native-video', :path => '../node_modules/react-native-video', :modular_headers => true
target 'vidhyadhanTests' do

I’m not 100% confident that it will work, but it should.

Also, if you can prepare a small repro (new app with just the dependencies that creates this problem) I can investigate better.

Thank you so much.

Any solution for this? I’ve done everything, still nothing. I am getting exact same issue for some packages such as like react-native-nfc-manager,react-native-video.ie (in target ‘react-native-nfc-manager’ from project ‘Pods’),(in target ‘react-native-video’ from project ‘Pods’) for almost every packages in my project. I have tried a lot of things such as reinstalling pod file, deleting derived data, updating Xcode. Still no change. Any help?

CompileC /Users/donamstechlabs/Library/Developer/Xcode/DerivedData/vidhyadhan-fzcswpsqsxtnykavdwzfwdqxtcoc/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-pager-view.build/Objects-normal/arm64/ReactNativePageView.o /Users/donamstechlabs/Development/vidhyadhan-mobile-app/node_modules/react-native-pager-view/ios/ReactNativePageView.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target ‘react-native-pager-view’ from project ‘Pods’)

CompileC /Users/donamstechlabs/Library/Developer/Xcode/DerivedData/vidhyadhan-fzcswpsqsxtnykavdwzfwdqxtcoc/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-nfc-manager.build/Objects-normal/arm64/NfcManager+Felica.o /Users/donamstechlabs/Development/vidhyadhan-mobile-app/node_modules/react-native-nfc-manager/ios/NfcManager+Felica.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target ‘react-native-nfc-manager’ from project ‘Pods’)

CompileC /Users/donamstechlabs/Library/Developer/Xcode/DerivedData/vidhyadhan-fzcswpsqsxtnykavdwzfwdqxtcoc/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-video.build/Objects-normal/arm64/RCTVideo.o /Users/donamstechlabs/Development/vidhyadhan-mobile-app/node_modules/react-native-video/ios/Video/RCTVideo.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target ‘react-native-video’ from project ‘Pods’)

npx react-native info

System: OS: macOS 13.2.1 CPU: (8) arm64 Apple M1 Memory: 68.19 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.6.0 - /opt/homebrew/bin/node Yarn: Not Found npm: 9.4.1 - /opt/homebrew/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /Users/donamstechlabs/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 17.0.6 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.8 => 0.70.8 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Thanks for your support but it turns out to be an error caused RNFirebase. I found out by opening the project.xcworkspace on Xcode and going through what seems to be failing my build. I noticed that the RNFirebase was failing my build so I tried uninstalling it and it worked. My project was up and running again. Anyway, thank you guys for the help and support ❤️

Hi there, I’m looking into the issue. In order to investigate this properly, could you tell me what’s the proper setup?

  • Are you using the New or the Legacy Architecture?
  • Are you using Hermes or JSC as default engine?

I just downloaded the template npx react-native init --version 0.69.3 and then npx react-native run-ios

And it worked fine.

Could you prepare a repro (a github repo would work) with your setup?

Hi there, the same issue for me. I faced same problem. It appeared after installing Firebase SDK and running pod install (faced error message that I need to use use_modular_headers! in Podfile). After that I can’t build app.

@olegtech We know that there are some incompatibilities between RN and Firebase and we are working on trying to solve them. Could you prepare a repro (a github repo would work) with your setup so I can test it out?

@cipolleschi Created a repo: https://github.com/olegtech/pod-issue-repo/tree/main/TestRepo

First of all I’m using version of RN: 0.70.1

What I did:

  • npx react-native init TestRepo
  • cd ./TestRepo/ios && pod install
  • in ios folder - bundle install
  • pod install
  • return to root folder and run yarn add @react-native-firebase/app
  • return to ios folder and run pod install (got an error about use_modular_headers! in Podfile)
  • return to root folder and run yarn ios (as npx react-native run-ios)