Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When new Xcode build system is used, Xcode build fails to download third-party dependencies #20774

Closed
3 tasks done
mcclen opened this issue Aug 21, 2018 · 131 comments
Closed
3 tasks done
Labels
Bug 📮Known Issues This indicates an issue that refers to a bug or limitation of RN that is not currently being handled Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@mcclen
Copy link

mcclen commented Aug 21, 2018

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.

  1. rm -rf node_modules/ && yarn cache clean && yarn install and rm -rf ~/.rncache
  2. cd node_modules/react-native/scripts
  3. ./ios-install-third-party.sh
    If your network is slow, you can download the packages separately and move them to the rncache folder
    1. folly-2016.10.31.00
    2. double-conversion-1.1.5
    3. glog-0.3.5
    4. boost_1_63_0
  4. cd <Your-Project-Folder>/node_modules/react-native/third-party/glog-0.3.5
  5. ../../scripts/ios-configure-glog.sh
  6. Xcode Clean & Build

Original issue

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) 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:
#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

@react-native-bot react-native-bot added the Platform: iOS iOS applications. label Aug 21, 2018
@rodrigopk

This comment has been minimized.

@mcclen
Copy link
Author

mcclen commented Sep 14, 2018

Still having trouble with this - using the example app on BuddyBuild and cannot get past the third-party libraries (for example double conversion). Note this also happens locally, but in that case I have the option of running the command again and the build succeeds.

Here's a portion of the log from BB:

▸ Running Phase Script 'Install Third Party'
  » curl: Saved to filename 'double-conversion-1.1.6.tar.gz'
  ▸ Compiling strtod.c
  ✗ Build input file cannot be found: 'node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'
  ▸ Compiling fast-dtoa.c
  ✗ Build input file cannot be found: 'node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc'
  ▸ Compiling fixed-dtoa.c
  ✗ Build input file cannot be found: 'node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc'
  ** BUILD FAILED **

The following build commands failed:

CompileC /tmp/sandbox/5b7e31502b18730001e4d418/bbbuild/Build/Intermediates.noindex/React.build/Release-iphonesimulator/double-conversion.build/Objects-normal/x86_64/strtod.o node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

CompileC /tmp/sandbox/5b7e31502b18730001e4d418/bbbuild/Build/Intermediates.noindex/React.build/Release-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fast-dtoa.o node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

CompileC /tmp/sandbox/5b7e31502b18730001e4d418/bbbuild/Build/Intermediates.noindex/React.build/Release-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fixed-dtoa.o node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

@thefaj

This comment has been minimized.

@mcclen
Copy link
Author

mcclen commented Sep 17, 2018

None. Have to admit some confusion as the reproducible nature would seem to apply to everyone.

I have not had time to dig into it, I suspect that the caching and copying activities for these assets is performed asynchronously with the compile step. Perhaps some sort of synchronization between the activities has broken or doesn't exist.

@thefaj
Copy link

thefaj commented Sep 17, 2018

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. 😑

@simonwang6666

This comment has been minimized.

@prcbass
Copy link

prcbass commented Sep 18, 2018

I'm also experiencing this. I have tried many of the posts with high upvotes on this issue (#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)

@thefaj
Copy link

thefaj commented Sep 19, 2018

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.

@PaulMest
Copy link
Contributor

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...

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
      Memory: 717.64 MB / 32.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v10.9.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
    IDEs:
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0
      react-native: 0.57.0 => 0.57.0
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1

@mcclen
Copy link
Author

mcclen commented Sep 19, 2018 via email

@PaulMest
Copy link
Contributor

I have create-react-native-app installed, but I did not use it for this project. I used react-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 to 0.57.0, if that will solve your problem without the Legacy Build System workaround.

@mcclen
Copy link
Author

mcclen commented Sep 19, 2018 via email

@pedrouid
Copy link

I also tried to upgrade to react-native 0.57.0 but that didnt solve this issue. I ended up downgrading Xcode to 9.4.1 and installing the iOS 12 device support files that you can find on this repo:
https://github.com/Yatko/iOS-device-support-files

@mcclen
Copy link
Author

mcclen commented Sep 19, 2018 via email

@StevenWonder
Copy link

