ruby-openssl のインスコ問題は1行でイナフだった

Twitter4Rを使おうとしたら呼び出したとき(require 'twitter')に

no such file to load -- openssl
と出た。OSはCentOS5、Rubyは1.8.6。なぜか ruby-openssl がインスコされていなかったようなので


$ cd ruby-1.8.6/ext/openssl
$ ruby extconf.rb
$ make
# make install
とするはずが「ruby extconf.rb」のところでエラーが出た。

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.
*** ext/openssl/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:

 have_library: checking for t_open() in -lnsl... -------------------- no
"gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/i686-linux -I. -g -O2 conftest.c -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -rdynamic -Wl,-export-dynamic -lruby-static -lnsl -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘t_open’ undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))t_open; return 0; }
/* end */

"gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/i686-linux -I. -g -O2 conftest.c -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -rdynamic -Wl,-export-dynamic -lruby-static -lnsl -ldl -lcrypt -lm -lc"
/tmp/ccWAAE9d.o: In function `t':
/root/ruby-1.8.6-p111/ext/openssl/conftest.c:3: undefined reference to `t_open'
collect2: ld はステータス 1 で終了しました
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { t_open(); return 0; }
/* end */

yum install openssl-devel
openssl-devel を入れてやれば件の問題は解決し、その後の make も無事行えた。2時間悩んだことが1行で解決してしまいそれはそれで悔しい、という話。