【问题标题】:Installing nokogiri failed in OS X 10.10.5在 OS X 10.10.5 中安装 nokogiri 失败
【发布时间】:2015-08-22 21:58:45
【问题描述】:

我正在按照 Github 的 Jekyll 安装说明进行操作 https://help.github.com/articles/using-jekyll-with-pages/

简单地发出 build install 最初无法编译 libxml2-2.9.2。日志显示它与我的系统库 /usr/local/lib/libiconv.dylib 不是 64 位有关:“文件 /usr/local/lib/libiconv.dylib 中缺少所需的架构 x86_64”。

提供库,如

gem install nokogiri -v '1.6.6.2' -- \
--with-xml2-include=/Applications/Dev/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2/ \
--with-iconv-include=/Applications/Dev/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/ \
--with-iconv-lib=/Applications/Dev/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib --use-system-libraries

在 Xcode 下,使用 iconv 解决了 64 位问题,但 在查找 libxml2 时系统性地失败。请参阅下面的日志。

我已经尝试了Error to install Nokogiri on OSX 10.9 Maverick? 中可以使用的所有选项 和 Nokogiri installation fails -libxml2 is missing 但无济于事。我还安装了 fink 和 libmxl2 并指向了那里的包含文件和库,但同时也失败了。

我有一个全新的 Xcode 6.4 更新,并确保发出 xcode-select --install。自制对我来说不是一个选择。

在我上次尝试使用 Xcode 库和包含路径的日志下方。

日志中提到的那个 mkmf.log 文件在哪里?从其他线程来看,我希望解决这个问题,似乎我已经接近它了,但是经过一天的处理,我现在看不到如何解决。

提前感谢您提供有关如何解决此问题的任何提示。

PS:我只是想尝试在 github 上写博客。难道所有这些 ruby​​ mambo-jambo 不应该比旧的 cmake、dpkg 等更容易吗?对于这种过多的包和版本管理器,每个都有自己的特质,我无法完全理解这种趋势。这种 rbenv、gem、bunlder 等方法在习惯之后会不会变得更可靠?还是它总是这么脆弱?只是想知道是否值得努力熟悉这一切..

PS2:安装日志,由 ~/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/nokogiri-1.6.6.2/gem_make.out

/Users/masl/.rbenv/versions/2.1.0/bin/ruby -r ./siteconf20150822-64326-2krxl7.rb extconf.rb --with-xml2-include=/Applications/Dev/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2/ --with-iconv-include=/Applications/Dev/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/ --with-iconv-lib=/Applications/Dev/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib --use-system-libraries
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using system libraries.
libxml2 version 2.9.2 or later is highly recommended, but proceeding anyway.
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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=/Users/masl/.rbenv/versions/2.1.0/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=${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
    --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-xml2lib
    --without-xml2lib
    --with-libxml2lib
    --without-libxml2lib

extconf failed, exit code 1

【问题讨论】:

  • 也许你需要指定--with-xml2-lib=/Applications/Dev/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib
  • 另外,请注意以下行:libxml2 version 2.9.2 or later is highly recommended, but proceeding anyway.。我认为 xcode 带有 2.2 版。
  • @Adrian 谢谢,成功了!顺便说一句,为什么要投反对票?

标签: ruby xcode nokogiri jekyll


【解决方案1】:

这是为我做的:

sudo gem install nokogiri -v '1.6.6.2' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib

【讨论】:

    猜你喜欢
    • 2014-09-02
    • 1970-01-01
    • 2014-01-01
    • 1970-01-01
    • 2015-12-07
    • 2012-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多