为 Windows Ruby 版本 2.3.3 安装 libxml-ruby 问题。 -lxml2 中缺少 xmlParseDoc()

Issue installing libxml-ruby for Windows Ruby version 2.3.3. Missing xmlParseDoc() in -lxml2

我查看了大多数涉及 libxml-ruby gem 安装问题的答案,但我在这个问题上卡住了,没有解决方案。我目前 运行ning Ruby 2.3.3。

这是我当前使用的命令:

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

由此产生的问题是:

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 或更高版本,这导致了这个问题。

我终于找到了解决办法。对我有用的是我首先按照 solution. After I had to go find some of the missing pieces from libiconv; I got those from here 中的说明进行操作。我提取了它的 lib 并包含内容,就像上面的解决方案一样(lib 到 Ruby lib,包含到 Ruby include)。在我不得不在 encoding.h 中更改 #include <iconv.h> 之后。这需要更改为 #include <path-to-/iconv.h>,之前已将其提取到 Ruby 的包含目录中。我能够 运行 gem install libxml-ruby -- with-xml2-include=C:/Ruby23/include/libxml2 --with-iconv-include=C:/Ruby23/include.