Jagdeep Singh
Jagdeep Singh

Reputation: 2626

"config.h" file not found in iOS project of React native

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?

Upvotes: 32

Views: 22842

Answers (10)

Asad Ali Choudhry
Asad Ali Choudhry

Reputation: 5271

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.

Upvotes: 0

Sandeep Rajbhar
Sandeep Rajbhar

Reputation: 123

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.

Upvotes: 0

Naresh
Naresh

Reputation: 955

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.

Upvotes: 0

imrohan
imrohan

Reputation: 21

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.

Upvotes: 2

Minhaj Javed
Minhaj Javed

Reputation: 981

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.

Upvotes: 3

Ram Mishra
Ram Mishra

Reputation: 797

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

Upvotes: 0

John Marshall
John Marshall

Reputation: 921

  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.

Upvotes: 91

yogevbd
yogevbd

Reputation: 1628

These steps worked for me:

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

Upvotes: 3

Deivison Sporteman
Deivison Sporteman

Reputation: 2380

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!

Upvotes: 12

Gavin Thomas
Gavin Thomas

Reputation: 1867

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

Upvotes: 6

Related Questions