Thai Heng has asked for the wisdom of the Perl Monks concerning the following question:

the error output file as follow:
--> Working on DBD::Pg Fetching http://www.cpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.5.1.tar +.gz -> OK Unpacking DBD-Pg-3.5.1.tar.gz Entering DBD-Pg-3.5.1 Checking configure dependencies from META.yml Checking if you have DBI 1.614 ... Yes (1.632) Checking if you have version 0 ... Yes (0.9902) Configuring DBD-Pg-3.5.1 Running Makefile.PL Configuring DBD::Pg 3.5.1 You need to install postgresql-server-dev-X.Y for building a server-si +de extension or libpq-dev for building a client-side application. Enter a valid PostgreSQL postgres major version number Enter a valid PostgreSQL postgres minor version number Enter a valid PostgreSQL postgres patch version number You need to install postgresql-server-dev-X.Y for building a server-si +de extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-si +de extension or libpq-dev for building a client-side application. Enter a valid PostgreSQL postgres bin dir You need to install postgresql-server-dev-X.Y for building a server-si +de extension or libpq-dev for building a client-side application. Enter a valid PostgreSQL postgres include dir No POSTGRES_HOME defined, cannot find automatically -> N/A -> FAIL Configure failed for DBD-Pg-3.5.1. See /home/hengaini/.cpanm/w +ork/1430800299.6291/build.log for details.

I don't know how to define $POSTGRES_HOME.

I install postgresql 9.4, and /usr/lib/postgresq have two directory 9.3 and 9.4.

/usr/lib/postgresql/9.4/lib have some *.so files, such as utf8_and_ascii.so.

I set $POSTGRES_HOME in ~/.bashrc as follow:

# add by hengaini 20150113 POSTGRES_HOME='/usr/lib/postgresql/9.4'

What is the problem ?

Replies are listed 'Best First'.
Re: Can't cpanm install DBD::Pg
by aaron_baugher (Curate) on May 05, 2015 at 05:21 UTC

    One possibility: you need to export the environment variable so that programs you run in the shell will see it. Like this:

    export POSTGRES_HOME='/usr/wherever'

    When you say you installed postgres, how did you do that? Did you install the postgresql-server-dev or libpq-dev package that it said it required, or something else? You have to install the 'dev' package because that gives you the include files for compiling programs (including DBD::Pg) against the Postgres libraries. The include files (like postgres.h) are what it's searching for and failing to find.

    Aaron B.
    Available for small or large Perl jobs and *nix system administration; see my home node.

Re: Can't cpanm install DBD::Pg
by Anonymous Monk on May 05, 2015 at 06:16 UTC