React Native项目Xcode 10报错、'config.h' file not found、libfishhook.a cannot be found、No member named ...

最近xcode更新到xcode10后以前的RN项目莫名跑不起来了,诸如:

'config.h' file not found
libfishhook.a cannot be found

真机运行时

No member named '__rip' in '__darwin_arm_thread_state64'

我这个项目的react-native版本是0.55.4
看了很多解决方案在这里总结下:
首先重新install下node-models并且清理下各种缓存
cd到工程目录下在终端执行

rm -rf node_modules/ && yarn cache clean && yarn

此时运行会提示如果'config.h' file not found,可以看下node_modules/react-native/目录下有没有third-party文件,如果没有可以执行:

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

现在可以cd到third-party/glog-0.3.4执行configure

cd third-party/glog-0.3.4
./configure

configure: error: cannot run C compiled programs 解决办法

./configure --host=arm

让后发现libfishhook.a找不到了


找到websocket这个库,把错误的.a删了

再加上正确的就可以运行了


对了,如果你在真机上运行还可能会报No member named '__rip' in '__darwin_arm_thread_state64'错误,找到third-party/glog/config.h文件
将下列代码

#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip

替换成

#if defined(__arm__) || defined(__arm64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__pc
#else
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#endif

再次编译就可以正常运行了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容