[Haskell-cafe] Re: Problems installing HDBC-postgresql

John Goerzen jgoerzen at complete.org
Mon Jul 10 17:50:46 EDT 2006

On 2006-07-10, Martin Percossi <haskell-cafe at martinpercossi.com> wrote:
> Hi, I'm having problems using HDBC-postgresql (I've tried both 
> and with postgresql (version 8.1.4, installed in /share/pgsql). 
> I adjust the include-dir and extra-lib-dirs to use the custom location 
> of postgresql, and build: no error messages, everything seems fine.

Probably, though, there is something that is not quite fine...

> However, when I then try to type:
> ghci -package HDBC -package HDBC-postgresql
> , I get the error message:
> Loading package HDBC-postgresql- ... linking ... ghc-6.4.2: 
> /home/mpercossi/opt/lib/HDBC-postgresql- 
> unknown symbol `PQserverVersion'
> ghc-6.4.2: unable to load package `HDBC-postgresql-'

This sounds like it's not finding your PostgreSQL libraries.

First, can you confirm that PQserverVersion still occurs in your

Next, try strace on your ghci session.

Grep for libpq in the output.  It may be instructive.

In my case, I saw:

0xb763a1e0) = -1 ENOENT (No such file or directory)
0xb763a570) = -1 ENOENT (No such file or directory)
open("/usr/lib/libpq.so", O_RDONLY)     = 3

So we know that the system did successfully open that library.

> Has anyone seen this error message before? Google didn't turn up 
> anything relevant to haskell -- however there does seem to be a 
> PQserverVersion procedure in the libpq library -- maybe HDBC-postgresql 
> is not seeing this due to the custom install location?

This would all be up to your modifications to cabal.  

Try: ghc-pkg describe HDBC-postgresql

You should see:

 * pq in the extra-libraries line
 * Your header file location in the include-dirs line
 * Your extra-lib-dirs path

If you don't see those things, then something went wrong with the build
or install.

I would also suggesting building a program with GHC (not GHCI) that uses
HDBC-postgresql for testing.

-- John

More information about the Haskell-Cafe mailing list