$POSTGRES_HOME not defined
Copyright (C) 1999 by Steve Litt, All rights reserved. Material provided
as-is, use at your own risk.
Symptom:
When installing DBD-Pg (the DBMS dependent section of the DBI::DBD interface
between Perl and databases), upon running the perl Makefile.PL
command you get the following error message:
$POSTGRES_HOME not defined
or
Unable to find PostgreSQL
please set environment variable POSTGRES_HOME
Note that the former is not really an error message -- the latter is. Depending
on the DBD-Pg version, your subsequent make command will either say you
have no target, or maybe other error messages including something to the
effect of an incomplete structure.
Cause:
Your PGLIB directory must have a lib directory below it. The lib directory
need not contain anything. If $POSTGRES_HOME is set, it must be set to
your PGLIB directory. If these conditions are not met you'll get the error
condition discussed on this page. On Red Hat 6 systems, PGLIB is typically
/usr/lib/pgsql.
Makefile.PL first checks to see if env var $POSTGRES_HOME is defined.
If not, it loops through a series of typical postgres directories (including
/usr/lib/pgsql) to see if any has a lib directory below it. The first one
with a lib directory below it is assigned to $POSTGRES_HOME. Then $POSTGRES_HOME
is again checked for a lib below it, and if it isn't there this message
(or something like it, depending on version) is printed:
Unable to find PostgreSQL
please set environment variable POSTGRES_HOME
If your Linux installation did not put a lib directory below its PGLIB
directory (/usr/lib/pgsql in Red Hat 6), you'll get this same error.
Workaround:
Note: before each of these steps, unset POSTGRES_HOME. Once perl Makefile.PL
works correctly, you needn't take further steps.
-
If your PGLIB directory (/usr/lib/pgsql in Red Hat 6) does not contain
a lib directory, create a lib directory below your PGLIB directory and
rerun perl Makefile.PL. If that doesn't work...
-
Look in Makefile.PL's foreach loop and see if any of the directorys listed
there look familiar. For any familiar ones not containing a lib directory,
create an empty lib directory in it. Rerun perl Makefile.PL. If
that doesn't work...
-
If the previous step doesn't work, set POSTGRES_HOME to your PGLIB directory,
and create an empty lib directory under your PGLIB directory if it doesn't
already have one. Rerun perl Makefile.PL. If that doesn't work...
-
Upgrade your DBD to version 0.92 or later, because that version has code
to partially fix this problem. Upgrade as necessary your DBI, Perl and
Postgresql to be compatible with DBD version 0.92. Installation order is
Perl, PostgreSQL, DBI, then DBD.
-
Study the Makefile.PL source, and try to come up with other ideas. If that
doesn't work, submit a bug report to the DBD-Pg folks.
Feedback
I want to hear your results with this. Email
me. Thanks
Steve Litt