Skip to content

Problems with glog (config.h missing) and gflags/gflags.h on Xcode 10 #19774

@WesSouza

Description

@WesSouza

Environment

Scanning folders for symlinks in .../node_modules (21ms)

  React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
      Memory: 1.00 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.3.0 - /usr/local/bin/node
      Yarn: 1.7.0 - /usr/local/bin/yarn
      npm: 6.1.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
    IDEs:
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.3.2 => 16.3.2 
      react-native: 0.56.0-rc.2 => 0.56.0-rc.2 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Description

Trying to build the initial React Native project is not working on Xcode 10 on Mojave, tested on two machines and had slightly different issues both while compiling glog.

react-native init TestProject --version="0.56.0-rc.2"
cd TestProject
npm run start
react-native run-ios

Fails because 'config.h' file not found on mutex.h. Manually configuring and making glog from node_modules/react-native/third-party/glog-0.3.4 works, but then fails because 'gflags/gflags.h' file not found.

If I try to compile on Xcode 9.4, it also fails. The only thing that enabled me to build on either was:

  1. rm -rf ~/.rncache/
  2. rm -rf $PROJECT/node_modules/react-native/third-party/
  3. Build on Xcode 9.4, passes. Quit Xcode.
  4. Build on Xcode 10, passes.

It is very unstable though, stops working as soon as I reopen Xcode.


I've tested on another machine and had another issue with glog build:

