我知道有很多类似的问题,但他们的答案都没有帮助我解决这个问题。我以前安装它没有任何问题,在6个月之后,我再次尝试bundle install
并且它失败了。
这就是我得到的,看起来和其他人一样:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/ubuntu/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160625-23682-1ebh39x.rb extconf.rb --use-system-libraries
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=/home/ubuntu/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /home/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /home/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /home/ubuntu/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `<main>'
extconf failed, exit code 1
而mkmf.log
是:
"gcc -o conftest -I/home/ubuntu/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0 -I. -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -fPIC conftest.c -L. -L/home/ubuntu/.rvm/rubies/ruby-2.2.1/lib -Wl,-R/home/ubuntu/.rvm/rubies/ruby-2.2.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,'/../lib' -Wl,-R'/../lib' -lruby -lpthread -ldl -lcrypt -lm -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
正如我在mkmf.log
中看到的那样,它没有告诉任何与我在StackOverflow上发现的其他问题不同的错误。
我安装了我在互联网上知道或提到的所有依赖项,例如libxml2, libxml2-dev, libxslt-dev, ruby-dev, zlib1g-dev, liblzma-dev, libgmp-dev, patch
。
我很丢失,因为我没有做任何事情,而不是试图将我的所有代码和部署资产移动到其他目录。我所做的完全是我注册了新的ESB并将其安装到实例中然后我创建了一个符号链接来将我当前的路径映射到该挂载点。
编辑1:
我实际上可以通过gem gem install nokogiri -v '1.6.7'
成功安装。但是bundle install
失败了。