CocoaPods在M1芯片(Apple Silicon)上失败,显示ffi错误的架构。

86

在 M1 MacBook 上运行 'pod install' 失败了,因为出现了 ffi 问题,如 这里所述。

我尝试了一些解决方法(我想我按不同的顺序都试过了),但现在我得到了一个稍微不同的错误:

LoadError - dlopen(/opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture
    /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture - /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle

看起来我现在有了ffi,但是架构不对?我该怎么办?无论是否在Rosetta模式下运行终端都会发生这种情况。

顺便说一句,其中一个提出的解决方法对我没有成功。当我尝试:

sudo arch -x86_64 gem install ffi

我理解为:

arch: posix_spawnp: gem: Bad CPU type in executable

不确定这是否相关。

12个回答

1

这描述了我遇到的确切问题。但是,所有解决方案都没有起作用。最终,以下内容帮助我解决了问题:

   brew unlink libyaml && brew link libyaml
   brew unlink openssl && brew link --force openssl

Reference: https://dev59.com/umUo5IYBdhLWcg3w1yPH#24902917


0

只需运行此代码,问题已经解决

brew uninstall --ignore-dependencies ruby

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接