我第一次使用gem'游戏盒'而且我遇到了问题。我安装了gem并生成了指南指示我的模板,但是当我尝试捆绑它时,它会抛出下面详述的错误。
$ bundle install --path lib/dependencies
Fetching gem metadata from https://rubygems.org/.bundle install --path lib/dependencies
.......
Resolving dependencies...
Using rake 0.9.2.2
Using hitimes 1.2.2
Using timers 4.0.1
Using celluloid 0.16.0
Using conject 0.1.8
Using cri 2.1.0
Using diff-lcs 1.2.5
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -llibiconv... no
checking for iconv_open() in -llibiconv... no
checking for iconv_open() in -lc... yes
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
checking for xmlParseDoc() in -lxml2... no
*** 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/ruby2.1
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-socketlib
--without-socketlib
--with-nsllib
--without-nsllib
--with-mlib
--without-mlib
--with-zlib
--without-zlib
--with-iconvlib
--without-iconvlib
--with-iconvlib
--without-iconvlib
--with-libiconvlib
--without-libiconvlib
--with-libiconvlib
--without-libiconvlib
--with-clib
--without-clib
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xml2lib
--without-xml2lib
--with-libxml2lib
--without-libxml2lib
--with-xml2lib
--without-xml2lib
extconf failure: need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-config=/path/to/xml2-config
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
extconf failed, exit code 1
Gem files will remain installed in /home/user_id/company_office/lib/dependencies/ruby/2.1.0/gems/libxml-ruby-2.8.0 for inspection.
Results logged to /home/user_id/company_office/lib/dependencies/ruby/2.1.0/extensions/x86_64-linux/2.1.0/libxml-ruby-2.8.0/gem_make.out
An error occurred while installing libxml-ruby (2.8.0), and Bundler cannot
continue.
Make sure that `gem install libxml-ruby -v '2.8.0'` succeeds before bundling.
我尝试使用gem install libxml-ruby -v '2.8.0'
以及输出以下内容的sudo gem install libxml-ruby -v '2.8.0'
:
$ gem install libxml-ruby -v '2.8.0'
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /var/lib/gems/2.1.0/gems/libxml-ruby-2.8.0/HISTORY
我对ruby和linux很新,所以如果这是一个愚蠢的问题,请道歉。 谢谢
答案 0 :(得分:4)
看起来你缺少必需的C库。我猜你需要安装libxml2-dev(或者你在Linux的包管理器中调用的任何东西)。