Rails 在 Windows 上安装 libxml2
当我运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 Windows 上遇到了类似的问题,并且以下命令有效。
但是,请注意,要使其正常工作,您应该已在指定的路径中包含 libxml2 程序集,并且不要使用带有空格或引号内的路径。
I had a similar issue on windows and the following command worked.
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.
我也尝试在 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.