在类似的问题上有几个主题,但没有一个被证明有效。我试图在github页面上询问没有运气。
当我尝试标准命令时:
gem install libxml-ruby
我收到安装程序找不到libxml2.dll的错误。我找到了一个类似问题的stackoverflow线程,并遵循用户指南here,了解哪里可以获取缺少的库以及在哪里包含它们。
如果我使用以下命令在install命令中添加参数以指向缺少库的目录:
gem install libxml-ruby -- with-xml2-include=C:\Ruby200\include\libxml2 --with-iconv-include=C:\Ruby200\include
我现在遇到一个错误,安装程序无法在我的C:\ Ruby200 \ include目录中找到“iconv.h”标题。
C:\Users\gonz102>gem install libxml-ruby -- with-xml2-include=C:/Ruby200/include
/libxml2 --with-iconv-include=C:/Ruby200/include
Temporarily enhancing PATH to include DevKit...
Building native extensions with: 'with-xml2-include=C:/Ruby200/include/libxml2 -
-with-iconv-include=C:/Ruby200/include'
This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb with-xml2-include=C:/Ruby200/include/libx
ml2 --with-iconv-include=C:/Ruby200/include
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libx
ml2,/usr/local/include/libxml2,/usr/include/libxml2... yes
checking for xmlParseDoc() in -lxml2... yes
checking for rb_io_bufwrite() in ruby/io.h... yes
creating extconf.h
creating Makefile
make "DESTDIR="
compiling libxml.c
In file included from C:/Ruby200/include/libxml2/libxml/parser.h:810:0,
from ruby_libxml.h:7,
from libxml.c:1:
C:/Ruby200/include/libxml2/libxml/encoding.h:28:19: fatal error: iconv.h: No suc
h file or directory
compilation terminated.
make: *** [libxml.o] Error 1
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/libxml-ru
by-2.9.0 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/libxml-ruby-2.9.0/ext/libx
ml/gem_make.out
如果有人对下一步调查或可能的解决方案有什么建议,我会非常感激。我已经被这个问题困住了很长一段时间,每当我遇到一个libxml的项目时都会回来,很乐意接受任何建议。
非常感谢。
答案 0 :(得分:0)
我没有成功安装libxml版本2.9.0但2.7.0工作正常。我应该指定我运行的是Windows 7和Ruby 2.0 32位。以下是我必须做的事情:
- 我跟着Wik的回复here,抓住了mingw64中所有丢失的库。不可否认,我不确定我是否需要所有这些,但我在这里采取了一种霰弹枪的方法。
在我的系统路径中添加了以下内容:
Ruby200\lib\ruby\gems\2.0.0\gems\libxml-ruby-2.7.0-x86-mingw32\lib\libs
在命令行中执行以下命令:
gem install libxml-ruby -v2.7.0 -- with-xml2-include:=C/Ruby200/include/libxml2 --with-iconv-include:=C:/Ruby200/include
在那之后,我终于安装了宝石并且实际上可以使用。