ruby 未能在mac上构建ffi gem本机扩展

9o685dep  于 2023-05-17  发布在  Ruby
关注(0)|答案(1)|浏览(153)

尝试安装cocoapods和其他React Native pod安装。安装libffi gem本机扩展是这个过程的一部分,它总是失败,输出如下:
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
相关性如下:

An error occurred while installing ffi (1.15.4), and Bundler cannot
continue.

In Gemfile:
  cocoapods was resolved to 1.12.1, which depends on
    cocoapods-core was resolved to 1.12.1, which depends on
      typhoeus was resolved to 1.4.0, which depends on
        ethon was resolved to 0.14.0, which depends on
          ffi

我还试图找到libffi的预编译版本,而不是从源代码编译,但遗憾的是,在www.example.com中无法获得RubyGems.org

qv7cva1a

qv7cva1a1#

我通过运行修复了这个问题:
CXXCPP="$(xcrun --find clang)++ -E" arch -x86_64 gem install ffi
我的CPP路径没有正确配置,所以我必须显式地传递它。希望这能帮助其他遇到同样问题的人。

相关问题