jeff@ubuntu:/$ sudo gem install mechanize
[sudo] password for jeff:
Building native extensions. This could take a while...
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... no
-----
libxslt 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.
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=/usr/bin/ruby1.8
--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-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-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
Gem files will remain installed in /var/lib/gems/1.8/gems/nokogiri-1.4.3.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/nokogiri-1.4.3.1/ext/nokogiri/gem_make.out
解决方法:
1)jeff@ubuntu:/$ sudo apt-get install libxslt1-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:
libxslt1-dev
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 619kB 的软件包。
解压缩后会消耗掉 2,544kB 的额外空间。
获取:1 http://cn.archive.ubuntu.com/ubuntu/ maverick/main libxslt1-dev i386 1.1.26-6 [619kB]
下载 619kB,耗时 12秒 (48.1kB/s)
选中了曾被取消选择的软件包 libxslt1-dev。
(正在读取数据库 ... 系统当前共安装有 139015 个文件和目录。)
正在解压缩 libxslt1-dev (从 .../libxslt1-dev_1.1.26-6_i386.deb) ...
正在处理用于 doc-base 的触发器...
Processing 1 added doc-base file(s)...
Registering documents with scrollkeeper...
正在处理用于 man-db 的触发器...
正在设置 libxslt1-dev (1.1.26-6) ...
2)jeff@ubuntu:/$ sudo gem install mechanize
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.3.1
Successfully installed mechanize-1.0.0
2 gems installed
Installing ri documentation for nokogiri-1.4.3.1...
No definition for parse_memory
No definition for parse_file
No definition for parse_with
No definition for get_options
No definition for set_options
Installing ri documentation for mechanize-1.0.0...
Installing RDoc documentation for nokogiri-1.4.3.1...
No definition for parse_memory
No definition for parse_file
No definition for parse_with
No definition for get_options
No definition for set_options
Installing RDoc documentation for mechanize-1.0.0...