安装 libxml-ruby for Windows Ruby 版本 2.3.3 时出现问题.在 -lxml2 中缺少



我已经浏览了大多数涉及libxml-ruby gem安装问题的答案,但我陷入了这个问题,没有解决方案。我目前正在运行Ruby 2.3.3。

这是我正在使用的当前命令:

gem install libxml-ruby -- --with-xml2-lib=C:Ruby-2.3.3lib --with-xml2-include=C:Ruby-2.3.3include

由此产生的问题是:

checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,
/usr/local/include/libxml2,
/usr/include/libxml2... yes
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.

xmlParseDoc() 在 Parser.h 中,但在我找不到的地方丢失了。有没有其他人遇到同样的问题,并找到了解决方案?


当我使用相同的命令降级到 libxml-ruby 2.7 时,我让它工作了。我仍然想弄清楚为什么无法安装新版本。我最终需要导致此问题的 2.8.0 或更高版本。

我终于找到了解决方案。对我有用的是我首先按照此解决方案中的说明进行操作。在我不得不去寻找一些从libiconv丢失的碎片之后;我从这里得到了这些。我提取了它的库并包含内容,就像上面的解决方案一样(lib 到 Ruby lib,包含在 Ruby 包含中)。在我不得不更改编码中的#include <iconv.h>之后.h。这需要更改为#include <path-to-/iconv.h>,之前已提取到 Ruby 的包含目录中。我能够跑gem install libxml-ruby -- with-xml2-include=C:/Ruby23/include/libxml2 --with-iconv-include=C:/Ruby23/include.

最新更新