Yukiharu YABUKI の tDiary
このtDiaryを検索します。
2009-06-23 [長年日記]
_ [Debian] rubygem と パッケージシステム
パッケージングシステムのruby libraryとgem (ruby システムで使われるライブラリ依存性解消ソフトウェア PerlのCPANやPythonのeggsみたいなの)での、使い分けを悩む場合があるかと思います。
そこで、(http://pkg-ruby-extras.alioth.debian.org/rubygems.html)の文書をよむと、そのあたりについて参考になるかと思います。
私の場合は、管理者=ユーザなんで、判っている範囲において使えばいいかとおもい。Mechanizeを使うことにしました。
_ [Debian] Debian GNU/Linux Lenny 上で rubygem を使って、Mechanize をインストールしてみる。
Hpricotは、Debian Packageで入れたが、Mechanize は Debian package が用意されていないのでされていますが、例として*1 rubygem を使って入れることにします。
基本的には、gem q -r(ドキュメントでは-Rだけど、-rが正解)して、gemが利用可能な、パッケージの一覧を取得して、欲しいモノがあればインストールする。もし、外部ライブラリーが足りなかったら、yum install hoge をせよとか出てくるので、debianに置き換えて、該当ライブラリを入れたらうまくいきます。 aptitude install libxslt-dev
yabuki@yelona:~$ sudo gem install mechanize
[sudo] password for yabuki:
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 install mechanize
checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... no
libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'
*** 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-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.3.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/nokogiri-1.3.1/ext/nokogiri/gem_make.out
yabuki@yelona:~$ sudo gem install mechanize
Building native extensions. This could take a while...
Successfully installed nokogiri-1.3.1
Successfully installed mechanize-0.9.3
2 gems installed
Installing ri documentation for nokogiri-1.3.1...
Installing ri documentation for mechanize-0.9.3...
Installing RDoc documentation for nokogiri-1.3.1...
Installing RDoc documentation for mechanize-0.9.3...
yabuki@yelona:~$
*1 通りすがりさんの指摘により、例としての表現に変更 2009.06.24
_ [Debian] rubygem でインストールしたものを削除する。
コメントを頂いた様に、パッケージで mechanize があるので、さっくりと rubygem でいれた rubyのライブラリは消すことにしました。orz
yelona:~# gem uninstall mechanize Successfully uninstalled mechanize-0.9.3 yelona:~# gem uninstall nokogiri Successfully uninstalled nokogiri-1.3.1 Remove executables: nokogiri in addition to the gem? [Yn] Removing nokogiri yelona:~# ls -laR /var/lib/gems/1.8/ /var/lib/gems/1.8/: 合計 28 drwxr-xr-x 7 root root 4096 2009-06-23 15:07 . drwxr-xr-x 3 root root 4096 2009-06-22 21:46 .. drwxr-xr-x 2 root root 4096 2009-06-23 17:32 bin drwxr-xr-x 2 root root 4096 2009-06-23 17:31 cache drwxr-xr-x 2 root root 4096 2009-06-23 17:31 doc drwxr-xr-x 2 root root 4096 2009-06-23 17:31 gems drwxr-xr-x 2 root root 4096 2009-06-23 17:31 specifications /var/lib/gems/1.8/bin: 合計 8 drwxr-xr-x 2 root root 4096 2009-06-23 17:32 . drwxr-xr-x 7 root root 4096 2009-06-23 15:07 .. /var/lib/gems/1.8/cache: 合計 8 drwxr-xr-x 2 root root 4096 2009-06-23 17:31 . drwxr-xr-x 7 root root 4096 2009-06-23 15:07 .. /var/lib/gems/1.8/doc: 合計 8 drwxr-xr-x 2 root root 4096 2009-06-23 17:31 . drwxr-xr-x 7 root root 4096 2009-06-23 15:07 .. /var/lib/gems/1.8/gems: 合計 8 drwxr-xr-x 2 root root 4096 2009-06-23 17:31 . drwxr-xr-x 7 root root 4096 2009-06-23 15:07 .. /var/lib/gems/1.8/specifications: 合計 8 drwxr-xr-x 2 root root 4096 2009-06-23 17:31 . drwxr-xr-x 7 root root 4096 2009-06-23 15:07 .. yelona:~#
_ 暗黒点灯
冷陰極管 --- ノートパソコンなどについているフィラメントがない蛍光灯 --- が真っ暗な場所でずーっと置いておかれると、光らせるための電子がなくなって点灯しなくなる現象があるらしい
現時点だと、「暗黒点灯」でgoogleって一番最初にでてくるPDFの文書に記述があります
libwww-mechanize-ruby1.8というパッケージがあったかと。
>通りすがりさん<br>ありがとうございます。たしかに、いま見つけました orz.<br><br>rubygemでパッケージ削除の分も書けるネタができたとして、追記します。