Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW


by Anonymous Monk
on Nov 02, 2001 at 20:46 UTC ( #122838=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, I hope someone can help me with this.

I tried to intsall DBD:Pg on my RedHat 7.0 but ran into problems. The DBI installed fine but I could not get the DBD to install. I read the read me file included in DBD-Pg-1.10.tar.gz. I've bolded what instructions were there and just plain text what occured.

Configuring Pg
Remember to actually read the README file!
please set environment variables POSTGRES_INCLUDE and POSTGRES_LIB! (I don't know where these variables are!)

make: ***No targets specified and no make file found. Stop.

make test
make: ***No rule to make target 'test'. Stop.

make (I attempted this although it wasn't in the README file)
make: Nothing to be done for ''. Stop.

make install
make: No rule to make target 'install'. Stop.

All these commands were done as the postgres user, not root.
After I tried the script I looked at the Apache error log and saw the following error:

Can't locate auto/DBI/ in @INC (@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at /var/www/cgi-bin/test.cgi line 9

I assume this message is from the DBD not being in place.

Can someone tell me what's going on? Any help would be greatly appreciated.

Replies are listed 'Best First'.
Re: PostgreSQL/Perl
by ColtsFoot (Chaplain) on Nov 02, 2001 at 20:57 UTC
    You need to set the two environment variables to point at
    the postgres lib and include directory
    POSTGRES_INCLUDE=/usr/include/pgsql POSTGRESQL_LIB=/usr/lib export POSTGRES_INCLUDE POSTGRES_LIB or setenv POSTGRES_INCLUDE /usr/include/pgsql setenv POSTGRESQL_LIB /usr/lib depending on your shell
    The location of these directories will vary depending on how
    you installed postgresql
    Hope this helps
      In my case it looks like:
      export POSTGRES_HOME=/usr/local/pgsql export PGLIB=$POSTGRES_HOME/lib export PGDATA=$POSTGRES_HOME/data export LD_LIBRARY_PATH=$PGLIB export PATH=/usr/bin:/usr/local/pgsql/bin:$PATH
      inside .bashrc.

      Can do those commands from anywhere or do they have to be done from inside the directories?
        Usually you put these commands into .bashrc, .bash_profile or wherever your systems looks for Environmental variables. Of course you can type these command all the time you reboot your system, but that doesn't seem very comfortable.

Re: PostgreSQL/Perl
by Purdy (Hermit) on Nov 02, 2001 at 23:54 UTC
    Just a small follow-up: The reason the rest of your installation steps did not work is because the 'perl Makefile.PL' didn't generate a Makefile. You will know it has been successful when it says something to the affect of "Creating Makefile" near the end. If you type 'make' and nothing happens, then you need to fix the previous issue before moving on (which the prior responses address :)). I had the same thing when I first tackled DBD-Pg.

    Have fun!


Re: PostgreSQL/Perl
by Anonymous Monk on Nov 03, 2001 at 08:13 UTC
    I managed to get the perl Makefile.PL to work.
    I tried make test but got an error stating that
    libpg-fe.h could not be found.
    I did a search for it and found it in

    This is what my .bashrc looks like now.

    # .bashrc

    # User specific aliases and functions

    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'
    export POSTGRES_HOME=/var/lib/pgsql
    export PGLIB=/usr/include/pgsql/lib
    export PGDATA=$POSTGRES_HOME/data
    export PATH=/usr/bin:/var/lib/pgsql/bin:$PATH

    # Source global definitions
    if -f /etc/bashrc ; then

       . /etc/bashrc

    Am I doing something wrong?
      Hello, I've changed the .bashrc file because my lib
      path was wrong.
      make still can't find libpq-fe.h even though it
      is in /usr/include/pgsql

      New entry in to .bashrc
      export POSTGRES_HOME=/var/lib/pgsql
      export PGLIB=/usr/include/pgsql
      export PGDATA=$POSTGRES_HOME/data
      export PATH=/usr/bin:/var/lib/pgsql/data:

      When I type env all the variables have the correct path
      names. As well, I don't seem to have a pgsql/bin directory anywhere
      Is this odd? Getting kind of confused here! Any help would be muchly
      appreciated. D.
        Search for binaries like createdb, createuser, psql, etc. pp. If you cannot find them the chances that Postgresql is not installed are pretty high.

        If you got stuck just try to compile Postgres again, start postgres with the postmaster command, test wether Postgres is working by using psql from the shell; install "DBI" and "DBD::Pg" and become a member of Perlmonks. Once I tried RPM's but it didn't work out for me. Therfore I cannot say much about a RPM install.

      Did you do a make after perl Makefile.PL? Missing libraries are usually stated during the make process, but not while doing make test.

      You can use the force command to ignore errors and install anyway. I had to do this once for PostGreSQL as well.

      However your linux distribution should have DBD::Pg as a rpm. Use your favourite rpm front end and search for 'Pg' and then install the right rpm. No compiling necessary.

      I didn't believe in evil until I dated it.

Re: PostgreSQL/Perl
by dustbuster (Novice) on Nov 04, 2001 at 02:26 UTC
    I know that postgres is installed...been using postmaster
    to start it.
    I'm a new use to Linux. How do I use force to force
    the install. I have installed RPMs so I'll give that
    a try.
    BTW: Hanamaki, I was waiting for my password to be mailed.
    Hotmail can act weird sometimes.
(ichimunki) Re: PostgreSQL/Perl
by ichimunki (Priest) on Nov 09, 2001 at 04:53 UTC
    OK. So you've gotten quite a few answers on this, but I want to iterate what I've done to compile this module. I prefer not to set these environment variables in my .*rc or .*_profile files for the simple fact that once I'm done with this compile I won't be using them again.

    With RH7.0 I assume you're using BASH, so you'd simply do the following at the command prompt:
    export POSTGRES_LIB="/usr/local/pgsql/lib/" export POSTGRES_INCLUDE="/usr/local/pgsql/include/"
    or whatever the correct path is. If you installed the RPM for pgsql-dev, then they might just be in /usr/lib and /usr/include somewhere.

    If you really feel the need to include these in your .*rc or .*_profile files, you don't need to log out to activate the changes. Just execute the files. They're shell scripts, and the express purpose of a shell script is to be executed from a shell. Use either sh .bashrc or ./.bashrc depending on whether your .bashrc is set to be executable or (probably) not.

    It doesn't matter what user you are when you run configure, make and test as long as you have write permissions to the folder the module source is in, but you need to be root to install the module in a system-wide-available fashion (recommended).

Re: PostgreSQL/Perl
by Zecho (Hermit) on Nov 09, 2001 at 04:39 UTC
    First, a few comments on this thread. Anytime you change your .bashrc file you should log out and back in again. Check the for any variables that may need to be set. Although not recommended (I'm sure I'll get flamed for suggesting it) Sometimes, you just have to skip the make test and go straight to make install. Just dont do this if one of the steps you take prior fails. in fact, to clarify, If any of your installation steps fail, do not proceed to the next step. Do a make clean and start over once you figure out what caused the failure.

    On your newest thread on this subject, I don't recommend installing modules via rpm, but if you insist, you can generally find anything you need at

Re: PostgreSQL/Perl
by ralphie (Friar) on Nov 09, 2001 at 05:02 UTC
    one thing you might think about is removing the binary installation of postgresql that must have been installed with your distribution and grabbing the new gzipped tarball from <a href= </href>here. it's about an 8mb download, so it's not too onerous. when you install you can specify the location of those files in the configure process, but by default it'll put the tree in /usr/local/pgsql. installing that way you'll know that all the files are there.

    i don't know that you have to get all wound up in changing your initialization files, the only time you need the environment variables is during the build process. the last couple of times i've done this i invoked csh, issued
    setenv POSTGRES_LIB '/usr/local/pgsql/lib' and
    setenv POSTGRES_INCLUDE '/usr/local/pgsql/include'
    and exited back to bash. everthing built smoothly (on debian). for some reason this just seemed to go more smoothly in the c shell.

Re: PostgreSQL/Perl
by ralphie (Friar) on Jul 22, 2002 at 14:52 UTC
    Posting to this old thread just to get this in the aggregate knowledge base, i've not seen it explicitly mentioned in the monastery. When compiling the postgresql dbd driver you need to be able to reference the lib and include directories of a built postgresql system. i think the directories could be on a remote system accessed through a nfs or smbfs mount point, but would generally be on the host machine. note that the postgresql installation need not be active and that the libraries with which the client is compiled can be removed as soon as it is compiled. to restate, when the libpg-fe.h error is received the postgresql source will have to be built, installed, and the location of the lib and include directories referenced in the POSTGRES_LIB and POSTGRES_INCLUDE environment variables.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://122838]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2017-05-26 12:08 GMT
Find Nodes?
    Voting Booth?