无法安装最新的 cocoapods 版本

时间:2021-03-26 10:24:07

标签: ios macos flutter cocoapods

我正在构建一个 flutter 项目,我需要 cocoapods 1.9.0 及更高版本,以下对我不起作用,

<块引用>

sudo gem 安装 cocoapods

所以我用了这个:

<块引用>

brew 安装 cocoapods

上述命令安装了 1.5.2 版,但我需要最新的。在某些时候我使用了命令:

<块引用>

sudo gem install -n /usr/local/bin cocoapods -v 1.8.4

但这只能安装 1.8.4 版,不适用于更高版本。如何在安装了 xcode 的 MacOs Catalina 10.15.7 上安装 cocoapods 1.10.0 版。

这是我运行 sudo gem install cocoapods 时得到的错误:

<块引用>

构建原生扩展。这可能需要一段时间......错误:错误 安装 cocoapods:错误:无法构建 gem 本机扩展。

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210326-11779-qtgmlh.rb extconf.rb 检查 ffi.h... *** extconf.rb 失败 *** 无法 由于某种原因创建 Makefile,可能缺乏必要 库和/或头文件。检查 mkmf.log 文件以获取更多详细信息。 您可能需要配置选项。

提供的配置选项:--with-opt-dir --without-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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/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 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in try_compile 中的块'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in with_werror' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in try_compile' 来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in block in have_header' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in 阻止checking_for'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block (2 levels) in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in 打开'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in 打开'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in checking_for'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in have_header' from extconf.rb:10:in system_libffi_usable?'从 extconf.rb:42:in`'

要了解为什么这个扩展编译失败,请查看 mkmf.log 可以在这里找到:

/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.15.0/mkmf.log

extconf 失败,退出代码 1

Gem 文件将保持安装在 /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0 用于检查。结果 登录 /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.15.0/gem_make.out

0 个答案:

没有答案