facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.23k stars 24.33k forks source link

Xcode 10: third-party: 'config.h' file not found #14382

Closed joncursi closed 6 years ago

joncursi commented 7 years ago

After upgrading from 0.44.3 -> 0.45.0, XCode no longer builds for me with the following error:

Lexical or Preprocessor Issue
'config.h' file not found

screen shot 2017-06-08 at 2 14 56 am

I am not using cocoa pods, just npm packages. Seems like some related changes have been made that may be causing this issue?

pvinis commented 7 years ago

anyway, now this issue here should be fixed with 0.46.4

peterp commented 7 years ago

I think we've got to work on a less entitled attitude. It's easy to forget that we're using React-Native, and the work of others, for free.

Sure, it's frustrating to have build issues, but come up with a procedure to test the build before you use it? You don't need to follow bleeding edge.

ddpatel2606 commented 7 years ago

@doyouno your solution is right, now its working

damirrrk commented 7 years ago

I got the same issue on 0.46.4 version and on 0.47.0-rc.4. What I'm doing wrong?

ddpatel2606 commented 7 years ago

@damirjs just follow @doyouno 's solution

you can just install glog yourself to solve this program. cd /glog then ./configure make make install

build in Xcode again, problem never comes back .

damirrrk commented 7 years ago

@ddpatel2606 Thank you for answer! make install threw this error:

make: /Volumes/Macintosh: No such file or directory
make: *** [install-am] Error 1

and packager:

Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1018:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1420:11)

but app build successfully.

UPD: For resolving problems with watcher i used this recommendations: https://github.com/facebook/react-native/issues/10088#issuecomment-265242851 and https://github.com/facebook/react-native/issues/10088#issuecomment-310328595 Its works!!!

ThomasXu18 commented 7 years ago

@Ignigena thanks! It works for me.

