facebook/react-native

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

mcclen opened this issue · 131 comments

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

I'm having the same problem when trying to build on Bitrise using Xcode 10.0.x stack.

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
Binaries:
Node: v8.11.3
npm: 6.2.0
SDKs:
iOS SDK:
Platforms: iOS 12.0
IDEs:
Xcode: 10.0/10L221o
npmPackages:
react: 16.4.1
react-native: 0.56.0

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

Same issue here. Any update?

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.

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

same issue in Xcode 10

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)

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.

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

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.

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

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 commented

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.

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

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

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.

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.

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

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.


iOS Build Issues?

Try these:

rm -rf node_modules
npm install

Also do this:

  1. Close Xcode.

  2. Open Terminal, go to your project's root folder and do:
    cd node_modules/react-native/third-party/glog-0.3.4/

  3. Then, run the configure script:
    ./configure

  4. Fix reference to libfishhook.a in RCTWebSocket:
    #19569 (comment)

Still not working?
Try this: #21168 (comment)


Android problems?
Try these:

rm -rf android/.gradle
rm -rf android/build
rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache verify
rm -rf $TMPDIR/haste-map-react-native-packager-*

In fact, you only need to make sure that there is a third-party folder in node_modules/react-native, and that there are four unpacked packages in the third-party.

This worked for me

$ cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../
$ cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../

#21168 (comment)

This worked for me

$ cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../
$ cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../

#21168 (comment)

This does fix it however it breaks my Android build. Now to update my app I first have to do fastlane android beta then execute these commands before I can do fastlane ios beta. If I don't, or if I try to do it in the reverse order (update iOS first and then Android) I get this error:

  • What went wrong:
    Failed to capture snapshot of input files for task ':app:bundleReleaseJsAndAssets' property '$1' during up-to-date check.

Could not list contents of '/Users/niels/james/app/node_modules/react-native/scripts/third-party/glog-0.3.5/test-driver'. Couldn't follow symbolic link.

Not an ideal solution. Needs to be fixed by RN developers.

@nbokmans true
But since i want my app on latest version of React Native, i am installing node_modules twice to build for iOS and Android with above hack

No matter what I do, I haven't been able to get Android to work. Constantly getting:

org.gradle.api.UncheckedIOException: Failed to capture snapshot of input files for task ':app:bundleReleaseJsAndAssets' property '$1' during up-to-date check. Caused by: org.gradle.api.GradleException: Could not list contents of '/Users/.../.../.../.../third-party/glog-0.3.5/test-driver'. Couldn't follow symbolic link.

I have tried cleaning, rm -rf node_modules, running ios-install-third-party.sh. I even found the "missing" symbolic link to be test-driver so I edited autoconf and automake so that I could link it manually. Literally NOTHING is working. Anyone have any other ideas for me?

@zsaraf I've been working around this by removing the symbolic link completely which at least gets the Android build working

No matter what I do, I haven't been able to get Android to work. Constantly getting:

org.gradle.api.UncheckedIOException: Failed to capture snapshot of input files for task ':app:bundleReleaseJsAndAssets' property '$1' during up-to-date check. Caused by: org.gradle.api.GradleException: Could not list contents of '/Users/.../.../.../.../third-party/glog-0.3.5/test-driver'. Couldn't follow symbolic link.

I have tried cleaning, rm -rf node_modules, running ios-install-third-party.sh. I even found the "missing" symbolic link to be test-driver so I edited autoconf and automake so that I could link it manually. Literally NOTHING is working. Anyone have any other ideas for me?

@zsaraf
Did you try these:

rm -rf android/.gradle
rm -rf android/build
rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache verify
rm -rf $TMPDIR/haste-map-react-native-packager-*
rm -rf node_modules
npm cache verify
npm install
rm -rf ~/.rncache
cd node_modules/react-native
./scripts/ios-install-third-party.sh
cd -
cd node_modules/react-native/third-party/glog-0.3.4 # brittle as fudge
./configure
cd -
npm run ios:release

did not work for me, building on Bitrise. upgrading to 0.57 isn't an option for my team.

"full" output:

** BUILD FAILED **
The following build commands failed:
	CompileC /Users/vagrant/git/ios/build/Build/Intermediates.noindex/React.build/Release-iphonesimulator/third-party.build/Objects-normal/i386/signalhandler.o /Users/vagrant/git/node_modules/react-native/third-party/glog-0.3.4/src/signalhandler.cc normal i386 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Release-iphonesimulator/MyCool.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/Release-iphonesimulator/MyCool.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Dropping my Xcode to Legacy Build did the trick for me. Both Android and iOS build fine.

