【问题标题】:Rails 3: Bundle install fails on Nokogiri gem, says libxml2Rails 3:在 Nokogiri gem 上捆绑安装失败,libxml2 说
【发布时间】:2011-05-30 01:41:08
【问题描述】:

您好,我正在尝试在我的 Windows 机器上设置开发环境。我已经通过 cygwin 安装了 ruby​​gems。当我运行 bundle install 时,安装 nokogiri gem 时出错。它说我缺少 libxml2。

当我访问 nokogiri 网站时,他们说“gem install nokogiri”应该可以满足我在 Windows 上所需的一切。但是,运行它只会给我与捆绑安装相同的错误。

Installing nokogiri (1.4.4) with native extensions /usr/lib/ruby/site_ruby/1.8/r
ubygems/installer.rb:543:in `build_extensions': ERROR: Failed to build gem nativ
e extension. (Gem::Installer::ExtensionBuildError)

        /usr/bin/ruby.exe extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokog
iri.html for help with installing dependencies.
-----
*** 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
$
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-iconv-dir
        --without-iconv-dir
        --with-iconv-include
        --without-iconv-include=${iconv-dir}/include
        --with-iconv-lib
        --without-iconv-lib=${iconv-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4 fo
r inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4/ext/nokogiri/gem_ma
ke.out
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `each'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `build_ext
ensions'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:177:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:10
1:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:279:in `preserve_paths'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:91
:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:58:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:93:in `with_build_args'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:57:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:49:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:8:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/cli.rb:270:i
n `update'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `send'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
invocation.rb:118:in `invoke_task'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor.
rb:246:in `dispatch'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
base.rb:389:in `start'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/bin/bundle:13
        from /usr/bin/bundle:19:in `load'
        from /usr/bin/bundle:19

【问题讨论】:

    标签: windows rubygems nokogiri bundler libxml2


    【解决方案1】:

    我在 Ubuntu 11.04 上遇到了同样的错误,并通过安装 libxml2-dev 包解决了它。

    【讨论】:

      【解决方案2】:

      如果安装 liblxml12-dev 软件包后无法修复,请尝试安装 libxslt-dev。它解决了我的问题 (http://nokogiri.org/tutorials/installing_nokogiri.html)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-12-21
        • 2011-09-10
        • 2019-09-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-29
        • 2015-12-28
        相关资源
        最近更新 更多