react-native
react-native copied to clipboard
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
same for me!
same for me too
Could you try the following commands, from your app root:
-
cd ios
-
rm -rf Pods Podfile.lock <your_app_name>.xcworkspace build
-
bundle install
(if you haven't already run this) -
bundle exec pod install
-
cd ..
-
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.
Already tried, but It's not working
same problem 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.
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?
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 thennpx 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
(asnpx react-native run-ios
)
@cipolleschi I've resolved it:
According to Firebase docs:
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 ;)
Hello, I am having the same issue with my app. It was running before, but now I want to work on a V2 and it just won't build. It's the same error. Tried all of the above-mentioned solutions and none of them worked.
Can anyone please help me find a solution?
@michaelkozah Hi there! Please share your Podfile
require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'SmartLand' do config = use_native_modules!
use_frameworks! :linkage => :static
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change false
to true
and then install pods
:hermes_enabled => false
)
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider'
target 'SmartLandTests' do inherit! :complete # Pods for testing end
Enables Flipper.
Note that if you have use_frameworks! enabled, Flipper will not work and
you should disable the next line.
use_flipper!()
post_install do |installer| react_native_post_install(installer) end end
I even got the code where it was running (V1) and I tried running it once again and it still didn't work
- can you show your exact error?
- how are you installing the cocoapods?
- make sure to disable flipper (comment out
use_flipper!()
)
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 ❤️
any solution?? same error react-native: v0.70.6
facing the same issue with react-native 0.70.5
0.71.1 same issue
//fix which works for me: in AppDelegate.mm i've changed #import "ReactNativeConfig.h" into #import "RNCConfig.h"
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
@Melwin2317 what is the error that you are facing?
The snippet you pasted are just compile instructions with no errors. For example:
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
=> is the command -
/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
=> is the path to the object that needs to be generated by the compiler -
/Users/donamstechlabs/Development/vidhyadhan-mobile-app/node_modules/react-native-pager-view/ios/ReactNativePageView.m
=> it's the file that needs to be build -
normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
are compiler flags -
(in target 'react-native-pager-view' from project 'Pods')
=> the target that contains the file.
So, I can't see any error here... :(
@cipolleschi
** BUILD FAILED **
The following build commands failed:
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')
(1 failure)
This is the error. The following build command failed.
I am getting the below error in Xcode for the same project
This is the error. The following build command failed.
That's what happened, but not why! 😉 The error is why it has happened.
In your case, the error is that react-native-video
is importing non-modular headers inside some framework modules.
Could you copy and paste your Podfile, please? Also, which command do you run to install your pods?
@cipolleschi
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
pod 'RNFS', :path => '../node_modules/react-native-fs' # added by developer
$RNFirebaseAsStaticFramework = true
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
target 'vidhyadhan' do
config = use_native_modules!
use_frameworks! # added by developer
use_frameworks! :linkage => :static # 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
flags = get_default_flags() # Flags change depending on the env values.
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => true,
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# :flipper_configuration => FlipperConfiguration.enabled, needed commented by developer
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'vidhyadhanTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
react_native_post_install(
installer,
# Set `mac_catalyst_enabled` to `true` in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
command to install pod:
cd ios && pod install
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.
@cipolleschi oh man, you are a life saver. it worked well. I am really happy today.I had been working on this problem for over a week and was starting to lose hope.I had considered starting a new project from scratch by copying and pasting code from the current project. Anyway,now I don't need to do that. Thank you so much for helping me. You just made my day.
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.
@cipolleschi Hi! I also try this for my packages like
pod 'react-native-nfc-manager', :path => '../node_modules/react-native-nfc-manager' pod 'react-native-camera', :path => '../node_modules/react-native-camera'
but its giving this kind of error in target 'react-native-nfc-manager-framework' from project 'Pods in target 'react-native-camera-framework' from project 'Pods
Hi @adilijaz! On which version of react native are you?
For some time now, we have autolinking. This means that you should remove those lines
-pod 'react-native-nfc-manager', :path => '../node_modules/react-native-nfc-manager'
-pod 'react-native-camera', :path => '../node_modules/react-native-camera'
and install these dependencies using
yarn add react-native-nfc-manager react-native-camera
CLI autolinking will take care of adding the pod xxx
instruction with the right path for you.
Also, you should give a little bit more information about the error... can you add a screenshot or a more detailed description of your errors?
@cipolleschi I've resolved it:
According to Firebase docs:
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 ;)
Thanks you save my days it working fine