Okay much to the chagrin of my team I convinced them that there were no breaking changes in 0.57 and bumped.

rm -rf node_modules
npm cache verify
npm install
rm -rf ~/.rncache
cd node_modules/react-native
./scripts/ios-install-third-party.sh
cd -
cd node_modules/react-native/third-party/glog-0.3.5
./configure
cd -
npm run ios:release

still results in

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Release-iphonesimulator/MyCool.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

@chaim1221 did you try using the legacy build system in Xcode?

I'd say that would help but I'm trying to build outside of XCode.

screen shot 2018-10-02 at 1 04 35 pm

here's what I get with that. I'm not 100% certain it's related, in fact I think this means it takes care of the CFBundleIdentifier issue.

Nevertheless it has no effect on trying to build from the command line. Running that script in the scripts directory remains the only way to make that work. I am considering adding a post-build step per 0ff.

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.

Yes. For both 0.56.1 and 0.57.1 that gets me around the error. I modified it a bit:

    "postinstall": "cd node_modules/react-native; exec ./scripts/ios-install-third-party.sh; cd third-party/glog-0.3.4; exec ./configure; cd ../../../.."

Clearly, if you're using the Heinz 57 variety, you want the glog-0.3.5 directory.

Yeah, unfortunately, this broke my build for a physical device since glog configure.h is now geared for x86 and not arm. There is yet another workaround for this, but it requires more monkey patching. I just decided to drop back to the legacy build system which works for both simulator and device through Xcode

I have a shell script that runs my build for me. I added this between the npm install and the react-native run-ios :

rn=node_modules/react-native
rn3rdParty=scripts/ios-install-third-party.sh
perl -pi -e 's/^SCRIPTDIR=.*$/SCRIPTDIR=\$(cd \$(dirname "\$0") && pwd)/' ./$rn/$rn3rdParty
(cd ./$rn && ./$rn3rdParty)

It's a workaround but works consistently for me. It's part of my PR but I think the real fix requires some special Xcode build changes.

Hope this helps!

OP: #19529 (comment)

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

Xcode 9.2: "react": "15.4.1" / "react-native": "0.38.1"
Xcode 9.4.1: "react": "16.0.0-alpha.12" / "react-native": "0.53.0"

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

Xcode 9.4.1: react": "16.5.0" / "react-native": "0.57.1" / "metro-react-native-babel-preset": "0.47.0"
Xcode 10: react": "16.5.0" / "react-native": "0.57.1" / "metro-react-native-babel-preset": "0.47.0"

cd node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd glog-0.3.5 && ./configure && cd ../../../../

manual
npm install or yarn - install packages
cd node_modules/react-native - go to node modules directory
scripts/ios-install-third-party.sh- install @ node_modules/react-native/third-party
cd third-party - go to newly created third party directory
cd glog-0.3.x - ls -la to find your directory version number or just use tab to auto-complete
./configure - run setup
cd ../../../../- change back to your project directory
react-native run-ios or react-native run-android - deploy

I also get this issue which started happening after running the solution in #21490, but instead of messing with Xcode or any third party packages, I'll run react-native run-ios again and it works fine.

So, repeating my steps (after removing node_modules folder):

  • yarn install
  • yarn run-ios = react-native run-ios --simulator \"iPhone XS\"
  • Get errors described in original issue
  • yarn run-ios = react-native run-ios --simulator \"iPhone XS\"
  • APP RUNS!

So strange to me, but I have yet to figure out why this work for me.

@mathewmorris, I think this was described as a workaround, if not here, at least somewhere else. Yes, running compile a second time works most of the time since the third party packages would have been downloaded and configured. The first run fails due to Xcode's new build system which I think parallizes things a lot and might not catch the third party packages in time. Reverting to the legacy build system also works.

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

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

@ujwal-setlur Agreed. Just need to let FB take care of it. Expected with all the new things coming out right now.

The original issue mentions a command failing when accessing the app's Info.plist. In the new build system, if you need to access Info.plist in a build script, it must be listed as an input dependency.

