【问题标题】:make error when installing nokogiri gem using rvm on ruby-1.8.7-p334 [ x86_64 ]在 ruby​​-1.8.7-p334 [x86_64] 上使用 rvm 安装 nokogiri gem 时出错
【发布时间】:2011-08-26 20:03:28
【问题描述】:

当我尝试在 Mac OS X 10.6 上的 ruby-1.8.7-p334 [ x86_64 ] 上安装 nokogiri gem 时,我收到以下错误:

sudo gem install nokogiri
/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/gem:4: warning: Insecure world writable dir /Users in PATH, mode 040777
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.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.

【问题讨论】:

    标签: ruby-on-rails makefile gem installation nokogiri


    【解决方案1】:

    在安装 nokogiri gem 之前,您需要安装库。 以下是使用自制软件的步骤

    # the rest of this snippet assumes installation of libxml 2.7.7. YMMV.
    brew install libxml2
    brew link libxml2
    
    # install libxslt from source
    wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
    tar -zxvf libxslt-1.1.26.tar.gz
    cd libxslt-1.1.26
    ./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 \
                --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
    make
    sudo make install
    
    gem install nokogiri -- --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
    

    使用 macports

    sudo port install libxml2 libxslt
    sudo gem install nokogiri
    

    更多信息在这里http://nokogiri.org/tutorials/installing_nokogiri.html

    【讨论】:

    • 我尝试使用 brew 安装 libiconv,但没有成功。然后我意识到我必须先用 Snow Leopard 版本重新安装 MacPorts,然后再运行“sudo port install libxml2 libxslt”,这样就成功了!谢谢
    【解决方案2】:

    我尝试了各种我能找到的解决方案,包括: .使用 brew 安装 libxslt / libxml2 / libiconv .尝试使用各种 --with-configurations 安装 gem 遗憾的是,在我卸载 MacPort 和所有已安装的端口之前,它们都对我不起作用。

    然后简单地执行命令 gem install nokogiri,gem 和 rdoc 就安装好了。

    我不明白为什么的细节,但是根据我自己使用MacPort的经验(导致安装了多组ruby/rake/gem(s))和比较brew和port的文章,我不会去返回港口。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      • 2011-10-06
      • 1970-01-01
      • 1970-01-01
      • 2013-07-15
      • 1970-01-01
      相关资源
      最近更新 更多