【发布时间】:2020-07-21 19:10:19
【问题描述】:
Cocoapods 安装失败,
版本:
macOS Catalina 10.15.4
红宝石2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
自制2.2.6
宝石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 原生扩展。
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
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--没有-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:inblock 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:intry_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:inblock in checks_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:inopen'
来自 /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:inopen'
来自 /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:inchecking_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:insystem_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
如果你解决了这个问题?
【问题讨论】: