【问题标题】:rails 4 rbenv Mavericks cannot install Nokogiri 1.6.3 , insane error?rails 4 rbenv Mavericks 无法安装 Nokogiri 1.6.3 ,疯狂错误?
【发布时间】:2014-07-21 10:04:39
【问题描述】:

我尝试了几个小时(现在是几天...)来安装 Nokogiri 1.6.3 我以为我可以在 Nokogiri 网站 (http://nokogiri.org/tutorialsinstalling_nokogiri.html) 上进行说明,但它失败了,需要安装开发工具...

/Users/yves/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': 
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/yves/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'

我使用的是 XCode 5.1,并且安装了开发工具!否则我无法安装 libiconv 库...

yves$ ./configure --prefix=/usr/local/Cellar/libiconv/1.14
   checking for a BSD-compatible install... /usr/bin/install -c
   checking whether build environment is sane... yes
   ...


  yves$ gcc -v
  Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
  Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  Target: x86_64-apple-darwin13.3.0
   Thread model: posix

我浏览了与此问题相关的所有问题/答案(许多案例,许多给定的解决方案;..),但没有一个适用于 Nokogiri 1.6.3(最新更新)

只是为了反查,我尝试安装 gem ffi,它还需要构建原生扩展,这很好......

yves$ gem install ffi
Fetching: ffi-1.9.3.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ffi-1.9.3
1 gem installed

【问题讨论】:

  • 似乎绝对是 Nokogiri 1.6.3 gem 安装问题...我终于安装了 1.6.2.1 wo 任何麻烦并锁定它...。

标签: ruby-on-rails nokogiri osx-mavericks rbenv


【解决方案1】:

是的,这是 Nokgiri 1.6.3 依赖问题。请尝试以下操作:

gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2  --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

在执行此操作之前,请确保您的系统中安装了正确版本的 libxml2、libxslt 和 libiconv,并且上述路径也正确。

【讨论】:

    猜你喜欢
    • 2014-09-11
    • 1970-01-01
    • 2014-06-17
    • 1970-01-01
    • 2014-03-20
    • 2016-09-29
    • 2011-02-19
    • 2017-01-29
    • 2014-05-09
    相关资源
    最近更新 更多