MacにOpenDBXを導入する

今後のいろいろやりたいことがあって現在その準備中。

その中で、OpenDBXを導入する必要があったので、その記録。
Delphiからも使えちゃうみたい。Windows/Mac/Linux環境はほとんど気にしなくてよいのですが、
今は、環境気にせずに使えるからあんまりこれを導入すればOKっていうメリットはすくないかもしれませんが。。。

ほとんどは、以下を参照することで、導入できる。
http://www.linuxnetworks.de/doc/index.php/OpenDBX/Setup/Unix-like/Building_from_source

基本的に使うDBはPostgreSQLなので、MySQLについては今回は含めていない。

前提、PostgreSQLが導入済みのこと。(自分はソースコンパイルで導入しています。)

  1. ソースのダウンロード

以下からopendbx-x.x.x.tar.gzをダウンロード。(導入時は、1.4.4)
http://www.linuxnetworks.de/doc/index.php/OpenDBX/Download

  1. 解凍

tar.gzなので、通常通り解凍。

sudo tar xzvf opendbx-1.4.4.tar.gz
  1. ./configure

ここではまった。。。
サイトでは、

./configure --with-backends="pgsql sqlite3"

な感じでいけるみたいだけど、実施すると。。。

configure: error: postgresql header (libpq-fe.h) not found

って怒られる。。。

Setupをしっかりみましょう。。。ということでみると、

If the header files are not installed in /usr/include/, you have to give ./configure some hints where to find them:

CPPFLAGS="-I/usr/include/mysql" ./configure --with-backends="mysql"

とあるので、CPPLAGSをつけて実行してみる。

sudo CPPFLAGS="-I/usr/local/pgsql/include" ./configure --with-backends="pgsql sqlite3"

結果、

configure: error: postgresql library (libpq) not found

ぐぬぬ。。。まだダメか。。。

再度マニュアル(SETUP)みると。。。

will additionally look for the MySQL header files in /usr/include/mysql. The same (also in combination with CPPFLAGS) can be used for library paths. Some distributions install the MySQL libraries in /usr/lib/mysql for example:

LDFLAGS="-L/usr/lib/mysql" ./configure --with-backends="mysql"

って書いてあるじゃん!!

ということで、

sudo CPPFLAGS="-I/usr/local/pgsql/include/" LDFLAGS="-L/usr/local/pgsql/lib/" ./configure --with-backends="sqlite3 pgsql"

を通った!!では、

sudo make

を実行。

odbx-sql.cpp:228: error: invalid conversion from ‘char* (*)(const char*, int)’ to ‘int (*)(const char*, int)’
make[3]: *** [odbx_sql-odbx-sql.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

ん?エラー???なんで?

ってことでしばらく格闘。。。。

ググってみると、http://www.mail-archive.com/libopendbx-devel@lists.sourceforge.net/msg00239.html
を発見。--disable-utilsを使うのか。ってかマニュアルにあるね。。。Without utilitiesって。。。

CPPFLAGS="-I/usr/local/pgsql/include/" LDFLAGS="-L/usr/local/pgsql/lib/" ./configure --disable-utils --with-backends="sqlite3 pgsql"

を実行して、

sudo make

すると、

Making all in utils
make[3]: Nothing to be done for `all-am'.
make[2]: Nothing to be done for `all-am'.

こんなのでてる。。。とりあえず、気にせずに。。。w

sudo make install

はいりましたー!!!結果はマニュアルをしっかり読め。。。orz

後は、Winなんですが、、、、よくわからない。。。
求むWindowsでのOpenDBX導入方法!!