Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Config.h not found

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 file. I'm also search in google and try possible solution but still display same error.

I'm done Following Commands

1

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2

brew install watchman

3

npm install -g react-native-cli

4

react-native init projectName

5

cd projectName
react-native start

6

react-native run-ios

Error in CMD
./Desktop/Demo React Native/projectName/node_modules/react-native/React/../third-party/glog-0.3.4/src/base/mutex.h:105:10: fatal error: 'config.h' file not found

include "config.h" // to figure out pthreads support

1 error generated.

Software Version List
Homebrew 1.6.8
react-native-cli: 2.0.1
react-native: 0.55
watchman 4.9.0
npm 6.1.0

I'm also try this soluation but still error

In the Terminal, navigate to the third-party/glog and config glog file

cd node_modules/react-native/third-party/glog-0.3.4
./../scripts/ios-configure-glog.sh
like image 583
Bhaumik Surani Avatar asked Jun 13 '18 11:06

Bhaumik Surani


5 Answers

I got it fixed by following this steps:

  1. Close Xcode.
  2. cd <Project-Folder>/node_modules/react-native/third-party/glog-0.3.4
  3. Run ./configure
  4. Run make
  5. Run make install
  6. Open Xcode and try building the Project.

Hope this solves the issue

like image 54
samridhgupta Avatar answered Nov 07 '22 17:11

samridhgupta


Solution:

yarn upgrade log

Upgrade to v1.6.0 successful. iOS build successful.

Note: Rebuilding glog did did not work for me. Build failed.

like image 34
David Manpearl Avatar answered Nov 07 '22 18:11

David Manpearl


I will add another answer to this issue since it was driving me crazy this week...

$ cd ./node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd $(ls | grep 'glog' | awk '{print $1}') && ./configure

The steps needed to manually configure glog (like samridhgupta his accepted answer or the command I wrote here just above) worked for me, but only the first time I build the project. On every single build I had to go to the same process so I needed a more stable solution.

I appears Xcode is executing ios-install-third-party.sh on every build, which means it will also execute ios-configure-glog.sh every single time. So my solution is to just build a single time, and then comment out the glog install step in the ios-install-third-party script.

If anyone is facing this same issue, it is the line below you need to remove or comment out (ios-install-third-party can be found in /node_modules/react-native/scripts).

fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\""
like image 2
dentemm Avatar answered Nov 07 '22 17:11

dentemm


If any of these solution does not work, please check your project path. Project path - directory names should not contain any space in its name or you can create project on Desktop or in Documents directory.

like image 1
Bhavik Modi Avatar answered Nov 07 '22 18:11

Bhavik Modi


Run following commands in project directory.Helped me resolve my config.h not found issue

  1. cd node_modules/react-native/third-party/glog-0.3.4/
  2. ./configure
  3. make
  4. make install
  5. cd ../../../..
  6. react-native run-ios
like image 1
Himanshu G Avatar answered Nov 07 '22 17:11

Himanshu G