DBD::Pgのインストール「Path to pg_config?」を解決する
- 簡単簡単と思っていたらいきなりエラー
$ cpanm DBD::Pg --> Working on DBD::Pg Fetching http://search.cpan.org/CPAN/authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz ... OK Configuring DBD-Pg-2.18.1 ... N/A ! Configure failed for DBD-Pg-2.18.1. See /home/ymko/.cpanm/build.log for details. --- build.log --- --> Working on DBD::Pg Fetching http://search.cpan.org/CPAN/authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz -> OK Unpacking DBD-Pg-2.18.1.tar.gz Entering DBD-Pg-2.18.1 Checking configure dependencies from META.yml Checking if you have version 0 ... Yes (0.94) Checking if you have DBI 1.52 ... Yes (1.617) Configuring DBD-Pg-2.18.1 Running Makefile.PL Configuring DBD::Pg 2.18.1 Path to pg_config? Use of uninitialized value in concatenation (.) or string at Makefile.PL line 99. Use of uninitialized value in concatenation (.) or string at Makefile.PL line 101. PostgreSQL version: 0 (default port: 0) POSTGRES_HOME: (not set) POSTGRES_INCLUDE: /include POSTGRES_LIB: /lib OS: linux The value of POSTGRES_INCLUDE points to a non-existent directory: /include Cannot build unless the directories exist, exiting.
どうやら pg_config というファイルが見つからない?とからしい。
実行ファイルなどの配置場所が変更されたため、従来は必要なかったPATH指定が必要になるケースがあります。下記のalternativesと関連しますが、特にinitdbやpg_ctlが"/usr/bin"配下にあることを期待している環境では、"/usr/pgsql-m.n/bin"などへのPATHをbashrcなどへ記述すると良いでしょう。
http://lets.postgresql.jp/documents/tutorial/new_rpm
- なるほど。今度はうまくいか・・・ない
$ echo "PATH=$PATH:/usr/pgsql-9.1/bin" >> ~/.bashrc $ source ~/.bashrc $ cpanm DBD::Pg --> Working on DBD::Pg Fetching http://search.cpan.org/CPAN/authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz ... OK Configuring DBD-Pg-2.18.1 ... OK Building and testing DBD-Pg-2.18.1 ... FAIL ! Installing DBD::Pg failed. See /home/ymko/.cpanm/build.log for details. --- build.log --- Pg.h:38:22: error: libpq-fe.h: No such file or directory
- develが必要らしい.今度こそOK
# wget http://yum.pgrpms.org/9.1/redhat/rhel-5-x86_64/postgresql91-devel-9.1.2-1PGDG.rhel5.x86_64.rpm # rpm -ivh postgresql91-devel-9.1.2-1PGDG.rhel5.x86_64.rpm $ cpanm DBD::Pg --> Working on DBD::Pg Fetching http://search.cpan.org/CPAN/authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz ... OK Configuring DBD-Pg-2.18.1 ... OK Building and testing DBD-Pg-2.18.1 ... OK Successfully installed DBD-Pg-2.18.1 1 distribution installed