I ran into a similar problem using Jenkins and Xcode 10. Here is what I noticed

  1. Download node modules
  2. Run Xcode build. It downloads the third-party folder and runs compile in parallel resulting in a compile error
  3. Run Xcode build a second time. Since third-party folder is already there Xcode build succeeds
  4. Delete third-party folder
  5. Run Xcode build. Same result as step 2
  6. Run Xcode build again. Same result as step 3.

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

@0ff
Copy link

0ff commented Sep 25, 2018

We ran into the same problem and fixed it by adding this as a postinstall step to our package.json:

cd node_modules/react-native/React/..; exec ./scripts/ios-install-third-party.sh

This will run the script in the correct directory which will make it pass later in the build process.

@xzilja
Copy link
Contributor

xzilja commented Sep 25, 2018

Only viable solution that persists across ci builds seems to be using legacy build system

@hramos hramos added this to the 0.58 RC milestone Sep 25, 2018
@mrfambo
Copy link

mrfambo commented Sep 25, 2018

@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 :(

@hramos
Copy link
Contributor

hramos commented Sep 25, 2018

There's no single fix that will provide full support for Xcode 10. We are tracking all known issues so far in #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 #19573, followed by sending a PR to fix the issue.

@hramos hramos changed the title Build IOS Building demo: double-conversion - Xcode Beta iOS SDK beta When new Xcode build system is used, Xcode build fails to download third-party dependencies Sep 25, 2018
@hramos
Copy link
Contributor

hramos commented Sep 25, 2018

My post tracking Xcode 10 related issues was created on June 5, the day of the WWDC 2018 Keynote: #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.

@geminiyellow
Copy link

use rhdeck/react-native-fix-xcode-10 and link libfishhook.a can make it working, but when i rebuild, crash again.

@willcrisis
Copy link

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 inside scripts folder, not in react-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 inside ios folder to update dependencies.

@michalchudziak
Copy link
Contributor

michalchudziak commented Mar 19, 2019

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 #19573

@kzh
Copy link

kzh commented Mar 22, 2019

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.

Unknown option: p
Type shasum -h for help
Unpacking /Users/kevin/Library/Caches/com.facebook.ReactNativeBuild/glog-0.3.5.tar.gz...
./scripts/ios-install-third-party.sh: line 64: ./scripts/ios-configure-glog.sh: No such file or directory
Unknown option: p
Type shasum -h for help
Unpacking /Users/kevin/Library/Caches/com.facebook.ReactNativeBuild/double-conversion-1.1.6.tar.gz...
Unknown option: p
Type shasum -h for help
Unpacking /Users/kevin/Library/Caches/com.facebook.ReactNativeBuild/boost_1_63_0.tar.gz...
boost_1_63_0/boost/log/detail/format.hpp: (Empty error message)
tar: Error exit delayed from previous errors.
Unpacking '/Users/kevin/Library/Caches/com.facebook.ReactNativeBuild/boost_1_63_0.tar.gz' failed. Debug info:
-rw-r--r--  1 kevin  staff  7049801 Mar 21 21:37 /Users/kevin/Library/Caches/com.facebook.ReactNativeBuild/boost_1_63_0.tar.gz
e57f86fe1b3fc5b54e73a11ea9b29b14c0ee140e  /Users/kevin/Library/Caches/com.facebook.ReactNativeBuild/boost_1_63_0.tar.gz
Unknown option: p
Type shasum -h for help
Unpacking /Users/kevin/Library/Caches/com.facebook.ReactNativeBuild/folly-2018.10.22.00.tar.gz...

The version of shasum is 6.01 and seems to be missing an option for the p flag.

So I removed the -p from if shasum -p "$cachedir/$file" | on line 35 of scripts/ios-install-third-party.sh. Then I ran the script again.

I ran into the problem.

./scripts/ios-install-third-party.sh: line 64: ./scripts/ios-configure-glog.sh: No such file or directory

This is due to ios-configure-glog.sh being ran in the wrong directory. So I went into third-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.

@kzh
Copy link

kzh commented Mar 22, 2019

OK, this seems to be solved in #24036.

@jordmccord
Copy link

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

@drbarto
Copy link

drbarto commented Apr 4, 2019

My very whacky workaround (maybe it helps someone else): when I build the app from scratch in Xcode 10 using react-native 0.59.3, I get the mentioned errors; however, when I first build it in Xcode 9 (9.4.1 to be precise) and then (without clearing the project of course) build it again in Xcode 10.1 it works. Apparently Xcode 9 generates some build artefacts that are reused by Xcode 10. I don't see this as a "solution" of course, it just keeps my project alive 🤕

@jordmccord
Copy link

OMG! I found the solution:

Fix issue with gawk depending on a bad readline.
It causes

dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/bin/awk                                                                                                                                                                                       
  Reason: image not found 

Solution:

brew uninstall gawk
brew uninstall readline
brew install readline
brew install gawk

Xcode build fails to download third-party dependencies

WD=$(pwd)
cd node_modules/react-native
rm -fr third-party
$WD/node_modules/react-native/scripts/ios-install-third-party.sh

This worked for me 🙌

@RoysyLee
Copy link

RoysyLee commented Apr 13, 2019

[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?

@MaheshNandam
Copy link

MaheshNandam commented Apr 13, 2019

RN 0.57.7 and XCode 10.2

  1. if I'm trying to run the app into 12.2 version simulators or devices, then app got crashed with
    Thread 1: signal SIGABRT

    ISSUE LINE -> 0x102eda2f8<+8>: b.lo 0x102eda310 ; <+32>

  2. if I'm trying to run into 12.1 version simulators or devices, it works fine.

  3. With this (RN 0.57.1 and XCode 10.2) configuration, if I generate IPA, it's only working in 12.1 devices and when it comes to 12.2 devices, app getting the crash on the launch screen with Thread 1: signal SIGABRT.

Any suggestions or workarounds to solve this issue?

Thanks for that savior.

@pvinis
Copy link
Contributor

pvinis commented Apr 14, 2019

I don't think anything below 0.59.2 works with Xcode 10.2, bacause of some changes with the load methods.

@oferRounds
Copy link

@0ff thank you! could you explain how to apply your solution please? not sure what to do

@jamesone
Copy link

Is the new xcode build system supported on RN 0.59+? Im using xcode 10.2 and have tried using the new build system but it errors saying there is an issue with my carthage libs.

@ujwal-setlur
Copy link

It works just fine for me, but I don't use any Carthage libraries...

t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
Fixes facebook#20774

The new Xcode build system uses parallel execution to run build steps that don't have an obvious dependency.  Our Xcode project was written with the assumption that the **Install Third Party** build step is run _before_ compiling the `third-party` libraries.  To address this issue, this PR adds dependency information to the project to teach Xcode that `ios-install-third-party.sh` is generating the files under `third-party`.  With this additional information, Xcode correctly waits for `ios-install-third-party.sh` to finish before advancing to the compile step.

In addition to the Xcode project changes, I had to make some changes to the script `ios-install-third-party.sh` so that
1. it would always execute the `ios-configure-glog.sh` script regardless of how it was invoked
2. it would always install the libraries even if Xcode had partially created the tree or if a previous install was interrupted
Pull Request resolved: facebook#21458

Differential Revision: D10365495

Pulled By: hramos

fbshipit-source-id: c88042583f21d2447a16f6ae2b6abb929c659a26
@mpakunderscore
Copy link

clang: error: no such file or directory: '/Users/pavelkuzmin/D/RC/DA/node_modules/react-native/third-party/double-conversion-1.1.6/src/cached-powers.cc'
clang: error: no input files

:(

@iamsumitjangra
Copy link

iamsumitjangra commented Aug 27, 2019

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 /node_modules/react-native/scripts/third-party/glog-0.3.5 instead of cd /node_modules/react-native/third-party/glog-0.3.5

But still same issue.

@Ebeldev
Copy link

Ebeldev commented Sep 26, 2019

I do have the same problem.
I'm on a Mac 10.14
XCode 11.0
react-native-cli: 2.0.1
react-native: 0.60.5

Can't build after basic init from react-native init mytestingapp.

@Ebeldev
Copy link

Ebeldev commented Oct 4, 2019

It finally worked.

What I did is use npx react-native init awesomeproject. And I was able to build the project.

@robertmylne
Copy link

I had to remove the node_modules folder and then run npm install again to get mine working. I tried everything but it didn't work.

@Khushboo-gupta-123
Copy link

when i run my project on terminal for react-native i faced this issuue. is there any solution?
"Failed to build iOS project. We ran "xcodebuild" command but it exited with error code null. To debug build logs further, consider building your app with Xcode.app, by opening demo.xcworkspace "

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 📮Known Issues This indicates an issue that refers to a bug or limitation of RN that is not currently being handled Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.