pod install 给出与 ruby​​ gems 和 libffi 相关的错误

2024-03-19

我使用react-native init 创建一个应用程序,并在iOS 文件夹中运行pod install。但是,我收到以下错误:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 0x0009): dependent dylib '@rpath/libffi.6.dylib' not found for '/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle'. relative file paths not allowed '@rpath/libffi.6.dylib' - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle (LoadError)

I ran brew install libffi and brew upgrade libffi并重试。相同的结果。

运行 pod --version 给出:


sh-3.2# pod --version
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Traceback (most recent call last):
    23: from /usr/local/bin/pod:23:in `<main>'
    22: from /usr/local/bin/pod:23:in `load'
    21: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:36:in `<top (required)>'
    20: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    19: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    18: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods.rb:17:in `<top (required)>'
    17: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods.rb:75:in `<module:Pod>'
    16: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    15: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    14: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/core_overrides.rb:1:in `<top (required)>'
    13: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    12: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    11: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/sources_manager.rb:5:in `<top (required)>'
    10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     8: from /Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     5: from /Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:4:in `<top (required)>'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- 2.6/ffi_c (LoadError)
    24: from /usr/local/bin/pod:23:in `<main>'
    23: from /usr/local/bin/pod:23:in `load'
    22: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:36:in `<top (required)>'
    21: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    20: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    19: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods.rb:17:in `<top (required)>'
    18: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods.rb:75:in `<module:Pod>'
    17: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    16: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    15: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/core_overrides.rb:1:in `<top (required)>'
    14: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    13: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    12: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/sources_manager.rb:5:in `<top (required)>'
    11: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     9: from /Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
     8: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
     5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
     2: from /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 0x0009): dependent dylib '@rpath/libffi.6.dylib' not found for '/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle'. relative file paths not allowed '@rpath/libffi.6.dylib' - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle (LoadError)

我在 macOS 中安装了非系统最新版本的 ruby​​,但仍然出现错误:

~ % pod                      
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /Users/prikshetsharma/Library in PATH, mode 040777
Traceback (most recent call last):
    2: from /usr/local/bin/pod:23:in `<main>'
    1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
prikshetsharma@Prikshets-MacBook-Pro ~ % sudo gem install cocoapods
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.13.1/ext/ffi_c
/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0 -r ./siteconf20200630-11975-1rzj6u8.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/Cellar/ruby/2.7.1_2/bin/$(RUBY_BASE_NAME)
    --with-ffi_c-dir
    --without-ffi_c-dir
    --with-ffi_c-include
    --without-ffi_c-include=${ffi_c-dir}/include
    --with-ffi_c-lib
    --without-ffi_c-lib=${ffi_c-dir}/lib
    --enable-system-libffi
    --disable-system-libffi
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
    --with-ffi-dir
    --without-ffi-dir
    --with-ffi-include
    --without-ffi-include=${ffi-dir}/include
    --with-ffi-lib
    --without-ffi-lib=${ffi-dir}/lib
/usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:613:in `try_cpp'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:1124:in `block in have_header'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:971:in `block in checking_for'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:331:in `open'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:361:in `block in postpone'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:331:in `open'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:357:in `postpone'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:970:in `checking_for'
    from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/mkmf.rb:1123:in `have_header'
    from extconf.rb:10:in `system_libffi_usable?'
    from extconf.rb:42:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/ffi-1.13.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.13.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/ffi-1.13.1/gem_make.out

如何解决这个问题?

mkmf.log 文件给出:

~ % cat   /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/ffi-1.13.1/mkmf.log

package configuration for libffi is not found
"clang -o conftest -I/usr/local/Cellar/ruby/2.7.1_2/include/ruby-2.7.0/x86_64-darwin19 -I/usr/local/Cellar/ruby/2.7.1_2/include/ruby-2.7.0/ruby/backward -I/usr/local/Cellar/ruby/2.7.1_2/include/ruby-2.7.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/[email protected] /cdn-cgi/l/email-protection/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/usr/local/Cellar/ruby/2.7.1_2/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected] /cdn-cgi/l/email-protection/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected] /cdn-cgi/l/email-protection/lib -L/usr/local/opt/readline/lib     -lruby.2.7   "
In file included from conftest.c:1:
In file included from /usr/local/Cellar/ruby/2.7.1_2/include/ruby-2.7.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.7.1_2/include/ruby-2.7.0/ruby/ruby.h:29:
/usr/local/Cellar/ruby/2.7.1_2/include/ruby-2.7.0/ruby/defines.h:126:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */



- 编辑 -

我安装了 rbenv,但在 rbenv 上安装 ruby​​ 时出现以下错误:


BUILD FAILED (OS X 10.15.5 using ruby-build 20200520)

Inspect or clean up the working tree at /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/ruby-build.20200708153637.16832.69ltru
Results logged to /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/ruby-build.20200708153637.16832.log

Last 10 log lines:
checking build system type... x86_64-apple-darwin19.5.0
checking host system type... x86_64-apple-darwin19.5.0
checking target system type... x86_64-apple-darwin19.5.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/ruby-build.20200708153637.16832.69ltru/ruby-2.2.2':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details


对我有用的:gem install ffi

我遇到了上面的错误并发现这个帖子 https://stackoverflow.com/questions/19703465/ruby-ffi-gem-issue表明它可能与特定版本有关ffi宝石。更新 gem 解决了错误并允许我pod install.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pod install 给出与 ruby​​ gems 和 libffi 相关的错误 的相关文章

