Rails 在 Windows 上安装 libxml2

发布于 2024-11-26 14:15:39 字数 1219 浏览 0 评论 0原文

当我运行 bundle install 时,出现以下错误:

Using activeresource (3.0.3)
Installing libxml-ruby (1.1.4) with native extensions C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions': ERROR: Failed to build gem native extension. (
Gem::Installer::ExtensionBuildError)

    C:/RailsInstaller/Ruby1.8.7/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... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no  extconf failure: need libxml2.

Install the library or try one of the following options to extconf.rb:

  --with-xml2-config=/path/to/xml2-config
  --with-xml2-dir=/path/to/libxml2
  --with-xml2-lib=/path/to/libxml2/lib
  --with-xml2-include=/path/to/libxml2/include

我知道缺少什么,但不知道如何解决此问题。提前致谢。

When I run bundle install, I get the following error:

Using activeresource (3.0.3)
Installing libxml-ruby (1.1.4) with native extensions C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions': ERROR: Failed to build gem native extension. (
Gem::Installer::ExtensionBuildError)

    C:/RailsInstaller/Ruby1.8.7/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... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no  extconf failure: need libxml2.

Install the library or try one of the following options to extconf.rb:

  --with-xml2-config=/path/to/xml2-config
  --with-xml2-dir=/path/to/libxml2
  --with-xml2-lib=/path/to/libxml2/lib
  --with-xml2-include=/path/to/libxml2/include

I understand what's missing, but I don't understand how to resolve this. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

仅此而已 2024-12-03 14:15:39

我在 Windows 上遇到了类似的问题,并且以下命令有效。

gem install libxml-ruby -- --with-xml2-include=C:\ruby-1.9.2\include\libxml2

但是,请注意,要使其正常工作,您应该已在指定的路径中包含 libxml2 程序集,并且不要使用带有空格或引号内的路径。

I had a similar issue on windows and the following command worked.

gem install libxml-ruby -- --with-xml2-include=C:\ruby-1.9.2\include\libxml2

However, note that for this to work, you should already have the libxml2 assemblies in the path specified and don't use a path with spaces or within quotes.

我ぃ本無心為│何有愛 2024-12-03 14:15:39

我也尝试在 Windows 上运行 Rails,记得有这个问题,但不记得我做了什么,但快速 Google 搜索发现了这个链接: http://gnuwin32.sourceforge.net/packages/libxml2.htm

告诉您如何下载适用于 Windows 的 libxml2。

I tried running Rails on Windows too and remember having this issue but don't remember what I did, but a quick Google search found this link: http://gnuwin32.sourceforge.net/packages/libxml2.htm

Tells you how to download libxml2 for Windows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文