React Native 'config.h' file not found 问题、 'glog/logging.h' file not found 问题、configure: error: C compiler cannot create executables问题、a nonzero exit code问题解决过程记录

1、在github 上面 git clone 一个RN 项目代码,npm install (yarn)后,准备运行iOS工程,发现'config.h' file not found ,恶心!!!

百度发现:这个是常见错误,只需要在项目根目录下(里面包含node_modules文件夹)运行以下命令(下面的两行同时复制,终端运行)即可解决:

cd node_modules/react-native/third-party/glog-0.3.4

../../scripts/ios-configure-glog.sh 

注意:具体的版本号要根据报错的提示来定

 

 2、20190225 发现 'glog/logging.h' file not found 的问题(RN 版本 0.58),解决方式(参照上面的,复制下面2行,终端执行):

cd node_modules/react-native/third-party/glog-0.3.5

../../scripts/ios-configure-glog.sh

 

3、讨厌的错误,如下:

configure: error: C compiler cannot create executables

See `config.log' for more details

这个很是令人讨厌!!!出现的原因可能也不一致,下面列举不同时间出现的问题,解决方案和猜想。

20181123运行正常的项目,突然间就出现了config.h' file not found。按照上面的解决方式解决后,运行正常。第二天升级了mac 系统到macOS Mojave (版本10.14);Xcode 更新到Version 10.1 (10B61) 后,又出现了

configure: error: C compiler cannot create executables

See `config.log' for more details

当时百度上说是要安装 GCC 。就用:brew install gcc 安装了下最新版本的gcc 。但是安装完了之后,依然报如下错误(郁闷):

xcrun: error: SDK "iphoneos" cannot be located

xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'

configure: error: C compiler cannot create executables

See `config.log' for more details

最后有效解决方案:

打开xcode...,偏好设置 ,如下图,command line tools 要选中一个 (这个可能是当时安装了两个版本的XCODE,导致没有选择一个)。

20190313 发现glog/logging.h' file not found 问题后,按照上面20190225问题解决,却出现了 关键词如下的错误:

configure: error: C compiler cannot create executables

See `config.log' for more details

过程描述:前几天还是正常运行的,只是换了一个模拟器的机子,就出现了glog/logging.h' file not found ,按照上面的方式执行脚本,但是执行的过程中,出现了 configure: error: C compiler cannot create executables 问题。

解决方法及猜想: 1、glog/logging.h' file not found出现可能跟换模拟器有关(只是猜想)2、configure: error: C compiler cannot create executables 的出现可能跟刚才执行的另外一个RN项目有关,终端在开着另外一个RN项目的本地服务。解决方式:将终端关闭,再次运行项目,一切OK 。

 

20190820遇到问题:给其他团队新建一个基于RN 0.57.5版本的工程,运行IOS 项目,报一堆错误,解决问题记录如下:

1)Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure

解决:类似Command PhaseScriptExecution failed with a nonzero exit code 等错误,最简单的解决方法如下:

xcode->file->Workspace Settings->Build System 选择Legacy Build System 使用旧的编译系统即可。

如果没有使用cocoapods 进行管理的话,

xcode->file->project Settings->Build System 选择Legacy Build System 使用旧的编译系统即可。

 这样一设置,项目报错去掉了一半了。

2)/node_modules/react-native/third-party/glog-0.3.5/src/base/mutex.h:105:10: 'config.h' file not found

3)  configure:-1: C compiler cannot create executables

解决方法:只需要在项目根目录下(里面包含node_modules文件夹)运行以下命令(下面的两行同时复制,终端运行)即可解决:

cd node_modules/react-native/third-party/glog-0.3.5

../../scripts/ios-configure-glog.sh

 

posted @ 2018-11-22 17:42  yoowei  阅读(6796)  评论(1编辑  收藏  举报