随机推荐

  • 在 gitlab-ci.yml 上动态设置工件路径/文件夹结构

    我有以下内容gitlab ci yml读取的文件package json使用jq https stedolan github io jq 处理器动态设置工件文件夹的变量名称 类似于 image node latest stages buil
  • Angular 2 - FormGroup ValueChanges 取消订阅

    我有一个带有 ValueChanges 事件的 FormGroup 当用户从组件的路由移动到另一个组件然后返回到该组件时 该事件不会从内存中释放 这意味着 如果用户离开组件然后返回组件 5 次 则 onFormChange 方法会触发 5
  • 在 IE 和 Chrome 中动态加载 jQuery

    我正在创建一个使用 jQuery 的外部小部件 而不是让用户单独包含它 我想检查它是否已加载 如果没有加载 则动态加载它 问题是我需要等到它加载后才能执行脚本的其余部分 这需要 IE 和 FF Chrome 处理不同的事件处理程序 如果我这
  • 帮助处理 Android 库项目中的自定义视图属性

    我在 Android 库项目中有一个自定义 PieTimer 视图 package com mysite android library pietimer public class PieTimerView extends View 我还有
  • Intel 指令文档中未使用 XMM 寄存器 0

    在 Intel x64 手册中 它说 32 位 SSE2 模式下有 XMM 寄存器 0 7 那么为什么 95 使用这些寄存器的指令会跳过 0 并使用 1 4 例如Intel的vol 2手册entry https www felixclout
  • 如何使用CSS为html字符添加边框颜色?

    我目前的任务是在显示某些数据时在不同颜色的 pandas DataFrame 表内创建检查 我找到了以下内容 p I will display span style color green 10004 span p p I will dis
  • 使用数组 eltype 实现采样器

    钩入rand过去更容易 我想我遵循了描述在文档中 https docs julialang org en v1 stdlib Random A simple sampler without pre computed data 1 但它似乎不
  • 禁止在 robots.txt 中使用动态 URL

    我们的网址是 http example com kitchen knife collection maitre universal cutting boards rana parsley chopper cheese slicer vege
  • 导出 Vim 折叠?

    如何从文件中导出 vim 折叠 以便将其传输到另一台机器 例如 假设我在文件中创建折叠并将其保存在本地计算机上 折叠 元数据去了哪里 我可以将其复制到另一台机器上 还是必须再次手动重新创建折叠 编辑 嗯 我注意到这可能是一个重复的问题 但仍
  • 将 SDP(字符串)拆分为 m 行以更改视频编解码器

    我希望最后有一个方法可以将 VP9 或 H 264 设置为 SDP 中的首选视频编解码器 所以我正在我的 SDP 中寻找 m 行 m video 9 UDP TLS RTP SAVPF 96 98 100 102 127 97 99 101
  • 无法创建Java虚拟机

    面临java虚拟机初始化的一些问题 当我使用root帐户时 我可以正常使用java 但是当我是用户帐户时 它会返回以下错误 user host JAVA HOME bin java version Error occurred during
  • SpriteKit didBeginContact 被调用但没有 didEndContact

    我有以下代码 didBeginContact contact 方法已被调用但未调用didEndContact contact FIXME This is a workaround until class vars are supported
  • 在没有数据库的情况下如何使用 Rails/Devise?

    我正在创建一个不使用数据库的 Rails 应用程序 相反 该模型是使用包装遗留系统的 Ruby API 进行管理的 我有一个 Ruby 调用 可以让我验证用户名 密码组合 在这种情况下是否可以使用 Devise 或其他现成的身份验证解决方案
  • 无法设置远程应答 sdp:无法下推传输描述:无法为通道设置 SSL 角色

    我正在使用 webRTC 构建一个支持音频通话的系统 它的工作原理如下 用户AcreateOffer then setLocalDescription与offer 用户BreceiveOffer then setRemoteDescript
  • 安装 mysql-community-server 时出现 GPG 密钥问题

    安装时mysql 社区服务器出现以下错误 Command sudo yum install mysql community server Error warning var cache yum x86 64 2 mysql57 commun
  • 我什么时候应该使用 PHP 会话、浏览器本地存储和 JavaScript 对象参数?

    什么时候适合使用现代基于 AJAX 的应用程序存储数据的多种不同方式 我希望能够为开发人员提供一些具体的指导方针 这是我到目前为止所看到的 而且越来越混乱 PHP 服务器端会话 PHP 会话数据可能是存储基于会话的信息的最古老的方法 我经常
  • 带有聚合数据的堆叠条形图 (ggplot2)

    我在使用 ggplot2 时遇到一些主要问题 尽管这对你来说可能是一个非常简单的问题 但我还无法正确回答 我读过一本 ggplot2 书 并且也在 stackoverflow 上查找 最初有一个由因子变量 国家 和二分变量组成的数据集 不幸
  • Visual Studio 链接器警告 LNK4098

    我有一个 dll 项目 在发布配置中构建该项目时 我收到以下警告 MSVCRT lib cinitexe obj 警告 LNK4098 默认库 msvcrtd lib 与其他库的使用冲突 使用 NODEFAULTLIB 库 这只是一个警告
  • C# linq 支持“反连接”语义吗?

    我用谷歌搜索了一段时间 没有找到直接的反连接语义示例 以 C LINQ 为例 如何做到这一点 An 反连接基本上 一组不包含在另一组数据中的数据可以表示为Linq与一个IEnumerable Except像这样 double numbers
  • pod install 给出与 ruby​​ gems 和 libffi 相关的错误

    我使用react native init 创建一个应用程序 并在iOS 文件夹中运行pod install 但是 我收到以下错误 System Library Frameworks Ruby framework Versions 2 6 u