Nokogiri'运行软件包安装时'无法构建gem本机扩展' [英] Nokogiri 'Failed to build gem native extension' when I run bundle install

查看:198
本文介绍了Nokogiri'运行软件包安装时'无法构建gem本机扩展'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 bundle install ,并且出现此错误:

 使用系统库构建nokogiri。 

Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --use-system-libraries
使用系统库构建nokogiri。
libxml2版本2.6.21或更高版本是必需的!
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。

提供的配置选项:
--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 = / System / Library / Frameworks / Ruby.framework / Versions / 2.0 / usr / bin / ruby​​
--help
--clean
--use-system-libraries
--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-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include = $ {xml2-dir} / include
--with-xml2-lib
--without-xml2-lib = $ {xml2-dir} / lib
--with-libxml-2.0-config
--without-libxml -2.0-config
--with-pkg-config
--without-pkg-config
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include = $ {xslt-dir} / include
--with-xslt-lib
--without-xslt- lib = $ {xslt-dir} / lib
--with-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt- include = $ {exslt-dir} / include
--with-exslt-lib
--without-exslt-lib = $ {exslt-dir} / lib
--with-libexslt -config
--without-libexslt-config
--with-pkg-config
--without-pkg-config

extconf失败,退出代码1

Gem文件将保留安装在/Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.2.rc2中进行检查。
结果记录到/Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.2.rc2/gem_make.out
安装nokogiri(1.6.2.rc2)时发生错误,并且Bundler无法继续。
确保在捆绑之前,gem install nokogiri -v'1.6.2.rc2'`成功。

任何想法可能是这样吗?

编辑:



我也按照教程中的说明,奇怪的是宝石已成功安装。当我运行 gem list 时,我有 nokogiri(1.6.2.1),但是当运行

解决方案

上面的建议并没有帮助我,这里是针对OS 10.9的解决方案:

  brew install libxml2 
bundle config build.nokogiri--use-system-libraries - -with-xml2-include = / usr / local / opt / libxml2 / include / libxml2
bundle install


I'm running bundle install and I'm getting this error:

Building nokogiri using system libraries.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --help
    --clean
    --use-system-libraries
    --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-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-libxslt-config
    --without-libxslt-config
    --with-pkg-config
    --without-pkg-config
    --with-exslt-dir
    --without-exslt-dir
    --with-exslt-include
    --without-exslt-include=${exslt-dir}/include
    --with-exslt-lib
    --without-exslt-lib=${exslt-dir}/lib
    --with-libexslt-config
    --without-libexslt-config
    --with-pkg-config
    --without-pkg-config

extconf failed, exit code 1

Gem files will remain installed in /Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.2.rc2 for inspection.
Results logged to /Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.2.rc2/gem_make.out
An error occurred while installing nokogiri (1.6.2.rc2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.rc2'` succeeds before bundling.

Any ideas what could this be?

EDIT:

I also have installed nokogiri following the instructions in the tutorial, and the weird thing is that the gem was successfully installed. When I run gem list, I have nokogiri (1.6.2.1), but when running bundle install it displays the error.

解决方案

Advises above didn't help me, here is the solution for OS 10.9:

brew install libxml2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install

这篇关于Nokogiri'运行软件包安装时'无法构建gem本机扩展'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