在glog config.h,gflags / gflags.h上,Mojave + Xcode 10构建失败

问题描述 投票:6回答:5

我正在Mac OS Mojave和Xcode 10上测试React Native 0.56.0-rc.2。

运行:

react-native init TestProject --version="0.56.0-rc.2"
cd TestProject
npm run start
react-native run-ios

这产生了一些长期错误。

输入Xcode让我失去了glog缺少的config.h,我发现可以手动构建:

cd ./node_modules/react-native/third-party/glog-0.3.4
./configure && make && make install

那个阶段已经过去了,但又引发了另一个问题

(...)/node_modules/react-native/third-party/glog-0.3.4/src/glog/logging.h:85:10:
'gflags/gflags.h' file not found

我无法在Google或Stack Overflow上找到任何与RN相关的内容,只能参考其他软件包以及在基于Debian的系统上安装这些软件包的说明。

这是一个已知的问题?

react-native glog gflags
5个回答
9
投票

从项目目录运行它为我修复它:

cd ./node_modules/react-native/third-party/glog-0.3.4 && ../../scripts/ios-configure-glog.sh

这会手动触发配置脚本


4
投票

简单快速的解决方案。在Xcode中,转到文件 - >项目/工作区设置。将构建系统更改为Legacy Build系统。

这是Wesley链接的解决方案。前几天看到有关发布直接答案并试图避免链接的事情,因为链接/网站可能会发生变化。我打算将此作为评论,但没有足够的代表。


2
投票

更新

这是一个已知问题,在此处进行跟踪:

https://github.com/facebook/react-native/issues/19774


1
投票

我通过执行以下步骤解决了它

  • 在项目的根目录中,运行npm install or yarn - install packages
  • cd node_modules/react-native - 转到节点模块目录
  • scripts/ios-install-third-party.sh - 安装@ node_modules / react-native / third-party
  • cd third-party - 转到新创建的第三方目录
  • cd glog-0.3.x - ls -la查找目录版本号或只使用tab自动完成)
  • ./configure - 运行设置
  • cd ../../../../ - 更改回您的项目目录react-native run-iosreact-native run-android - deploy

0
投票

如果这些解决方案中的任何一个不起作用,请检查您的项目路径。项目路径和/或目录名称不应在其名称中包含任何空格,也可以在Desktop或Documents目录中创建项目。

由于项目路径中的名称无效,React Native项目无法在项目/工作区内链接/添加glob头文件。

© www.soinside.com 2019 - 2024. All rights reserved.