huangminlinux commented 7 years ago
rm ~/.rncache/*

and build again.

It work for me.

kaixinfu commented 7 years ago

@Ignigena very good

s13524801 commented 7 years ago

react-native/scripts/ios-install-third-party.sh

SCRIPTDIR=$(cd "$(dirname "$0")"; pwd)
# SCRIPTDIR="../../scripts"

It works.

chiragpurohit71085 commented 7 years ago

I followed instructions from @javache and able to resolve the problem...(v 0.47)

If anybody facing the same issue as I have mentioned, can pull working template project from

https://github.com/chiragpurohit71085/working_react_native_0.47

treemore commented 7 years ago

@s13524801 i test every solution. only your's can work. thank you very mush. my react-native version is react-native@0.46.4 . so . maybe in the ios-install-third-party.sh need add cd $(dirname $0) ?

paulief commented 7 years ago

for anyone finding this on RN v0.47.2, I needed to follow this very specific order of steps to get it working:

  1. rm -rf node_modules && npm install
  2. open the project in Xcode, clean, and try to build. It will fail with an error saying something about "exit code 77" when building double-conversion
  3. Now go into node_modules/react-native/third-party/glog and run ../../scripts/ios-configure-glog.sh
  4. rm -rf ~/.rncache
  5. Clean and build again in Xcode

For whatever reason, other combinations of the other solutions wouldn't work. Like running ios-install-third-party.sh separately (with the $SOURCEDIR fix) before ../../scripts/ios-configure-glog.sh would still get the error.

majd-asab commented 7 years ago

This also worked for RN 0.47 by @SudoPlz https://github.com/facebook/react-native/issues/14382#issuecomment-309865151

iegik commented 7 years ago
cd node_modules/react-native/third-party/glog-*
../../scripts/ios-configure-glog.sh
toearth commented 7 years ago
  1. Delete third-party in react-native directory
  2. Check files in ~/.rncache. In this directory, there are 4 file boost_1_63_0.tar.gz double-conversion-1.1.5.tar.gz folly-2016.09.26.00.tar.gz and glog-0.3.4.tar.gz.Make sure all of this file is ok.If any problem, you can download and replace by youself.
  3. Open xcode clean and build.

My problem is, when downloading boost_1_63_0.tar.gz , it failed.

noumantahir commented 7 years ago

was having the same issue, tried ios-configure-glog.sh and it fixed that issue but raised this....

screen shot 2017-09-15 at 4 11 37 pm

vanBrunneren commented 7 years ago

In my case after running ../../scripts/ios-configure-glog.sh I always got an error like this:

configure: error: in 'PATH_TO_RN_PROJECT/node_modules/react-native/third-party/glog-0.3.4':
configure: error: C compiler cannot create executables

In config.log I found the following line:

checking for arm-apple-darwin-gcc... /Users/MYUSER/Downloads/Xcode 9.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch armv7 -isysroot /Users/MYUSER/Downloads/Xcode 9.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk

After moving my xcode to programs and rename it from 'Xcode 9' to 'Xcode' the error was gone.

I'm posting this because maybe someone has a similar situation 🍺

davidperrenoud commented 7 years ago

Renaming Xcode 9.app to Xcode9.app (without space) and following steps https://github.com/facebook/react-native/issues/14382#issuecomment-327412326 and https://github.com/facebook/react-native/issues/14382#issuecomment-326919739 fixed the problem for me.

masterkrang commented 7 years ago

I tried all the stuffs above, to no avail.

Then,

I updated npm and all that shit worked!

dehengxu commented 7 years ago

Be sure these four files glog-0.3.4.tar.gz double-conversion-1.1.5.tar.gz boost_1_63_0.tar.gz folly-2016.09.26.00.tar.gz in ~/.rncode are integrity.

dehengxu commented 7 years ago

Be sure these four files glog-0.3.4.tar.gz double-conversion-1.1.5.tar.gz boost_1_63_0.tar.gz folly-2016.09.26.00.tar.gz in ~/.rncode are integrity.

phudev95 commented 7 years ago

@masterkrang Thanks for the support. It's working for me ;)

qrobin commented 7 years ago

Yup, after rm -rf node_modules && npm i it worked. Thanks guys.

mustafakucuk commented 7 years ago

Wow, very interesting.

rm -rf node_modules && npm i it's worked!

Haggaish commented 7 years ago

this problem seams to be fixed in react native version 4.7 and higher.

dhei commented 7 years ago

I have the same error with react-native@0.50.3 today and rm -rf node_module && npm i did the trick.

euforic commented 6 years ago

Still getting the issue with react-native 0.50.3. Also tried the fix of running cd node_modules/react-native/third-party/glog-* ../../scripts/ios-configure-glog.sh

But that fails too

/Users/e/myproject/node_modules/react-native/third-party/glog-0.3.4/missing: Unknown `--is-lightweight' option
Try `/Users/e/myproject/node_modules/react-native/third-party/glog-0.3.4/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk
checking whether the C compiler works... no
configure: error: in `/Users/e/myproject/node_modules/react-native/third-party/glog-0.3.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
fedeojeda95 commented 6 years ago

I was still having this problem using the latest release, react-native 0.50.3.

After running all the build scripts manually one by one (and almost giving up in the process, btw), I found that moving into glog folder (node_modules/react-native/third-party/glog-0.3.4/) and running the build process actually fixed it. The commands used where the following:

After all of this, voila, it was working!

Nevertheless, after running the last command, I saw a message indicating that it could not find /Applications/Xcode.app, which seemed really weird.

I realized that since I was using different versions of Xcode at the same time (8.3.2 and 9.0) I renamed both applications to indicate their version (Xcode 8.3.2 and Xcode 9, respectively). Just renaming the latest one to Xcode again, and running rm -rf ~/.rncache fixed it!

Seems to me that this could be easy fixable, since it looks like the path is harcoded. Just check that that Xcode was renamed correctly. Weirdly, I had to restart my computer in order for macOS to apply the name change

coreh commented 6 years ago

Just hit this after updating from React Native v0.47 to v0.50

I hit Product > Clean, closed Xcode, combined the instructions above:

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

Then reopened Xcode, and the build worked normally! 👍

RicardoBarroso commented 6 years ago

Part of @fedeojeda95's solution worked for me! :)

Note that previous to achieve it I've upgraded react-native to version 0.50.3:

react-native-git-upgrade

and I also did run:

rm -rf ~/.rncache

and:

npm install

I don´t know if any of those previous steps have had any impact on next steps working on. So I've gone through the following steps with success:

  1. Close Xcode.

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

    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.

    If on project navigator you can see the "Libraries/React.xcodeproj/ThirdParty/glog/config.h" file(not in red), that's a good indication that your app should now compile and run ok.

dabit3 commented 6 years ago

If anyone is still having this issue, I upgraded to the latest version of Xcode 9.2 (stable) and the error went away and my project built without any issues.

tuanluu-agilityio commented 6 years ago
cd /glog then
./configure
make
make install

make install still error but it's build succeeded. Version on my machine:

react-native-cli: 2.0.1
react-native: 0.51.0
noproblama commented 6 years ago

I had "Unrecognized font family MaterialIcons". While building ios app I had Build Failed because of it was looking for fonts in ..../node_modules/native-base/.... And I checked and found out that I have no 'react-base' installed.

So react-native install native-base and then rebuild ios app helped me.

nakp commented 6 years ago

Well, for me, nothing of this worked, the third-party folder doesn't even exist anymore in 0.48.3

I manually added the config.h file to the Pods project and pointed it to the GLog target as public for fixing the issue, seems like the prepare_command (in the podspec) is never executed when using the :path option in the Podfile so ios-configure-glog.sh is never executed, also configure is missing (which is needed in the script)

grundmanise commented 6 years ago

RN v. 0.50.4. Had the same issue. Did 2 and 3 from @RicardoBarroso comment and also cleared the project -> worked.

*The only thing was that after this I had to completely delete an app from a device, cuz a default iOS launch screen (xib) started to appea and I was unable to remove it (there was no xib in the xcodeproj).

compojoom commented 6 years ago

I just ran in this on 0.51. I went to the third-party folder and deleted it. After that started the build process in iOS and it recreated the folder and all went good.

muratozgul commented 6 years ago

I just ran in this on 0.51 as well. rm -rf node_modules yarn install solved the issue

Frexuz commented 6 years ago

I get a very strange issue

../../scripts/ios-configure-glog.sh
./configure: line 1722: syntax error: unexpected end of file

The file looks like this 😳 screen shot 2018-01-23 at 14 44 49

ghost commented 6 years ago

Running ../../scripts/ios-configure-glog.sh I am getting the following error (after upgrading to the current RN 0.52.2 version yesterday):

config.status: creating src/config.h
awk: illegal statement
 input record number 1, file src/config.h.in
 source line number 56
config.status: error: could not create src/config.h

Already tried removing rm -rf node_modules and rm -rf ~/.rncache.

vshalvaghasiya commented 6 years ago

Click To Link Sovle question . https://stackoverflow.com/questions/45082769/how-to-solve-config-h-file-not-found-when-running-app-from-the-react-native-o/48658156#48658156

ghost commented 6 years ago

Still no joy, I have to go back as far as rn 0.39.0 to be able to build.

When I run ../../scripts/ios-configure-glog.sh on a rn 0.53.0 version I get the following error (I get the same error when I manually run ./configure in the node_modules/react-native/third-party/glog-0.3.4 directory):

...
checking how to access the program counter from a struct ucontext... configure: WARNING: Could not find the PC.  Will not output failed addresses...
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/glog/logging.h
config.status: creating src/glog/raw_logging.h
config.status: creating src/glog/vlog_is_on.h
config.status: creating src/glog/stl_logging.h
config.status: creating libglog.pc
config.status: creating src/config.h
awk: illegal statement
 input record number 1, file src/config.h.in
 source line number 55
config.status: error: could not create src/config.h

These are only the last few lines, am happy to post the whole output if that helps. This is on a brand new test project which I initialised for this test.

sibelius commented 6 years ago

this should solve:

rm -rf ~/.rncache
rm -rf node_modules
yarn
react-native run-ios

we can close this, it is not happening in latest react-native versions

ghost commented 6 years ago

@sibelius That procedure did not fix it on my machine. Still happening with rn 0.53 for me on a brand new project, initialised just for testing this.

Even went so far as deinstalling Xcode and nvm and upgraded to node 9.4.0.

As said I had to fall back to rn 0.39 in order to successfully build.

WarpRulez commented 6 years ago

I just installed react-native to this MacOS X system, following the instructions to the letter, and I'm getting the "config.h file not found" error in mutex.h when trying to build with Xcode. Also, "react-native run-ios" does not work (giving an xcrun error about missing "instruments").

This issue was reported on June 2017. We are now on February 2018, and the problem still persists. I find this absolutely mind-boggling. Exactly how long can it take for a problem like this to be fixed?

WarpRulez commented 6 years ago

Btw, removing the node_modules directory from the project and running "npm install" fixed the problem somehow.

jiteshwadia commented 6 years ago

I had to upgrade react-native version to 0.50.0 as dependency to another package. But after that I am getting config.h error.

My current working package.json

{
    "name": "MyApp",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "react": "16.0.0-alpha.12",
        "react-native": "0.45.1",
        "react-native-elements": "^0.19.0",
        "react-navigation": "^1.0.0-beta.29"
    },
    "devDependencies": {
        "babel-jest": "22.1.0",
        "babel-preset-react-native": "4.0.0",
        "jest": "22.1.4",
        "react-test-renderer": "16.0.0-alpha.12"
    },
    "jest": {
        "preset": "react-native"
    }
}

I tried above solutions like,

So, I decided to create a new project, but it failed with same error config.h error. New project's package.json

{
  "name": "TestProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.2.0",
    "react-native": "0.53.0"
  },
  "devDependencies": {
    "babel-jest": "22.2.2",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.3.0",
    "react-test-renderer": "16.2.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

SOLUTION: I had 2 xcode versions. I removed the old one and it worked.

coicoichip commented 6 years ago

Hi everyone .... i have bug 'config.h' file not found but i run ../../scripts/ios-configure-glog.sh. it didn't work and in teminal show Vuongs-MacBook-Pro:glog-0.3.4 vuonghaithanh$ ../../scripts/ios-configure-glog.sh ../../scripts/ios-configure-glog.sh: line 7: xcrun: command not found ../../scripts/ios-configure-glog.sh: line 7: xcrun: command not found checking for a BSD-compatible install... /usr/local/bin/ginstall -c checking whether build environment is sane... yes /Users/vuonghaithanh/WebstormProjects/testreact/node_modules/react-native/third-party/glog-0.3.4/missing: Unknown--is-lightweight' option Try /Users/vuonghaithanh/WebstormProjects/testreact/node_modules/react-native/third-party/glog-0.3.4/missing --help' for more information configure: WARNING: 'missing' script is too old or missing checking for arm-apple-darwin-strip... no checking for strip... strip checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for arm-apple-darwin-gcc... -arch armv7 -isysroot checking whether the C compiler works... no configure: error: in/Users/vuonghaithanh/WebstormProjects/testreact/node_modules/react-native/third-party/glog-0.3.4': configure: error: C compiler cannot create executables See config.log' for more details

pls help me how to fix

react-native-cli: 2.0.1 react-native: 0.53.3

guy-shahine commented 6 years ago

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

Solved the problem on MacOS

nico1510 commented 6 years ago

@coicoichip did you manage to solve your problem ?