question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:20
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

155reactions
futuuncommented, Jun 17, 2018

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

25reactions
nolindnaidoocommented, Oct 5, 2018

repost from: https://github.com/facebook/react-native/issues/19529#issuecomment-427209573

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.

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

(maybe its even better inside the node_modules/react-native/node_modules directory?)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mojave + Xcode 10 build fails on glog config.h, gflags/gflags.h
In Xcode, go to File->Project/Workspace settings. Change the build system to Legacy Build system. This is the resolution from Wesley's link.
Read more >
【转】Mojave + Xcode 10 build fails on glog config.h ... - 博客园
I'm testing React Native 0.56.0-rc.2 on Mac OS Mojave and Xcode 10. Which generated some long errors.
Read more >
Installation - Ceres Solver
Start by installing all the dependencies. # CMake sudo apt-get install cmake # google-glog + gflags sudo apt-get install libgoogle- ...
Read more >
How To Use Gflags (formerly Google Commandline Flags)
Download and Installation. The gflags library can be downloaded from GitHub. You can clone the project using the command: git clone https://github.com/gflags ......
Read more >
【转】React Native Config.h not found ( glog-0.3.4 )
I'm beginner of React native developer. After create new project then open it. xcode is display error config.h file not found in mutex.h...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found