32

In X-Code project of react native, getting error

config.h file not found.

Here is version detail :

react-native-cli: 2.0.1 react-native: 0.51.0 

How to solve it?

10 Answers 10

91
  1. Close Xcode.

  2. Open Terminal, go to your project's root folder and run:

    cd node_modules/react-native/third-party/glog-0.3.4/ 
  3. Run the configure script:

    ./configure 
  4. Open Xcode and try to run your app.

Sign up to request clarification or add additional context in comments.

7 Comments

...and this is happening consistently after creating a new prj with react-native-cli: 2.0.1 react-native: 0.55.4 - this being the only fix, thanks!
Getting this error: checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... configure: error: unsafe absolute working directory name
Perfect. Worked for me.
Just had to do this again. How often does this happen.
Please note with XCOXE 10, and Mojave MAC OS , I had same issue, ./configure was showing some permission issue, I had set permission "777" to project folder enclosing with inner folders
|
12

I had the same issue, using this steps solves for me:

Running into the same issue here after upgrading from 0.44. None of the above solutions or clearing caches did the trick for me. Here's what I did to get things working again:

  1. In the Terminal, navigate to the react-native/third-party/glog folder inside node_modules (for me, this was cd node_modules/react-native/third-party/glog-0.3.4)
  2. Once actively in this folder, run sh ../../scripts/ios-configure-glog.sh Glog is configured and the required config.h header file is created for Xcode to find
  3. Run your iOS BUILD

Regards!

2 Comments

Getting this error: checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... configure: error: unsafe absolute working directory name
You can really just do this from your project's root directory: ./node_modules/react-native/scripts/ios-configure-glog.sh
6

When project files get messed up for me. I typically follow these steps.

rm -rf node_modules npm install react-native upgrade (Only changing affected files, so IOS for you) react-native link npm start --reset-cache (In another terminal) react-native run-ios 

1 Comment

I just ran into this, too. Only difference was that I needed node_modules reinstalled before I could run the react-native upgrade command.
3

These steps worked for me:

rm -rf ~/.rncache rm -rf node_modules/ npm install npm start 

Comments

3

You need to change to the legacy build system in Xcode 10 and install third party scripts manually.

1:

File -> Project/Workspace settings Build System: dropdown -> change to Legacy Build system

2: Follow this to manually install third party scripts for RN:

Clean RN cache

$ rm -rf ~/.rncache

Re-install the deps

$ cd your_project_path $ rm -rf node_modules/ && npm install

Then install the third-party

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

Run the commands below if glog installation failed.

$ cd ../third-party/glog-0.3.x $ ./configure

It works for me, I hope it helps for you.

Comments

2

If above all answers don't work, Please check that there is no space in any directory name of the full path and not only the project directory name.

While in terminal, it accepts throgh My Disk as My\ Disk but xcode do not recognize that.

If its in My Disk directory, try after moving it to Desktop or any other directory which doesn't have space in their name.

Comments

0

configure: error: unsafe absolute working directory name Issue:

-Open Terminal, go to your project's root folder and run:

  • cd node_modules/react-native/third-party/glog-0.3.5/ Run the configure script:

./configure

got error: configure: error: unsafe absolute working directory name

try to created app in desktop and from there run ./configure command.

Please note with XCOXE 10, and Mojave MAC OS , I had same issue, ./configure was showing some permission issue, I had set permission "777" to project folder enclosing with inner folders

Comments

0

This is the linking issue in xcode. You just need to re-link the files. Please follow the below steps:

  1. Open you peoject's root directory then open node-module -> react-native -> React.
  2. Open React.xcodeproj file in xcode.
  3. You will see missing (showing red in color) files under the third-party folder
  4. Just run the React.xcodeproj project.
  5. After completion close this project & open you project file.
  6. Delete Drive data & Clean the project & run.

If after running the project you are getting linking issue then please make sure you have added all the (ios) products () come under the Libraries -> React.xcodeproj -> Products in your Build Phases -> Link Binary With Libraries.

Comments

0

If everyone has tried solving the issue by this Open Terminal, go to your project's root folder and run: cd node_modules/react-native/third-party/glog-0.3.4/ Run the configure script: ./configure

But still not got the solution then,

Go to your Xcode and check if there any library is missing. Add that library and then perform this above step.

Comments

0

Although the already mentioned answers are correct but still few guys are struggling, as only configuring the glog doesn't sometimes resolve the error. Here I have written a detailed solution to the problem.

Solution: config.h file not found mutex.h During Archive.

The steps are the following:

  1. Remove node_modules directory
  2. Clear Cache
  3. Install packages again with Yarn
  4. Install third party
  5. Configure Glog
  6. Make & Make install glog

For all these above steps the I have shared commands in the above mentioned article, so not going to write again. I hope it will solve problem for guys who are still struggling.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.