checking for arm-apple-darwin-gcc... /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch undefined_arch -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk
checking whether the C compiler works... no
configure: error: in `(..._/node_modules/react-native/third-party/glog-0.3.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

config.log: https://pastebin.com/8M4ybuEp

This machine did not have Xcode installed before. I did install the Command Line Utils.

Reproducible Demo

On macOS Mojave with Xcode 10.

react-native init TestProject --version="0.56.0-rc.2"
cd TestProject
npm run start
react-native run-ios

Fails because 'config.h' file not found on mutex.h.

Activity

futuun

futuun commented on Jun 17, 2018

@futuun
Contributor

I had the same issue but manually triggering configure script (cd ./node_modules/react-native/third-party/glog-0.3.4 && ../../scripts/ios-configure-glog.sh) resolves it.

Also - If you want to build app for iOS 12 you have to switch path to the active developer directory (xcode-select -s /Applications/Xcode-beta.app/Contents/Developer).

eliperkins

eliperkins commented on Jun 18, 2018

@eliperkins
Contributor

I can also confirm this issue appearing when upgrading from RN 0.54 -> 0.56, building using Xcode 10 (or the Xcode 9 Preview Build System).

Like @futuun mentioned, this is resolved by manually triggering the configure script.

It sounds like the new build system isn't running that step by the time it's build artifacts are needed. Where is the ios-configure-glog.sh executed in the RN build process?

futuun

futuun commented on Jun 18, 2018

@futuun
Contributor

In double-conversion and double-conversion-tvOS as part of Install Third Party phase.

eliperkins

eliperkins commented on Jun 18, 2018

@eliperkins
Contributor

Ah, it looks like that script phase should be configured to have the config.h as an output file, so that the new build system knows it needs to run the phase: https://asciiwwdc.com/2018/sessions/408#t=893.696

EDIT: Turns out this isn't true.

eliperkins

eliperkins commented on Jun 18, 2018

@eliperkins
Contributor

I dug into this a bit further today, and it seems as though the ios-configure-glog.sh is never being called as part of ios-install-third-party.sh when using the new build system.

Using set -x inside of ios-install-third-party.sh, I end up with this:

+ cd /Users/eliperkins/src/FixBuild/node_modules/react-native/React/..
+ exec scripts/ios-install-third-party.sh
+ cachedir=/Users/eliperkins/.rncache
+ mkdir -p /Users/eliperkins/.rncache
+ mkdir -p third-party
++ dirname /Users/eliperkins/src/FixBuild/node_modules/react-native/scripts/ios-install-third-party.sh
+ SCRIPTDIR=/Users/eliperkins/src/FixBuild/node_modules/react-native/scripts
+ fetch_and_unpack glog-0.3.4.tar.gz https://github.com/google/glog/archive/v0.3.4.tar.gz 69f91cd5a1de35ead0bc4103ea87294b0206a456 '"/Users/eliperkins/src/FixBuild/node_modules/react-native/scripts/ios-configure-glog.sh"'
+ file=glog-0.3.4.tar.gz
+ url=https://github.com/google/glog/archive/v0.3.4.tar.gz
+ hash=69f91cd5a1de35ead0bc4103ea87294b0206a456
+ cmd='"/Users/eliperkins/src/FixBuild/node_modules/react-native/scripts/ios-configure-glog.sh"'
+ retries=4
+ fetched=no
+ true
+ '[' -f /Users/eliperkins/.rncache/glog-0.3.4.tar.gz ']'
+ shasum -p /Users/eliperkins/.rncache/glog-0.3.4.tar.gz
+ awk -v hash=69f91cd5a1de35ead0bc4103ea87294b0206a456 '{exit $1 != hash}'
+ break
++ basename glog-0.3.4.tar.gz .tar.gz
+ dir=glog-0.3.4
+ '[' no = yes ']'
+ '[' '!' -d third-party/glog-0.3.4 ']'
+ fetch_and_unpack double-conversion-1.1.5.tar.gz https://github.com/google/double-conversion/archive/v1.1.5.tar.gz 96a8aba1b4ce7d4a7a3c123be26c379c2fed1def
+ file=double-conversion-1.1.5.tar.gz
+ url=https://github.com/google/double-conversion/archive/v1.1.5.tar.gz
+ hash=96a8aba1b4ce7d4a7a3c123be26c379c2fed1def
+ cmd=
+ retries=4
+ fetched=no
+ true
+ '[' -f /Users/eliperkins/.rncache/double-conversion-1.1.5.tar.gz ']'
+ shasum -p /Users/eliperkins/.rncache/double-conversion-1.1.5.tar.gz
+ awk -v hash=96a8aba1b4ce7d4a7a3c123be26c379c2fed1def '{exit $1 != hash}'
+ break
++ basename double-conversion-1.1.5.tar.gz .tar.gz
+ dir=double-conversion-1.1.5
+ '[' no = yes ']'
+ '[' '!' -d third-party/double-conversion-1.1.5 ']'
+ fetch_and_unpack boost_1_63_0.tar.gz https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz c3f57e1d22a995e608983effbb752b54b6eab741
+ file=boost_1_63_0.tar.gz
+ url=https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz
+ hash=c3f57e1d22a995e608983effbb752b54b6eab741
+ cmd=
+ retries=4
+ fetched=no
+ true
+ '[' -f /Users/eliperkins/.rncache/boost_1_63_0.tar.gz ']'
+ shasum -p /Users/eliperkins/.rncache/boost_1_63_0.tar.gz
+ awk -v hash=c3f57e1d22a995e608983effbb752b54b6eab741 '{exit $1 != hash}'
+ break
++ basename boost_1_63_0.tar.gz .tar.gz
+ dir=boost_1_63_0
+ '[' no = yes ']'
+ '[' '!' -d third-party/boost_1_63_0 ']'
+ fetch_and_unpack folly-2016.10.31.00.tar.gz https://github.com/facebook/folly/archive/v2016.10.31.00.tar.gz fb8cdf8962d8c9d0c20a150b6ec3b75d1fa50696
+ file=folly-2016.10.31.00.tar.gz
+ url=https://github.com/facebook/folly/archive/v2016.10.31.00.tar.gz
+ hash=fb8cdf8962d8c9d0c20a150b6ec3b75d1fa50696
+ cmd=
+ retries=4
+ fetched=no
+ true
+ '[' -f /Users/eliperkins/.rncache/folly-2016.10.31.00.tar.gz ']'
+ shasum -p /Users/eliperkins/.rncache/folly-2016.10.31.00.tar.gz
+ awk -v hash=fb8cdf8962d8c9d0c20a150b6ec3b75d1fa50696 '{exit $1 != hash}'
+ break
++ basename folly-2016.10.31.00.tar.gz .tar.gz
+ dir=folly-2016.10.31.00
+ '[' no = yes ']'
+ '[' '!' -d third-party/folly-2016.10.31.00 ']'

There is no call to exec ios-configure-glog.sh here.

kelset

kelset commented on Jun 21, 2018

@kelset
Contributor

Related to supporting XCode 10, it seems like a PR has been already merged on master: #19781

If you could verify if it fix it, we can cherry pick it for 0.56 before moving out of RC

futuun

futuun commented on Jun 21, 2018

@futuun
Contributor

No, the PR you linked fixes other issue. You can have few versions of Xcode and switch between them, that PR is for making sure that you are using simulator from active version.

This issue is connected to new build system (@eliperkins linked WWDC transcript). Not sure if we can have changes that will work with Xcode 10 and will be backward compatible with Xcode 9.

kelset

kelset commented on Jun 21, 2018

@kelset
Contributor

Hey @futuun thanks for the detailed clarification :)

Since XCode 10 is still in Beta 1 I feel like then probably 0.56 won't support it, and if the support for it is a breaking change then it will need to be discussed further (this issue I think is a good starting point for this).

eliperkins

eliperkins commented on Jun 21, 2018

@eliperkins
Contributor

Not sure if we can have changes that will work with Xcode 10 and will be backward compatible with Xcode 9.

I'd say the 99% of the issues with the new build system will be backwards compatible.

As far as this issue goes, I've spent a few more minutes look at it, and I'm positive that this is failing on the new build system due to ios-install-third-party.sh never successfully calling ios-configure-glog.sh.

Additionally, this seems extremely related to this commit: 5c53f89#diff-db5be184065c4ffa44ee6585f41e6a69 @janicduplessis @javache

Can someone with more bash script expertise than myself take a look at ios-install-third-party.sh to see what could be causing this? @mhorowitz @fkgozali

fkgozali

fkgozali commented on Jun 21, 2018

@fkgozali
Contributor

16 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @WesSouza@hramos@gastonmorixe@eliperkins@fkgozali

      Issue actions

        Problems with glog (config.h missing) and gflags/gflags.h on Xcode 10 · Issue #19774 · facebook/react-native