在 Windows 上安装 libxml-ruby 时遇到问题 [英] Having trouble installing libxml-ruby on windows
问题描述
首先感谢您的时间.
我在 Windows 8 操作系统上安装 libxml-ruby 时遇到了一些问题.我已经安装了 ruby 并且想要专门使用 libxml 来修改 xmls,因为我团队的其他成员已经开始使用 libxml.问题是他们使用的是 linux 而我使用的是 Windows.我可以尝试将所有内容都放在虚拟机上,但我认为我不需要这样做.
I've been having some trouble installing libxml-ruby on my windows 8 OS. I have ruby installed and want to use libxml specifically to modify xmls because other members of my team have already started with libxml. The problem is that they were using linux and I'm on windows. I could try to put everything on a vm but I don't think I should need to.
他们在 linux 上安装也有问题,但他们的解决方案和问题与我的不同.
They had issues installing on linux too but their solution and problem was different from mine.
C:\dev\school\ece450\MyBPM>gem install libxml-ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe 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... no
checking for inflate() in -lzlib... no
checking for inflate() in -lzlib1... no
checking for inflate() in -llibz... 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=C:/Ruby200/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}/
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/
--with-socketlib
--without-socketlib
--with-nsllib
--without-nsllib
--with-mlib
--without-mlib
--with-zlib
--without-zlib
--with-zliblib
--without-zliblib
--with-zlib1lib
--without-zlib1lib
--with-libzlib
--without-libzlib
extconf failure: need zlib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/libxml-ru
by-2.7.0 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/extensions/x86-mingw32/2.0.0/li
bxml-ruby-2.7.0/gem_make.out
我尝试安装 zlib(二进制文件)并指向 zlib 二进制文件.这并没有真正的帮助.
I have tried installing zlib (binaries) and pointing to the zlib binary. That didn't really help.
所以现在我在谷歌搜索:)
So now I'm googling :)
推荐答案
好吧,我终于厌倦了自己遇到这个问题(最终放弃并转向 VM).所以我花了一些时间摆弄,终于找到了一种在 Windows 上安装 Ruby(截至目前为 2.2.3)和 libxml-ruby 的可靠方法.
Alright, I finally got sick of running into this issue myself (and eventually giving up and moving to a VM). So I spent some time fiddling around and finally got a reliable way to get install Ruby (2.2.3 as of now) and libxml-ruby on Windows.
- 从 rubyinstaller.org 下载并安装适用于您的架构的最新 Ruby
- 从同一页面下载匹配的 DevKit
- 提取 DevKit 并按照设置说明进行操作,特别是 第 4 步
- 将
zlib1.dll
从
复制到/bin /lib - 下载 MinGW iconv打包并将
mingw64/lib
中的所有内容解压到/lib - 下载适用于 Windows 的 libxml(见下文).将其
lib
的内容提取到您的<ruby_install_dir>/lib
和 将其include
目录的内容提取到/include - 幸运的是,
gem install libxml-ruby
现在应该可以工作了,但您可能需要尝试一些不同的安装程序参数.最终我需要gem install libxml-ruby -- with-xml2-include=C:\Ruby22-x64\include\libxml2 --with-iconv-include=C:\Ruby22-x64\include
- Download and install the latest Ruby for your architecture from rubyinstaller.org
- Download the matching DevKit from the same page
- Extract the DevKit and follow the setup instructions, particularly step 4
- Copy
zlib1.dll
from<ruby_install_dir>/bin
to<ruby_install_dir>/lib
- Download the MinGW iconv package and extract everything in
mingw64/lib
to<ruby_install_dir>/lib
- Download libxml for windows (see below). Extract the contents of its
lib
into your<ruby_install_dir>/lib
and the contents of itsinclude
directory into<ruby_install_dir>/include
- With luck,
gem install libxml-ruby
should now work, but odds are you'll probably have to try some different arguments to the installer. Ultimately I neededgem install libxml-ruby -- with-xml2-include=C:\Ruby22-x64\include\libxml2 --with-iconv-include=C:\Ruby22-x64\include
<小时>
由于 StackOverflow 只允许我在答案中发布两个链接;
Since StackOverflow only lets me post two links in an answer;
我在
找到了适用于 Windows 的 64 位版本的 libxmlhttps://forge.imag.fr/frs/?group_id=184&release_id=320
另一种可能是ftp://ftp.zlatkovic.com/libxml/64bit/
但似乎都不是官方来源,所以不能保证当你阅读这篇文章时它会出现;)
but neither seem to be an official source, so no guarantees that it'll be around when you read this ;)
这篇关于在 Windows 上安装 libxml-ruby 时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!