I have a script that modifies the app's plist and I had to add Info.plist file as an "input file" for the script's build phase so it would run in the right order (see https://openradar.appspot.com/44422906 for more details):

2018-10-08 at 18 46

I'm still getting errors like "Build input file cannot be found: '/.../myapp/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'" but I wonder if something similar is required.

We have the same problem here, and doesn't seems to be related with the version of the Xcode, because it's failing also in a machine with 9.2

Tested in a Mac with High Sierra
Xcode: 10.0 10A255

And also tested in a Mac with Sierra
Xcode: Version 9.2 (9C40b)

When I run the iOS app I get

** BUILD SUCCEEDED **


Installing build/Build/Products/Debug-iphonesimulator/myapp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/myapp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

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.

There are additional solutions here (apparently this has been cropping up for awhile); one is xcode-related, one is workspace-related. There also seems to be some confusion about where info.plist should land, but I checked info.plist and it does reference CFBundleIdentifier, and the build works sometimes, so I think the error message is just misleading.

works with workaround (described multiple times above):

repo (master ✔) ᐅ xcodebuild -version 
Xcode 10.0
Build version 10A255

and

    "react": "^16.5.2",
    "react-native": "^0.56.1"

react-native-cli: 2.0.1

and Simulator set to iPhone 8, iOS 12.

What wasn't working (until the second I almost pressed "Comment", then a build worked):

Xcode 10.0.x, on macOS 10.13 (High Sierra) on app.bitrise.io

Here's what's installed:

https://github.com/bitrise-io/bitrise.io/blob/master/system_reports/osx-xcode-10.0.x.log

This is so weird.

It's working again, and all I did was put things back the way they were when it was failing.

I was able to use the workaround suggested by @NNaidoo, however replacing the "./configure" part with the following:

../../scripts/ios-configure-glog.sh

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

For those using automatic/command-line build tools (i.e. fastlane, ci), attach to -UseModernBuildSystem=NO or -UseModernBuildSystem=N to the xcodebuild command to switch to the Legacy Build System.

#19573
#20492 (comment)

Update, what solved for us was:

  1. @NNaidoo workaround
  2. Remove the library https://github.com/crazycodeboy/react-native-splash-screen from the ios project.
  3. Ensure the build configuration in the scheme
    image

Here is what worked for me:

$ cd node_modules/react-native
$ scripts/ios-install-third-party.sh
$ cd third-party/glog-0.3.5/
$ ../../scripts/ios-configure-glog.sh

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:

curl -L https://git.io/fix-rn-xcode10 | bash

I run this after npm install to fix up the third party folder automatically.

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!

:-)

#20774 (comment) not work for me.

../../scripts/ios-configure-glog.sh

so funny story as I kept upgrade react-native-cli and trying to stay up to date. I did indeed need to switch back to this script instead of .configure and everything worked on my Travis-ci matrix build just fine. Im on the road right now, but im going to post back my full project info for you guys, which I think is the best latest to work against at the moment.

This setup works with two steps flawlessly. You guys will appreciate my package.json setup, just get me a chance to share it!

clone
yarn start

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

curl -L https://git.io/fix-rn-xcode10 | bash

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

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 #19839 (comment)

Any updates?
Is this going to be fixed soon?

I just checked and although my fix has been merged into the master branch, it has not been released. There was a release 0.57.4 about 12 days ago but it contains older scripts. I'm trying to figure out the release process. CONTRIBUTING says I just need to patch master and then it gets moved into FB's internal repository. How do things go from master to release? Do I need to submit a PR against 0.57-stable also?

The release process is coordinated in the https://github.com/react-native-community/react-native-releases repository. react-native-community/releases#54 looks like a good issue to discuss adding this to a 0.57.5 release.

Looks like @kelset is on top of it - he mentions he'll try to include @mmccartney's fix in 0.57.5:
react-native-community/releases#54 (comment)

good news

@hramos , still getting Xcode 10 errors on react-native 0.57.5

immagine

Similar to @NichAga , seeing same issues as before (after removing node modules, cleaning cached and reinstalling everything with latest versions)

My understanding is that the fix will only work for new projects - for existing projects probably the only ways are:

  1. re-apply the workaround described in the first comment
  2. manually apply the PR to your project - I use Pods on my projects so I was never actually affected, so can't really test this road. Potentially using the git-upgrade command may do it for this. But I don't know tbh 😔

Can anyone try and comment here?

@kelset I will try to apply PR manually in a bit. Also wanted to ask, do you have example / reference to somewhere that shows how to use react as a pod? Sounds like it is more stable / easier way to implement it.

It worked for me on an existing project without the workaround, when upgrading from an earlier version of react native. I had other issues (with jest and flow), but these weren't to do with the build.

Try running the script as described above. I've had success with new and old versions of RN.

@kelset Thank you for the links, so I assume what you meant is that you use React Native through pods like documented here: https://facebook.github.io/react-native/docs/integration-with-existing-apps

And you don't experience any issues with third party scripts? I am refactoring to use pods right now, to check if it solves issues on my end, is this piece of documentation up to date?

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?

