Rails Installing libxml2 on Windows

两盒软妹~` 提交于 2019-12-24 10:47:54

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/6834366/rails-installing-libxml2-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!