错误Rails - libxml-Ruby

时间:2014-03-09 18:02:59

标签: ruby-on-rails ruby libxml2 activemerchant

在设置我的活跃商家git时,我一直在努力解决安装libxml-ruby的错误。我多次用Google搜索错误的所有组成部分,但我只是不确定我在看什么。有一堆“不” - 有人知道如何解释我可能缺少的东西吗?

Building native extensions.  This could take a while...
ERROR:  Error installing libxml-ruby:
ERROR: Failed to build gem native extension.

/Users/tommynicholas/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in     /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... 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=/Users/tommynicholas/.rvm/rubies/ruby-2.1.1/bin/ruby
--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-xml2-config
--without-xml2-config
--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 /Users/tommynicholas/.rvm/rubies/ruby-    2.1.1/lib/ruby/gems/2.1.0/gems/libxml-ruby-2.7.0 for inspection.
Results logged to /Users/tommynicholas/.rvm/rubies/ruby-    2.1.1/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0/libxml-ruby-2.7.0/gem_make.out

1 个答案:

答案 0 :(得分:19)

  

检查/ opt / include / libxml2中的libxml / xmlversion.h,/ usr / local / include / libxml2,/ usr / include / libxml2 ...否

告诉我你可能遗漏了libxml2

尝试安装它:

sudo apt-get install libxml2-dev

好吧,正如@TommyNicholas所要求的那样,我将尝试解释为什么我放大了libxml2所有其他人 - 这有点像直觉,但我有一些线索:

  1. 这是安装声明失败之前的最后一行,因此该行很有可能成为一个严重错误(安装在其他失败之后继续......)它可能不是唯一的一个,但它值得注意。
  2. 错误消息显示它在libxml2/opt/include//usr/local/include/下搜索了usr/include/ - 并且没有找到它,因此可以说它不是安装。
  3. installing Nokogiri时会发生类似的错误,因此尝试相同的解决方案并没有什么坏处。
  4. 无论如何,如果所有其他方法都失败了 - RTFM - 虽然我的猜测有效,但下一步是阅读错误消息,提示日志中可能有更完整的报告 - mkmg.log
  5.   

    检查mkmf.log文件以获取更多详细信息。