【问题标题】:Error Rails - libxml-Ruby错误 Rails - libxml-Ruby
【发布时间】:2014-04-12 17:08:43
【问题描述】:

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

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

【问题讨论】:

  • brew install libxml2 在 macos 上

标签: ruby-on-rails ruby libxml2 activemerchant


【解决方案1】:

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

告诉我你可能会错过libxml2

尝试安装它:

sudo apt-get install libxml2-dev

嗯,按照@TommyNicholas 的要求,我将尝试解释为什么我将libxml2 放大到了所有其他人中 - 这有点直觉,但我有一些线索:

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

查看 mkmf.log 文件了解更多详情。

【讨论】:

  • (仅供参考)我在 Mac 上,所以我猜是 brew install libxml2 - 似乎已经修复了它。当我确定但你似乎是救世主 Uri 时会更新。
  • 是的!修复它 - 你能告诉我你是怎么知道这是问题所在吗?我看到了那条线,但你怎么知道是什么阻止了这个过程?我觉得对答案的补充确实对将来阅读本文的人最有帮助。
猜你喜欢
  • 1970-01-01
  • 2017-06-15
  • 2014-04-17
  • 1970-01-01
  • 2012-02-01
  • 2011-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多