RubyGems 在 Fedora 23 上构建本机扩展失败
RubyGems Building Native Extensions Fails on Fedora 23
首先我尝试:
gem install rails
它产生:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--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=/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:571:in `block in try_compile'
from /usr/share/ruby/mkmf.rb:522:in `with_werror'
from /usr/share/ruby/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /usr/share/ruby/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `<main>'
Gem files will remain installed in /home/hagoth/.gem/ruby/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /home/hagoth/.gem/ruby/gems/nokogiri-1.6.7.2/ext/nokogiri/gem_make.out
我已经使用 sudo dnf install ruby-devel
安装了开发工具,也尝试过使用 rvm requirements
并且在过去的五个小时左右的时间里,我一直在尝试其他晦涩难懂的在线解决方案。 None 其中似乎有效。我缺少一些简单明显的解决方案吗?我相当确定依赖关系在那里。虽然我可能是错的。
运行 Fedora 23 的 32 位版本,如果这意味着什么。
更新:
/home/username/.gem/ruby/gems/nokogiri-1.6.7.2/ext/nokogiri/mkmf.log
的内容是:
"gcc -o conftest -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -m32 -lruby -lpthread -ldl -lcrypt -lm -lc "
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
我不是相当 确定为什么包的构建脚本正在寻找它找不到的特定文件,但它是由 redhat-rpm-config
包提供的。我很确定默认情况下应该在 Fedora Workstation 上。无论如何,由于您是在系统上构建软件,我建议确保安装了以下组:
sudo dnf groupinstall development-tools rpm-development-tools c-development
这将解决这个特定问题,并确保您安装了其他基本 "native" 构建基础结构工具。
我除了@mattdm 的回答,它解决了失败的问题:
vagrant plugin install vagrant-livbirt
因为存在一些包依赖性问题。所以使用上面的命令将解决这个问题!
首先我尝试:
gem install rails
它产生:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--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=/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:571:in `block in try_compile'
from /usr/share/ruby/mkmf.rb:522:in `with_werror'
from /usr/share/ruby/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /usr/share/ruby/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `<main>'
Gem files will remain installed in /home/hagoth/.gem/ruby/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /home/hagoth/.gem/ruby/gems/nokogiri-1.6.7.2/ext/nokogiri/gem_make.out
我已经使用 sudo dnf install ruby-devel
安装了开发工具,也尝试过使用 rvm requirements
并且在过去的五个小时左右的时间里,我一直在尝试其他晦涩难懂的在线解决方案。 None 其中似乎有效。我缺少一些简单明显的解决方案吗?我相当确定依赖关系在那里。虽然我可能是错的。
运行 Fedora 23 的 32 位版本,如果这意味着什么。
更新:
/home/username/.gem/ruby/gems/nokogiri-1.6.7.2/ext/nokogiri/mkmf.log
的内容是:
"gcc -o conftest -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -m32 -lruby -lpthread -ldl -lcrypt -lm -lc "
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
我不是相当 确定为什么包的构建脚本正在寻找它找不到的特定文件,但它是由 redhat-rpm-config
包提供的。我很确定默认情况下应该在 Fedora Workstation 上。无论如何,由于您是在系统上构建软件,我建议确保安装了以下组:
sudo dnf groupinstall development-tools rpm-development-tools c-development
这将解决这个特定问题,并确保您安装了其他基本 "native" 构建基础结构工具。
我除了@mattdm 的回答,它解决了失败的问题:
vagrant plugin install vagrant-livbirt
因为存在一些包依赖性问题。所以使用上面的命令将解决这个问题!