gpt4 book ai didi

ruby-on-rails - 在 Windows 上安装 libxml-ruby 时遇到问题

转载 作者:可可西里 更新时间:2023-11-01 11:18:49 28 4
gpt4 key购买 nike

首先感谢您的宝贵时间。

我在 Windows 8 操作系统上安装 libxml-ruby 时遇到了一些问题。我已经安装了 ruby​​,并且想专门使用 libxml 来修改 xml,因为我团队的其他成员已经开始使用 libxml。问题是他们使用的是 linux 而我使用的是 Windows。我可以尝试将所有内容都放在虚拟机上,但我认为我不需要这样做。

他们在 linux 上安装也有问题,但他们的解决方案和问题与我的不同。

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 二进制文件。这并没有真正帮助。

所以现在我在谷歌搜索 :)

最佳答案

好吧,我终于厌倦了自己遇到这个问题(并最终放弃并转向虚拟机)。所以我花了一些时间摆弄,终于找到了一种可靠的方法来在 Windows 上安装 Ruby(目前为 2.2.3)和 libxml-ruby。

  1. 从 ruby​​installer.org 下载并安装适用于您的体系结构的最新 Ruby
  2. 从同一页面下载匹配的 DevKit
  3. 提取 DevKit 并按照安装说明进行操作,特别是 step 4
  4. 复制zlib1.dll来自 <ruby_install_dir>/bin<ruby_install_dir>/lib
  5. 下载MinGW iconv package并提取 mingw64/lib 中的所有内容至 <ruby_install_dir>/lib
  6. 下载适用于 Windows 的 libxml(见下文)。提取其 lib 的内容进入你的<ruby_install_dir>/lib include的内容目录进入 <ruby_install_dir>/include
  7. 祝你好运,gem install libxml-ruby现在应该可以工作了,但是您可能不得不尝试对安装程序使用一些不同的参数。最终我需要 gem install libxml-ruby -- with-xml2-include=C:\Ruby22-x64\include\libxml2 --with-iconv-include=C:\Ruby22-x64\include

因为 StackOverflow 只允许我在一个答案中发布两个链接;

我在
找到了适用于 Windows 的 64 位版本的 libxml https://forge.imag.fr/frs/?group_id=184&release_id=320

另一种可能是 ftp://ftp.zlatkovic.com/libxml/64bit/

但这两个似乎都不是官方来源,所以不能保证当您阅读本文时它会存在;)

关于ruby-on-rails - 在 Windows 上安装 libxml-ruby 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22417544/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com