react-native: When new Xcode build system is used, Xcode build fails to download third-party dependencies
Workaround (edit by @hramos)
You may work around this by manually installing third party dependencies into your project. The following steps are based on the workaround provided by @lyon007 in #14382.
rm -rf node_modules/ && yarn cache clean && yarn install
andrm -rf ~/.rncache
cd node_modules/react-native/scripts
./ios-install-third-party.sh
If your network is slow, you can download the packages separately and move them to therncache
folder 1. folly-2016.10.31.00 2. double-conversion-1.1.5 3. glog-0.3.5 4. boost_1_63_0cd <Your-Project-Folder>/node_modules/react-native/third-party/glog-0.3.5
../../scripts/ios-configure-glog.sh
- Xcode Clean & Build
Original issue
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: x64 Intel® Core™ i7-4870HQ CPU @ 2.50GHz Memory: 103.23 MB / 4.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node npm: 6.4.0 - ~/.nvm/versions/node/v10.9.0/bin/npm SDKs: iOS SDK: Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0 IDEs: Xcode: 10.0/10L221o - /usr/bin/xcodebuild npmPackages: react: 16.4.1 => 16.4.1 react-native: 0.56.0 => 0.56.0 npmGlobalPackages: react-native-cli: 2.0.1
Description
First build request after yarn or npm install does not succeed due to apparent timing of download, extract, and compile actions. Subsequent builds succeed until node_modules removed and yarn or npm install run again.
Similar to this closed issue: https://github.com/facebook/react-native/issues/18982
This is not a problem in the local development environment as the work around is to simply rerun the build command. However, with remote build environments (Buddybuild, App Center, etc) this becomes problematic.
Reproducible Demo
Follow these steps:
0 - configure environment as per react-native info above 1 - from shell - react-native init DoubleTrouble 2 - from shell - cd DoubleTrouble 3 - from shell - react-native run-ios
Here is the tail end of output I received:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/mcclen/Developer/DoubleTrouble/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/strtod.o /Users/mcclen/Developer/DoubleTrouble/node_modules/react-native/third-party/double-conversion-1.1.5/src/strtod.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/DoubleTrouble.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22): Failed to install the requested application The bundle identifier of the application could not be determined. Ensure that the application’s Info.plist contains a value for CFBundleIdentifier. Print: Entry, “:CFBundleIdentifier”, Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DoubleTrouble.app/Info.plist Print: Entry, “:CFBundleIdentifier”, Does Not Exist
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 83
- Comments: 131 (29 by maintainers)
Commits related to this issue
- Workaround to make yarn ios work with Xcode 10 It seems the issue is that Xcode is not automatically downloading required dependencies, so this adds a preios step to download them before trying to bu... — committed to wordpress-mobile/gutenberg-mobile by koke 6 years ago
- fix "xcodebuild" command but it exited @https://github.com/facebook/react-native/issues/20774#issuecomment-422607019 — committed to HanzoD/GitHub_Advanced by deleted user 5 years ago
- Fix Xcode 10 errors relating to third-party (#21458) Summary: Fixes #20774 The new Xcode build system uses parallel execution to run build steps that don't have an obvious dependency. Our Xcode pro... — committed to microsoft/react-native-macos by mmccartney 6 years ago
Ok, I think I have a temporary fix to get React Native to work with Xcode 10—change the shared project settings (or shared workspace settings if you’re also using Cocoapods) to use the “Legacy Build System”. File->Project/Workspace Settings->Build System: Legacy Build System.
It’s (not really) surprising that Facebook hasn’t fixed this in the months that have passed since WWDC18. Good luck, everyone.
EDIT: This issue didn’t always happen in Xcode on the Mac. It regularly failed when I pushed to a CI system like BuddyBuild.
We ran into the same problem and fixed it by adding this as a
postinstall
step to our package.json:This will run the script in the correct directory which will make it pass later in the build process.
Workaround in OP worked for me but with some little adjustments in steps 2 and 3: 2.
cd node_modules/react-native
3../scripts/ios-install-third-party.sh
Oherwise, it would create the
third-party
folder insidescripts
folder, not inreact-native
(which is the right one).Also, I had to follow this to correctly link to
libfishhook.a
file in RCTWebSocket library.And a final thing (couldn’t verify this is required, maybe my dependencies were outdated) was running a
pod install
insideios
folder to update dependencies.Here is what worked for me:
For anyone else struggling with this issue, I’ve written a script and posted it to a gist which makes this a one-line fix:
I run this after
npm install
to fix up the third party folder automatically.I’m giving up on trying to get Xcode 10 to work…third party dependencies (double-conversion…) cause build errors on BuddyBuild. This seems to be a recurring theme with these massively-dependent open source platforms. 😑
@dale-french In bitrise I have a bash script that uses the code that fiznool created in his gist.
I run it after installing all
node_modules
but before building the archive.OMG! I found the solution:
Fix issue with gawk depending on a bad readline. It causes
Solution:
Xcode build fails to download third-party dependencies
I ran into a similar problem using Jenkins and Xcode 10. Here is what I noticed
With this new information, I have a workaround. I run the node_modules/react-native/scripts/ios-install-third-party.sh script immediately after npm install on our build machine.
This way, the third party folder and all it’s subfolders are downloaded and ready when we begin compiling the Xcode project which happens a few minutes later since we have to compile react-native bundle in between
I’m also experiencing this. I have tried many of the posts with high upvotes on this issue (https://github.com/facebook/react-native/issues/14382) and have still not reached a solution. Going to try re-install old XCode version and copy iOS 12 support files from beta.
EDIT: Downgrading fully resolved. Download both XCode 10 and XCode 9.4.1 from here (https://developer.apple.com/download/more/) and follow instructions here (https://stackoverflow.com/questions/51215836/ios-12-not-supported-by-xcode-9-4-could-not-locate-device-support-files)
Yes. For both 0.56.1 and 0.57.1 that gets me around the error. I modified it a bit:
Clearly, if you’re using the Heinz 57 variety, you want the
glog-0.3.5
directory.This appears to be solved in 0.57.8, based on comments in the thread and lack of activity since that version was released.
If I am wrong, let me know and I can re-open.
I understand your point @hramos. But sometimes when we introduce projects with clients and their requirements, we always cross our fingers with
React-native
that we told the client that yes we can make a video player with these above features or we can make a push notification type apps. But when we are going to build the app, then only we know the fact that we are fully dependent on third-party libraries. And at that time we can’t deliver the app in correct time.Even just because we can’t be sure about that with RN what’s the limitations in some areas, we lose a project and it goes to native development.
If we can’t take projects then we can’t make RN useful.
FWIW, I just upgraded a rather complicated old React Native project to
0.57.0
and set it up using CocoaPods and everything builds fine with Xcode 10. See below for my environment details…I encountered a lot of problems surrounding this issue after upgrading my react-native to the latest version. In the end for me the issue was solved by fixing the path of
glogs
in theios-install-third-party.sh
script to:"\"../../$SCRIPTDIR/ios-configure-glog.sh\""
In the original file the path is
"\"$SCRIPTDIR/ios-configure-glog.sh\""
, causing an error during running of the script, and later also errors of'glog/logging.h' file not found
later on; Presumably because the files are not findable by the other third-party libraries, as those are installed without the glog configuration script having ran.So after running npm/yarn, change the
ios-install-third-party.sh
script, then run it while in thenode_modules/react-native
directory. Xcode is on the new build system, changing it did not do anything for me so I left it on the new.Hope this helps others, I spent quite some hours working my way through this. If someone has any idea of what the underlying issue might be, please inform us all. I encountered this problem while upgrading my project from an older react-native version, so that may be the cause somehow, at least in my case.
This almost gave me an aneurysm. @laurent22 solution actually worked for me, first time though. I was using Yarn, but same thing pretty much:
rm yarn.lock && rm -rf ios/build/ && rm -rf node_modules/ && yarn install && react-native run-ios
Might be worthwhile just checking to see if most of that is unnecessary. Maybe just deleting the ios/build folder would fix it. Not sure though.
Xcode 10.0.x, on macOS 10.13 (High Sierra)
I had the same issue like this: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Release-iphonesimulator/MyCool.app/Info.plist Print: Entry, “:CFBundleIdentifier”, Does Not Exist…
I found a quick and very simple solution for myself, hope it will help others!
Try this:
react-native init projectname cd projectname react-native start (this does the trick, leave this running in terminal) …then, in a new terminal: cd projectname react-native run-ios
It will take a while, don’t do ctrl-c, the project will build!
😃
did not work for me, building on Bitrise. upgrading to
0.57
isn’t an option for my team.“full” output:
My workaround was working until Friday. No idea what happened but it’s not working anymore.
The “manual” workaround isn’t working either.
This is a major show stopper for our team.
@nbokmans fair enough, but then none of workarounds suggested is a solution. Some work for some, others don’t. This has to be fixed in the react-native build system.
This worked for me
https://github.com/facebook/react-native/issues/21168#issuecomment-422431294
@hramos
Do you have any timeline when React native will be fully supporting xcode 10? Lots off issues are happening. Clients are just waiting for apps to be shipped and we are sitting fingers crossed to get updates 😦
Only viable solution that persists across ci builds seems to be using legacy build system
same issue in Xcode 10
I am facing a little different issue
when i run ./ios-install-third-party.sh Unpacking /Users/shayana/Library/Caches/com.facebook.ReactNativeBuild/glog-0.3.5.tar.gz… ./ios-install-third-party.sh: line 66: ./ios-configure-glog.sh: No such file or directory Unpacking /Users/shayana/Library/Caches/com.facebook.ReactNativeBuild/double-conversion-1.1.6.tar.gz… Unpacking /Users/shayana/Library/Caches/com.facebook.ReactNativeBuild/boost_1_63_0.tar.gz…
Still I ran cd <Your-Project-Folder>/node_modules/react-native/scripts/third-party/glog-0.3.5 instead of cd <Your-Project-Folder>/node_modules/react-native/third-party/glog-0.3.5
But still same issue.
[RN 0.59.4 / Xcode 10.2] I am using cocoapods. If I use legacy build system, Xcode builds target ‘React’ first and other library Later. Build is success. But if i use new build system, Xcode builds third-party-library first instead of ‘React’. Build error message is ‘React/RCT~Module.h’ file not found in library’s .m file…
And If i use Xcode 10.1, Using new build system is fine. Build is success… How can i set build target Order?
I’m having this issue on RN 0.59.1. This happens after running
react-native run-ios
from a freshly initialized project.It appears that the
scripts/ios-install-third-party.sh
script is failing on MacOS.The version of shasum is
6.01
and seems to be missing an option for thep
flag.So I removed the
-p
fromif shasum -p "$cachedir/$file" |
on line 35 ofscripts/ios-install-third-party.sh
. Then I ran the script again.I ran into the problem.
This is due to
ios-configure-glog.sh
being ran in the wrong directory. So I went intothird-party/glog-0.3.5
and ran../../scripts/ios-configure-glog.sh
.After all this, I was finally able to build and run the project in xcode.
IT IS STILL NOT WORKING ON REACT-NATIVE 0.59.1
Looks like @kelset is on top of it - he mentions he’ll try to include @mmccartney’s fix in
0.57.5
: https://github.com/react-native-community/react-native-releases/issues/54#issuecomment-436273232@geminiyellow the original script I posted only worked for RN 0.57, I’ve updated it now and it should work with other (older) versions too, for example 0.55.4 which is used by the create-react-native-web-app generator.
@ujwal-setlur Changing back to legacy build system is not an option for people who rely on Fastlane or other automatic build tools which don’t care about your XCode settings. It’s not a solution.
OP: https://github.com/facebook/react-native/issues/19529#issuecomment-427217974
I wrote something a bit cleaner for my purposes and installed the fix within the node_modules/react-native package. Normally I would prefer not to modify a node_module directly, but under this circumsance I felt that it was worth it and allowed us to add a simple script in our yarn start script and we get a clean run from a fresh clone in multiple products.
“react-native-vector-icons”: “4.5.0” this script can be useful for a bug relating to this package.
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
glog-0.3.4
cd node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd glog-0.3.4 && ./configure && cd ../../../../
glog-0.3.5
cd node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd glog-0.3.5 && ./configure && cd ../../../../
manual
npm install
oryarn
- install packagescd node_modules/react-native
- go to node modules directoryscripts/ios-install-third-party.sh
- install @ node_modules/react-native/third-partycd third-party
- go to newly created third party directorycd glog-0.3.x
-ls -la
to find your directory version number or just use tab to auto-complete./configure
- run setupcd ../../../../
- change back to your project directoryreact-native run-ios
orreact-native run-android
- deployI got this error while archiving. Did everything mentioned… but nothing worked. The error was at signalhandler.cc > GetPC method.
replaced return (void*)context->PC_FROM_UCONTEXT; with return NULL;
I’m still seeing issues with XCode 10’s new build system on
react-native@0.58.3
, the latest. I get build errors regarding third-party when trying toreact-native run-ios
.The workaround where you can manually pre-compile glog doesn’t seem to work anymore. I get the error “Call to unavailable function ‘system’: not available on iOS” when trying to compile glog, even after using the
ios-configure-glog.sh
script.For me, disabling the new build system in favor of the legacy system still works as a workaround.
For those using automatic/command-line build tools (i.e. fastlane, ci), attach to
-UseModernBuildSystem=NO
or-UseModernBuildSystem=N
to thexcodebuild
command to switch to the Legacy Build System.https://github.com/facebook/react-native/issues/19573 https://github.com/facebook/react-native/issues/20492#issuecomment-423181560
What did the trick for me, close Xcode and then:
$ rm -rf node_modules $ yarn install $ cd node_modules/react_native/scripts $ ./ios-install-third-party.sh $ cd /third-party/glog* $ sudo ./configure
I was able to use the workaround suggested by @NNaidoo, however replacing the “./configure” part with the following:
…/…/scripts/ios-configure-glog.sh
My post tracking Xcode 10 related issues was created on June 5, the day of the WWDC 2018 Keynote: https://github.com/facebook/react-native/issues/19573, by the way. That’s still a year too late, as the new build system was introduced during WWDC 2017, but it’s hardly a new issue in this tracker. As the developer tooling is updated every year, we depend on volunteers using the betas to surface any issues and fixes in time for the general release.
I failed to note that between the initial report of the issue and now I have upgraded to 0.57.0 and that did not solve the problem. I’ve also upgrade node and npm and that has not resolved the issue either. So far for me it is the Legacy Build System setting that seems to fix the build issue. Makes sense as I had no problem with Xcode 9.4.1.
My question now is what is the difference between the two build systems and is the difference material?
Same issue here. Any update?
I’m still encountering this issue as of 0.59.3 after following the React Native CLI getting started on macOS and iOS latest version of Xcode
Hello @hiepnm 👋!
By using the repro / the list of steps to reproduce, we can’t actually see the reported bug on RN 0.59 so we’ll close this issue. It may have something to do with your local setup, please double check that you are using the correct version of Android Studio / XCode / Android NDK / Yarn / etc.
Reference issue for XC10 support https://github.com/facebook/react-native/issues/19573
@hramos I think this issue should be updated here as well https://github.com/facebook/react-native/issues/19573
Including navigation, maps, and video players in the core library is a non-goal. We’re working on slimming down the core library in order to increase stability. See https://github.com/react-native-community/discussions-and-proposals/issues/6.
The new version is working in both platform ios and android. Please check the version I have in my project react native 0.57.8.
But it breaking in old react-native version (for my case 0.54.4). I am facing build issue of third-party and some double conversion errors and it’s breaking the project.
When specific version downloading with
react-native init projectname --version 0.54.4
its breaking in xcode build and giving double conversion and all thirdparty error after fixing all those it’s giving error incxxreact
so basically I have wasted three working days with it and fade up with it.Client is waiting for the update and it’s being very difficult for us to always maintain the deadlines with react native. It’s need to be stable in some point.
Giving a example that when react-native working with it’s new update but some thirdparty dependencies gives error and we can’t blame react-native team for the thirdparty library errors.
But Why not react native includes some basic feature within it’s library and not dependent on others. Like: react-native-image-picker, vectoricons, navigation, drawer, device info, image zooming, maps, video players, file access system. It will be good to see react-native just like full bootstrap with UI and functionality.
I am using it from when 2015 and faced many update breaks everytime. In future, I am planing to upload own apps build in RN with many cool things but if it’s not stable at the point it’s tough to manage all the projects.
React Native Environment Info:
@hramos
Deleted my repo and cloned a fresh copy. Installed dependencies with
yarn
and thethird-party
errors appeared when trying to archive.Deleted my repo and cloned a fresh copy. Installed dependencies with
npm install
and thethird-party
errors did not appear when trying to archive.I believe there could be something with
yarn
not installing all the necessary dependencies either in the right order, or not running everything it needs to which then leads to this issue.I’m also using the legacy build option as i’m running an older version of React Native so i’m not sure if that also matters.
^0.55.4
to be exact.this workaround worked for me 1-
cd ios
2-pod install
For me the solution was to delete all cache, build and lock files:
Then the first call to
react-native run-ios
fails, but by running it a second time it works.Yeah the docs should be up to date 😃 If not, can you open an issue on the website repo so that we can work it out?
My understanding is that the fix will only work for new projects - for existing projects probably the only ways are:
Can anyone try and comment here?
@hramos , still getting Xcode 10 errors on react-native 0.57.5
The release process is coordinated in the https://github.com/react-native-community/react-native-releases repository. https://github.com/react-native-community/react-native-releases/issues/54 looks like a good issue to discuss adding this to a
0.57.5
release.Update, I had added this
cd node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd glog-0.3.4 && ./configure && cd ../../../../
workaround to mypostinstall
.That worked fine until I attempted to build in
Release
mode, this commands breaks something in third-part library build related.This discussion helped me https://github.com/facebook/react-native/issues/19839#issuecomment-422381866
Update, what solved for us was:
Running the postinstall script to unpack and configure the third party packages and using the new build system also works for me. In fact, I have switched to that workaround.
iOS Build Issues?
Try these:
Also do this:
Close Xcode.
Open Terminal, go to your project’s root folder and do:
cd node_modules/react-native/third-party/glog-0.3.4/
Then, run the configure script:
./configure
Fix reference to libfishhook.a in RCTWebSocket: https://github.com/facebook/react-native/issues/19569#issuecomment-394869470
Still not working? Try this: https://github.com/facebook/react-native/issues/21168#issuecomment-422525950
Android problems? Try these:
There’s no single fix that will provide full support for Xcode 10. We are tracking all known issues so far in https://github.com/facebook/react-native/issues/19573. For each of those, the community will need to provide a pull request with a fix. Ideally, we’d get PRs to fix all of these in time for the 0.58 release cut.
If you’re blocked by Xcode 10 issues, the best course of action is to make sure the issue is logged in https://github.com/facebook/react-native/issues/19573, followed by sending a PR to fix the issue.
I have
create-react-native-app
installed, but I did not use it for this project. I usedreact-native init
to create the project and then manually migrated the source files from a much older version of RN.I’m curious if you upgrade from
0.56.0
to0.57.0
, if that will solve your problem without the Legacy Build System workaround.