You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS构建报错:glog->mutex->config.h文件未找到

解决iOS构建报错:glog -> mutex -> config.h not found(RN 0.64.3 + Expo 43 + Xcode 14.3)

针对你遇到的问题——pod install成功但iOS构建时提示glog的config.h缺失,且node_modules/react-native下无third-party文件夹、执行ios-install-third-party.sh无反应,可按以下步骤解决:

1. 手动安装第三方依赖并生成config.h

RN 0.64版本依赖的glog等第三方库需要手动触发安装,步骤如下:

  • 进入react-native目录:
    cd node_modules/react-native
    
  • 给安装脚本添加执行权限:
    chmod +x scripts/ios-install-third-party.sh
    
  • 指定架构执行安装脚本(适配Xcode14.3的arm64/x86_64兼容需求):
    ARCHS="arm64 x86_64" scripts/ios-install-third-party.sh
    
  • 进入glog目录执行配置脚本生成config.h:
    cd third-party/glog-0.3.5 && ../../scripts/ios-configure-glog.sh
    

2. 清理缓存重新构建依赖

如果上述步骤无效,清理缓存后重新安装依赖:

  • 进入ios目录清理Pod相关文件:
    cd ios && rm -rf Podfile.lock Pods && pod deintegrate
    
  • 清理npm缓存并重装项目依赖:
    rm -rf node_modules package-lock.json
    npm cache clean --force
    npm install
    
  • 重新执行pod install:
    cd ios && pod install
    

3. 调整Xcode项目配置

Xcode14.3的工具链更新可能导致头文件路径识别异常,需手动配置:

  • 打开Xcode项目,进入Build Settings,找到Header Search Paths;
  • 添加路径$(SRCROOT)/../node_modules/react-native/third-party/glog-0.3.5/src,并设置为recursive;
  • 检查Build Phases中的Bundle React Native code and images脚本,可手动执行一次确保资源打包正常:
    cd ios && ../node_modules/react-native/scripts/react-native-xcode.sh
    

4. Expo预构建项目额外处理

如果是Expo预构建生成的iOS项目,执行以下命令重置预构建配置:

expo prebuild --clean

原因说明

RN 0.64版本依赖glog等第三方库,Xcode14.3的工具链变更导致自动安装脚本失效;同时Expo项目的缓存机制可能阻止了third-party文件夹的自动生成,因此需要手动触发依赖安装并调整Xcode配置适配新版本工具链。

内容的提问来源于stack exchange,提问作者coder03

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 10:17:25