@kelset refactored to use CocoaPods, everything is working 👌 with new build. I think I actually prefer this way of using react native.

I got few follow up questions for you if you have a minute?

  1. I removed react related content in XCode from "Libraries" folder, and Build Phases. I edited my schema to use React from pods. Everything is working fine, but any chance I missed something else here?

  2. Previously when I built through XCode, it auto started react native cli which was handy, with pods it doesn't. Is there a way to add cli start script to XCode somehow?

@NichAga @iljadaderko Did you try deleting third-party (as in rm -rf node_modules/react-native/third-party) and then performing the build?

@mmccartney But that would be a temporary solution until package is re-installed right? I tried completely fresh setup with old node_modules deleted prior and it was failing :/ until I switched to CocoaPods approach.

You are right, @iljadaderko. I'm having trouble reproducing the failure consistently but I do believe there is a problem with existing projects. I have a feeling that the following commands will eliminate the problem but I can't be sure at this time:

rm -rf ios/{YourProjectName}.xcodeproj/project.xcworkspace
rm -rf ios/build

This what works for me, I have 2 versions of XCode on my MAC (XCode 9.4.1 & XCode 10.1):

  1. Open XCode 9.4.1 and clean the build
  2. yarn cache clean
  3. yarn install
  4. Build project on XCode (with General iOS Device)
  5. Close XCode 9.4.1 and Open XCode 10.1
  6. Build the project with XCode 10.1
  7. Sometime the build fails, because of libfishhook.a issues.
    7.1 I remove and add libfishhook.a which is located in RCTWebSocket.xcodeproj

It works for me always.

One point to mention, when I am adding a new package (yarn add [packgeName]) the entire process should start over. I prefer to install it when I am using XCode 9.4.1.

Seems to be an issue with XCode 10.1

Delete the folder project
Reinstall it, react-native init rnapp
Open ios project file
Go to file -> project settings -> in build system choose Legacy Build System
Go to console react-native run-ios

That did the trick for me

For me, running pod install inside ios folder is what fixed it

Deleting the node_modules/react-native/third-party folder worked for me 🎉

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.

saved my day. RN 0.57.7, xcode 10.1

Is this expexted to happen on a newly initialized project when using xcode 10.1?

Hmm, with RN-0.57.7 and Xcode 10.1 using the NEW build system, everything just works. I don't need any workarounds. I did have this problem before, so somewhere something got fixed.

For me the solution was to delete all cache, build and lock files:

rm package-lock.json && rm -rf ios/build/ && rm -rf node_modules/ && npm install && react-native run-ios

Then the first call to react-native run-ios fails, but by running it a second time it works.

I have done everything mentioned above but to no success. Is the new build system still not supported in 0.57.5?

jsina commented

this workaround worked for me
1- cd ios
2- pod install

@adiahuja07

I have done everything mentioned above but to no success. Is the new build system still not supported in 0.57.5?

Do you have both third-party/ and third-party-podspecs/ in node_modules/react-native/?

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.

Deleted my repo and cloned a fresh copy. Installed dependencies with yarn and the third-party errors appeared when trying to archive.

Deleted my repo and cloned a fresh copy. Installed dependencies with npm install and the third-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.

@JoshuaKelly 0.55.4 was cut before the Xcode 10 beta became available, and lacks some of the updates we've made related to this issue.

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 in cxxreact 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:

System:
  OS: macOS High Sierra 10.13.6
  CPU: (4) x64 Intel(R) Core(TM) i5-3330S CPU @ 2.70GHz
  Memory: 28.89 MB / 8.00 GB
  Shell: 3.2.57 - /bin/bash

Binaries:
  Node: 8.9.3 - /usr/local/bin/node
  npm: 5.5.1 - /usr/local/bin/npm
  Watchman: 4.9.0 - /usr/local/bin/watchman

SDKs:
  iOS SDK:
    Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1

 Android SDK:
    API Levels: 23, 24, 25, 26, 27, 28
    Build Tools: 23.0.1, 24.0.0, 25.0.0, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3
    System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-26 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom

IDEs:
  Android Studio: 3.0 AI-171.4443003
  Xcode: 10.1/10B61 - /usr/bin/xcodebuild

npmPackages:
  react: 16.6.3 => 16.6.3 
  react-native: 0.57.8 => 0.57.8 

npmGlobalPackages:
  create-react-native-app: 1.0.0
  react-native-cli: 2.0.1
  react-native-create-library: 3.1.2
  react-native-git-upgrade: 0.2.7
  react-native-rename: 2.4.0

@hramos

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 react-native-community/discussions-and-proposals#6.

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.

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.