hpricotインストールではまる
8 月 13th, 2009amazon-cesをgemでインストールかけようとするとhpricotで止まってしまった。
結論的にはhpricot-0.7.1を無理矢理インストールすることで解決。
環境はCentOS 5.3。
ちょっと長いけどエラーlog
% sudo gem install amazon-ecs Building native extensions. This could take a while... ERROR: Error installing amazon-ecs: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb install amazon-ecs checking for main() in -lc... yes creating Makefile make gcc -I. -I. -I/usr/lib/ruby/1.8/i386-linux -I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -fPIC -c hpricot_css.c hpricot_css.rl: In function ‘hpricot_css’: hpricot_css.rl:106: 警告: implicit declaration of function ‘RSTRING_PTR’ hpricot_css.rl:106: 警告: assignment makes pointer from integer without a cast hpricot_css.rl:107: 警告: implicit declaration of function ‘RSTRING_LEN’ hpricot_css.c:3402: 警告: ポインタと整数との比較を行なっています hpricot_css.c:3402: 警告: ‘eof’ is used uninitialized in this function hpricot_css.rl:92: 警告: ‘aps’ may be used uninitialized in this function gcc -I. -I. -I/usr/lib/ruby/1.8/i386-linux -I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -fPIC -c hpricot_scan.c hpricot_scan.rl: In function ‘our_rb_hash_lookup’: hpricot_scan.rl:169: 警告: implicit declaration of function ‘st_lookup’ hpricot_scan.rl: In function ‘make_hpricot_struct’: hpricot_scan.rl:693: 警告: implicit declaration of function ‘RARRAY_PTR’ hpricot_scan.rl:693: error: 添字をつけられた値が配列でもポインタでもありません make: *** [hpricot_scan.o] エラー 1 Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/hpricot-0.8.1 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/hpricot-0.8.1/ext/hpricot_scan/gem_make.out
検索してみたところこちらのページがヒットしたものの、同様に解決しない。
昨日のDBCLS – 聖糞
特にバージョンはこだわっていなかった(amazon-cesが入ればよい)ので古いバージョンをインストールすることに。
sudo gem install hpricot --version "< 0.8.0"
しかし、エラーが表示される。
けど、よく見てみるとgemは取得していてextconf.rbを実行する過程でオプションがついてしまってエラーになっていると。
Building native extensions. This could take a while... sh: 0.8.0: そのようなファイルやディレクトリはありません ERROR: Error installing hpricot: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb install hpricot --version < 0.8.0 Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/hpricot-0.7 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/hpricot-0.7/ext/hpricot_scan/gem_make.out
直接gemファイルを指定してインストールを試みるものの、なぜかうまく行かない。
上記のblogで紹介されていたHpricot 0.8.1 on ruby 1.8.5 | Penguin on Railsを参考に下記の通り実行することでインストールできた。
% cd /usr/lib/ruby/gems/1.8/gems/hpricot-0.7/ext/hpricot_scan % sudo rake package (snip.) ** Execute pkg/hpricot-0.7.1.gem Successfully built RubyGem Name: hpricot Version: 0.7.1 File: hpricot-0.7.1.gem mv hpricot-0.7.1.gem pkg/hpricot-0.7.1.gem ** Execute gem ** Execute package % sudo gem install ../../pkg/hpricot-0.7.1.gem Building native extensions. This could take a while... Successfully installed hpricot-0.7.1 1 gem installed Installing ri documentation for hpricot-0.7.1... Installing RDoc documentation for hpricot-0.7.1... % sudo gem install amazon-ecs Successfully installed ruby-hmac-0.3.2 Successfully installed amazon-ecs-0.5.6 2 gems installed Installing ri documentation for ruby-hmac-0.3.2... Installing ri documentation for amazon-ecs-0.5.6... Installing RDoc documentation for ruby-hmac-0.3.2... Installing RDoc documentation for amazon-ecs-0.5.6...
めんどくさ....
あ、あとragelを予めインストールしてます。
% wget http://www.complang.org/ragel/ragel-6.5.tar.gz % tar zxvf ragel-6.5.tar.gz % cd ragel-6.5 % ./configure % make && sudo make install % sudo ln -s /usr/local/bin/ragel /usr/bin