开发者

make error when installing nokogiri gem using rvm on ruby-1.8.7-p334 [ x86_64 ]

When I try to install nokogiri gem on ruby-1.8.7-p334 [ x86_64 ] on Mac OS X 10.6, I get the following error:

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 configurat开发者_开发问答ion options.


Before installing nokogiri gem, you need to get libraries installed. Here are the steps to do it with homebrew

# 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

With macports

sudo port install libxml2 libxslt
sudo gem install nokogiri

More information here http://nokogiri.org/tutorials/installing_nokogiri.html


I tries all kinds of solutions I can found, including: . use brew to install libxslt / libxml2 / libiconv . tries to gem install with various --with-configurations sadly, they all didn't work for me, until I uninstalled MacPort and all installed ports.

Then simply executed command gem install nokogiri, the gem and rdoc got installed like a breeze.

I don't understand the very details of why, but according to my own experiences of using MacPort (resulted in multiple sets of ruby/rake/gem(s) installed) and articles comparing brew and port, I will not go back to port.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