react-native: 'Multiple commands produce' error when building with new Xcode build system
Hello,
Environment:
React Native Environment Info:
System OS: macOS High Sierra 10.13.6
Binaries:
Node: 8.11.3 - /usr/local/bin/node
npm: 5.6.0 - /usr/local/bin/npm
IDEs:
Xcode: 10 Beta 3
npmPackages:
react: 16.4.1
react-native: 0.56.0
Error:
I got the following error when I try to build the simple RN 0.56 application:
warning: Skipping duplicate build file in Compile Sources build phase: <PATH_TO_PROJECT>/node_modules/react-native/React/Modules/RCTRedBoxExtraDataViewController.m (in target 'React-tvOS')
...
warning: duplicate output file '<HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/React/RCTResizeMode.h' on task: PBXCp <PATH_TO_PROJECT>/node_modules/react-native/Libraries/Image/RCTResizeMode.h <HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/React/RCTResizeMode.h (in target 'React')
...
error: Multiple commands produce '<PbxCp <HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/React/RCTScrollableProtocol.h>':
1) Target 'React-tvOS' has copy command from '<PATH_TO_PROJECT>/node_modules/react-native/React/Views/ScrollView/RCTScrollableProtocol.h' to '<HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/React/RCTScrollableProtocol.h'
2) Target 'React' has copy command from '<PATH_TO_PROJECT>/node_modules/react-native/React/Views/ScrollView/RCTScrollableProtocol.h' to '<HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/React/RCTScrollableProtocol.h'
error: Multiple commands produce '<HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/double-conversion/fast-dtoa.h':
1) Target 'double-conversion-tvOS' has copy command from '<PATH_TO_PROJECT>/node_modules/react-native/third-party/double-conversion-1.1.5/src/fast-dtoa.h' to '<HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/double-conversion/fast-dtoa.h'
2) Target 'double-conversion' has copy command from '<PATH_TO_PROJECT>/node_modules/react-native/third-party/double-conversion-1.1.5/src/fast-dtoa.h' to '<HOME>/Library/Developer/Xcode/DerivedData/ReactNativeSimple-dpupkkuvhsslwxgngxzqgwsrazap/Build/Intermediates.noindex/ArchiveIntermediates/ReactNativeSimple/BuildProductsPath/Release-iphoneos/include/double-conversion/fast-dtoa.h'
...
Repro steps:
- react-native init
xcodebuild -project <PATH_TO_PROJECT>/ios/ReactNativeSimple.xcodeproj -scheme ReactNativeSimple archive -sdk iphoneos -archivePath <PATH_TO_PROJECT>/output/build/archive/ReactNativeSimple CODE_SIGN_STYLE=Automatic
Details:
I tested it on the simple RN application that was created by “react-native init” command. When I try to build the app using Xcode 10 GUI - it builds successfully. But I try to build it using xcodebuild command - it failed with the error above.
When we use the same command on the same application (RN 0.56) in Xcode 9.4.1 - it builds successfully
If I don’t specify -sdk
param in xcodebuild command it builds successfully.
Note: Errors may be different for the different Xcode 10 Beta versions.
Questions:
Does RN 0.56 support Xcode 10 Beta? How I can fix it? Is there workaround to build it using Xcode 10 Beta?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 24
- Comments: 69 (11 by maintainers)
Links to this issue
Commits related to this issue
- Switch to XCode 10 legacy build system https://github.com/facebook/react-native/issues/20492#issuecomment-409599358 — committed to CodingItWrong/react-native-tdd-livestream by CodingItWrong 6 years ago
- fix: Temporarily use legacy build system To prevent ios deployment issue: https://github.com/facebook/react-native/issues/20492#issuecomment-409599358 Issue happened when adding yoga pod (used for re... — committed to rlemasquerier/pet-feeder by rlemasquerier 5 years ago
- [native] Fix up iOS build https://github.com/facebook/react-native/issues/20492#issuecomment-464889327 — committed to CommE2E/comm by Ashoat 5 years ago
- fix: Temporarily use legacy build system To prevent ios deployment issue: https://github.com/facebook/react-native/issues/20492#issuecomment-409599358 Issue happened when adding yoga pod (used for re... — committed to rlemasquerier/pet-feeder by rlemasquerier 5 years ago
You can try to change the build system to Legacy, File > Workspace Settings > Build System > Legacy Build System.
I also had the
Multiple commands produce
error withlibReact.a
&libyoga.a
. I’m using:0.57.0
To overcome this, I have added this to my
Podfile
:Then rebuild your Pods project with:
Full environment details:
We want to use new build system.
Adding to @aerda’s answer, I removed all of the fonts (.tff files) used by react-native-vector-icons from Build Phases > Copy Bundle Resources and my project is now building.
I believe this error in my case was related to updating to XCode 11, but am not positive about that last part.
Confirmed @PaulMest’s workaround works. Manually deleting Yoga in Xcode, from the
Pods
project’s Targets should work too, as I’ve been doing with React which has been causing duplicate targets build errors as well, before RN 0.57.If you are using
xcodebuild
, append this-UseModernBuildSystem=NO
to opt into the old legacy build systemI ran into this as well with detox. I fixed it by specifying a destination in xcodebuild instead of the sdk:
-destination 'platform=iOS Simulator,name=iPhone 7'
I confirm the same with fonts being duplicate, only after upgrade to Xcode 11 stable today (Mac 10.14.6). Removing fonts under the
[CP] Copy Pods Resources
section of Xcode’s Build Phases and build works again.Was and is using New build system. On RN 0.60.5.
My Podfile post_install looked like this:
Following the suggestion from @PaulMest worked for me.
For me work removing duplicated resources in inside
I’ve been using the new build system since 58 with no issues.
I did have
Multiple commands produce *
issues like the above but this was due to leftovers from before I switched to Pods (linking); make sure you remove all React Native relatedLinked Frameworks and Libraries
from your Xcode project (not the generated workspace) if you’re now using Pods.After you’ve cleaned it up and switched to using RN via Pods it should look something like this:
And NOT like this:
Note that the old build system ignored these duplications from trying to use RN via linking & pods together; the new build system does not; so you may have had these for some time.
If you’re building with
xcodebuild
e.g. for Detox make sure to apply @aaronjensen 's suggestion from above to your build command.@ntomallen I’ve ran into the exact same issue with duplicate fonts from
react-native-vector-icons
andnative-base
and what I ended up doing was removing the duplicate from my target app’sCopy Resources To Bundle
section. After this, my project worked again (well, it moved to two different errors, which are described here: libfishhook.a can not be found - fix and Multiple commands produce error with libReact.a & libyoga.a. - fixSo far, my app has been running fine & I can compile using XCode 10’s new build system.
Disclaimer: I am not an experienced iOS developer and hacked these solutions together. I do not know if I have messed something up I don’t know about.
@cpojer IMHO this isn’t solved if the solution requires manual steps after creating a simple project with
react-native init
. This is not what new users will expect. The default should just work without any changes in Xcode and without CocoaPods. (Although CocoaPods is great and works fine with RN 😏)As explained before, I created a sample app with
react-native init
and run this on Travis CI. This shows well that the build works fine with Xcode 9 and Xcode 10 with the legacy build system. And it doesn’t work with the Xcode 10 new build system.You can see the build history here on GitHub, the master is already 0.59.0-rc.1 and has still the same problem.
The build history for different branches is available on Travis CI (master is Xcode 9 and there are two branches for Xcode 10) and as GitHub Pull Request
As said. IMHO. 😏
same here with 0.61.0-rc.3 and xcode 11 11A420a mojave 10.14.6
@hramos I am running into it when I run a build with detox, not
yarn ios
. Here is my config for my iOS simulator:Specifically, if I run this:
xcodebuild -project ios/reactipay.xcodeproj -scheme reactipay -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build
it fails with the original error.@Salakar Removing all the RCT* libraries from the
Linked Frameworks and Libraries
in Xcode project builds successfully in iOS but gives theNative module cannot be null
error. And only after i add thelibReact.a
and otherlibRCT*.a
libraries the build works. We are usingPods
to manage other dependencies.Below is how our Podfile looks,
Also adding the libs in the
Linked Frameworks and Libraries
creates duplicate symbols errors in AppCenter.@hramos Unfortunately not. For me the Xcode legacy build option is still required with 0.57.8 and also with the new 0.58.0-rc.3 (edit: also with 0.58.3).
To make this reproducible, I create a fresh new project and test it locally and with travis CI. I linked the original project below (but its just created with react-native init) and the successful and broken builds on travis. Maybe this helps? At least I could and will re-run this experiment when there is a new version available.
With Xcode 9 the build works fine. Source travis.yml Successful travis build
But with Xcode 10 the build fails. PR which show the travis.yml diff Build with "Multiple commands produce " error
When using Xcode 10 with the legacy build system it works again. PR which show the travis.yml diff Successful travis build
The new build system should be supported. We’re tracking any issues people run into with Xcode 10 or the new build system in this task: https://github.com/facebook/react-native/issues/19573
At a glance, it does not seem like your issue is covered by what we’ve fixed so far on master. I’ll add it to the list.
great work
rm -rf Pods; pod install
worked for meHopefully my situation can help you guys fix the issue!
Here is the full output:
Essentially,
react-native-vector-icons
andnative-base
both bundle the same font files. (And for some reason we also have one of them bundled ourselves; I’ll be sure to remove that one.) Before updating to Xcode 10 / Mojave, there was no issue. The only change was to update from Xcode 9 to Xcode 10.In Xcode, right click all of the things which reference React Native(usually under Frameworks or Libraries in the sidebar), and choose to “remove references”. At the end of the process, make sure the Linked Libraries and Frameworks section doesn’t have references to React Native. Note that as you do this, your other 3rd party libraries which depend on React Native should be linked through Pods as well. (Most of the major ones support it, which is nice.)
But when I execute
pod install
command next time, this entries will appear again 😂️Sure, what you have looks pretty much like what we’re using.
@ntomallen Basically it’s because there is a new, “stricter” build system, and XCode 10 uses it by default whereas in XCode 9 you had to actively choose to use it rather than the “legacy” build system which we’ve all been using until now.
@fungilation the same with me (Xcode 11 - upgraded today, new build system and RN 0.60.5). I have to removed all font under
Copy Bundle Resources
and it works.@MakhouT They do not conflict. In fact, if you have a look at the
react-native-navigation
repo you’ll see there is a podspec file. I’m using RNN with cocoapods in a project now.Given @Salakar’s comment
It appears I did not clean up linked frameworks and libraries correctly when I switched to start using Pods. Can anyone provide more detail on the correct process go about removing those links?
@salakar Ive been doing the same with no issues. One thing to note is that if you manually linked a 3rd party Libray without pods, it may have trouble finding React Native. Basically try to switch everything to Pods.
I very confused with this error as it doesn’t seem consistent. if I run build command 10 time, it could eventually start working this is how looks mu e2e script
where is detox build is
I can’t use legacy build system as it hangs on react build, and I don’t use Cocoa Pods. What other solutions could be? Shall I migrate my iOS to Cocoa? What implications it would bring?
For newbies like me: you need to edit the file
<PROJECT_FOLDER>/ios/<PROJECT_NAME>.xcodeproj/project.pbxproj
Then comment out the font lines (files ending in .ttf) like this:
inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-drawer2/Pods-drawer2-resources.sh", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Feather.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Foundation.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf", // "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf", ); name = "[CP] Copy Pods Resources"; outputPaths = ( // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Feather.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Brands.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Regular.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Solid.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Fontisto.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Foundation.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Ionicons.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialCommunityIcons.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialIcons.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf", // "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf", );
And I had to redo this process every time I ran
pod install
this is what I added to my podfile:
delete previous pods install pod then run update pod it will work.
your solution worked for me, tanks.
@jerolimov your build is not specifying a destination, which appears to be essential as it otherwise attempts to build artifacts for both tvOS and iOS, which causes the issue you’re seeing.
What isn’t clear is if there’s something that RN can be doing that could cause the new build system to know which you want implicitly or if this is actually just a bug in xcode (in which case this is the wrong repo for the issue).
I have no issue generally with Xcode since 0.57.8
This works for me. Man it took me too long to find this. Thanks.
You have to be more specific. Xcode 10 builds and archives fine for me (after solving some errors I don’t remember now), on MacOS 10.12.6 and RN 0.57.0.
Xcode 10.1 Seems to be building fine on both systems but I can’t archive on either, many build errors. What to do now?