gpt4 book ai didi

ruby - Cocoapods 安装失败,无法构建 gem native 扩展

转载 作者:行者123 更新时间:2023-12-03 09:47:30 27 4
gpt4 key购买 nike

Cocoapods 安装失败,

版本:

macOS Catalina 10.15.4
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
自制 2.2.6
gem 3.1.2

gem sources -l

*** CURRENT SOURCES ***
https://gems.ruby-china.com
sudo gem install cocoapod

或者
sudo gem install -n /usr/local/bin cocoapods

错误结果:

构建原生扩展。这可能需要一段时间...
错误:安装 cocoapods 时出错:
错误:无法构建 gem native 扩展。
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2/ext/ffi_c

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

提供的配置选项:
--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=/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
尝试编译'
来自/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
检查_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:34:in `'

要了解此扩展无法编译的原因,请查看 mkmf.log,可在此处找到:

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

extconf 失败,退出代码 1

Gem 文件将保留安装在/Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2 中以供检查。
结果记录到/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out

如果你解决了这个问题?

最佳答案

我通过运行修复了它

brew install cocoapods

您可能想要删除它:
rm '/usr/local/bin/pod'
要强制链接并覆盖所有冲突文件:
brew link --overwrite cocoapods
如果您还没有安装自制软件,请安装。 https://brew.sh/

关于ruby - Cocoapods 安装失败,无法构建 gem native 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61116512/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com