Hatena::ブログ(Diary)

朝と夜のスキマ このページをアンテナに追加

2009-03-29

hpricotじゃなくてnokogiri

あたらしい鯖にmechanizeをインストールしようとしたら躓いたのでメモ

[root@localhost rubygems-1.3.1]# gem install mechanize

Building native extensions. This could take a while...

ERROR: Error installing mechanize:

ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install mechanize

checking for iconv.h in /usr/local/include,/opt/local/include,/usr/local/include,/usr/include... yes

checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include/libxml2... no

libxml2 is missing. try 'port install libxml2' or 'yum install libxml2'

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

・・・省略

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.2.3 for inspection.

libxml2を入れてくれ?おにぎり?あ、のこぎりか。

yum install libxml2

・・・

Package libxml2 - 2.6.26-2.1.2.7.i386 is already installed.

ん?既にはいってるって。

yum install libxml2-devel

んーーnokogiriをパーサとして使うらしいのでgem

[root@localhost bin]# gem install nokogiri

Building native extensions. This could take a while...

ERROR: Error installing nokogiri:

ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install nokogiri

checking for iconv.h in /usr/local/include,/opt/local/include,/usr/local/include,/usr/include... yes

checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include/libxml2... yes

checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include/libxml2... no

libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'

extconf.rb failed ***

なんですと?こんどはlibxslt-develが必要?

[root@localhost bin]# yum install libxslt-devel

・・・省略

[root@localhost bin]# gem install nokogiri

Building native extensions. This could take a while...

Successfully installed nokogiri-1.2.3

1 gem installed

Installing ri documentation for nokogiri-1.2.3...

Installing RDoc documentation for nokogiri-1.2.3...

でmechanizeは0.9からおにぎり・・じゃなかったノコギリらしいがコレでOK

[root@localhost bin]# gem install mechanize

Successfully installed mechanize-0.9.2

1 gem installed

Installing ri documentation for mechanize-0.9.2...

Installing RDoc documentation for mechanize-0.9.2...

[root@localhost bin]#

はてなユーザーのみコメントできます。はてなへログインもしくは新規登録をおこなってください。