错误:安装导轨时出错: 错误:无法构建gem本机扩展。
current directory: /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.10.1/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20190304-9093-ehjkih.rb extconf.rb 检查C编译器是否接受-I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2 ... * 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
--with-make-prog
--srcdir =。
--curdir
--ruby = /系统/库/框架/Ruby.framework/版本/2.3/usr/bin/$(RUBY_BASE_NAME)
- 救命
- 清洁
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:在try_compile的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.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in
块中'
来自/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:522:in with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in
try_compile'
来自extconf.rb:138:在nokogiri_try_compile'
from extconf.rb:162:in
的add_cflags块中
来自/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:629:in with_cflags'
from extconf.rb:161:in
add_cflags'
来自extconf.rb:416:in''
要查看此扩展为何无法编译,请检查mkmf.log,该文件可在此处找到:
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-16/2.3.0/nokogiri-1.10.1/mkmf.log
extconf失败,退出代码1
宝石文件将保留安装在/Library/Ruby/Gems/2.3.0/gems/nokogiri-1.10.1中进行检查。 结果记录到/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-16/2.3.0/nokogiri-1.10.1/gem_make.out
答案 0 :(得分:0)
首先,运行此命令
sudo apt-get -f install
然后,运行此命令
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
这将安装依赖项。 gem本机扩展成功构建。