MySQL/RubyのMakefile作成に失敗する件について。
いろいろ調べてみると、RubyでMySQLを扱うには、
MySQL/Rubyを使うか、Ruby/MySQLを使うという方法があるらしい。
前者のほうが安定で高速らしいので、今回はMySQL/Rubyを選択。
指示の通り、ダウンロードして展開して展開したディレクトリに移動して、
ruby extconf.rb --with-mysql-dir=/usr/local/mysql
をやってMakefileを作成……できる筈だったんだけれど、失敗。
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... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... 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. (以下、制御オプションの紹介が続く)
というわけで、mkmf.logを参照すると、42KBもある……。
冒頭だけでも書いてみると、こんな感じ。
find_library: checking for mysql_query() in -lmysqlclient... -------------------- no "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -I/usr/local/mysql/include -arch ppc -arch i386 -Os -pipe -fno-common conftest.c -L"." -L"/System/Library/Fra meworks/Ruby.framework/Versions/1.8/usr/lib" -L"/usr/local/mysql/lib" -L. -arch ppc -arch i386 -lruby -lmysqlcl ient -lpthread -ldl -lm " conftest.c: In function ‘t’: conftest.c:3: error: ‘mysql_query’ 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.) conftest.c: In function ‘t’: conftest.c:3: error: ‘mysql_query’ 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.) lipo: can't figure out the architecture type of: /var/folders/bS/bS+5lGoDEVKsdhLuj51y1E+++TI/-Tmp-//ccr46bcb.out checked program was: /* begin */ 1: /*top*/ 2: int main() { return 0; } 3: int t() { void ((*volatile p)()); p = (void ((*)()))mysql_query; return 0; } /* end */ (以下略)
「'mysql_query'が宣言されてない」って言われてるんだけれど、
それって私の所為なの?
てか、引用されてるプログラムが怪しすぎる。
「int main(){ return 0; } 」なんて、
もうどこから突っ込んだら良いのか解りません。
というわけで、また後日。