centos5、Q4Mをコンパイルした記録

注意

Q4M0.8.4+MySQL5.1.32のくみあわせだとバグがあるっぽいです。バイナリログ無効にしないといけません。

環境

参考サイト

http://castor.s26.xrea.com/blog/tech/tech00015.htmlが大変参考になりました。なかったら無理だった。

やりかた

結論としては、configureのパラメータはこう。

CPPFLAGS=`mysql_config --cflags` LDFLAGS=`mysql_config --libs` ./configure --prefix=/usr --with-mysql=/usr/src/redhat/SOURCES/mysql-5.1.32 --includedir=/usr/include

CPPFLAGS,LDFLAGSの設定をMySQLとあわせるためmysql_configコマンドで取得してる(CFLAGSはつかってないっぽい)。MySQLのprefixは/usr。--with-mysqlMySQLのソースの場所を指定。--includeを指定しないとmy_config.hがみつからないエラーになる。
これでmakeしたらコンパイル通りました。

make installするとlibqueue-engine.soが/usr/libに作成されるが、MySQLプラグインディレクトリは/usr/lib64/mysql/pluginなので手動で移動してやる。

これでinstall.sqlに成功する。

make testにはperl-DBD-なんとかが必要なのだがそのインストールも面倒……
perl方面に疎くて苦戦したけど、結論としてはsudo cpanしてinstall DBD::mysqlするだけ。
他にもいくつか必要なCPAN moduleがある。ここ参照

  • DBI
  • DBD::MySQL
  • Data::Compare
  • List::MoreUtils

あたり。

で、いざテストを走らせてみると

#   Failed test at t/01-base.t line 24.DBD::mysql::db do failed: Binary logging not possible. Message: Statement cannot be logged 
to the binary log in row-based nor statement-based format at t/01-base.t line 25.
#   Failed test at t/01-base.t line 24.DBD::mysql::db do failed: Binary logging not possible. Message: Statement cannot be logged 
to the binary log in row-based nor statement-based format at t/01-base.t line 25.
#   Failed test at t/01-base.t line 24.DBD::mysql::db do failed: Binary logging not possible. Message: Statement cannot be logged 
to the binary log in row-based nor statement-based format at t/01-base.t line 25.
#   Failed test at t/01-base.t line 24.DBD::mysql::db do failed: Binary logging not possible. Message: Statement cannot be logged 
to the binary log in row-based nor statement-based format at t/01-base.t line 25.
#   Failed test at t/01-base.t line 24.DBD::mysql::db do failed: Binary logging not possible. Message: Statement cannot be logged 
to the binary log in row-based nor statement-based format at t/01-base.t line 25.

ヒッ……

Q4Mチュートリアルの例でも

mysql> CREATE TABLE my_queue (v1 int not null, v2 varchar(255)) ENGINE=queue;
Query OK, 0 rows affected (0.01 sec)
mysql>  INSERT INTO my_queue (v1, v2) VALUES (3, "hello world!");
ERROR 1598 (HY000): Binary logging not possible. Message: Statement cannot be logged to the binary log in row-based nor statement-based format

queueへのinsertができないようだ(queue_waitとかは可能)

この現象はバイナリログを無効化することで回避できる(コメントで教えていただきました。thx)。実用的にはqueueにinsertするコネクションの使用前に

SET SQL_LOG_BIN=0

すればOK。なんか権限いるみたいだけど。

ランタイムにグローバルに変更する方法がわからなかったので、make testの際にはmy.confの

log-bin=mysql-bin

の行をコメントアウトしてMySQL再起動した。