細々とRuby on Railsで作成しているアプリはWindows上でInstant Railsを使って開発している。
ごく一部の機能だが動き始めたので、常時上げて起きたいと思い、CentOSのサーバ上で実行しようとしてみた。
まずはruby。
# ruby -version
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
最近入れ直したらしい(良く覚えていないが(汗)) これはこれでOKだ。gemも入ってる様なので、そのままrailsをインストール。
# gem install rails -y
何の問題もない。mysqlはyumで入れてある(CentOS-Testing.repoでmysql 5.0.42)のでruby MySQLアダプタを入れてみる。
# gem install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** 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
:
いろいろと文句を言われるが、-lmysqlclient で怒られているので、mysqlのライブラリが見つからないのであろう。
# gem install mysql -- --with-mysql-dir=/usr
としてみてもだめ。うちのはCentOS 4.4 x86_64だった事を思い出し/usr/lib64の下を見てみると、mysqlフォルダがあり、その下に共有ライブラリが色々と格納されていた。そう言うわけで
# gem install mysql -- --with-mysql-dir=/usr --with-mysql-lib=/usr/lib64/mysql
で無事成功。