Problems installing HDBC-postgresql

Hi, I'm having problems using HDBC-postgresql (I've tried both 0.99.2.1 and 1.0.0.0) 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. However, when I then try to type: ghci -package HDBC -package HDBC-postgresql , I get the error message: Loading package HDBC-postgresql-0.99.2.1 ... linking ... ghc-6.4.2: /home/mpercossi/opt/lib/HDBC-postgresql-0.99.2.1/HSHDBC-postgresql-0.99.2.1.o: unknown symbol `PQserverVersion' ghc-6.4.2: unable to load package `HDBC-postgresql-0.99.2.1' 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? TIA Martin

On 2006-07-10, Martin Percossi
Hi, I'm having problems using HDBC-postgresql (I've tried both 0.99.2.1 and 1.0.0.0) 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-0.99.2.1 ... linking ... ghc-6.4.2: /home/mpercossi/opt/lib/HDBC-postgresql-0.99.2.1/HSHDBC-postgresql-0.99.2.1.o: unknown symbol `PQserverVersion' ghc-6.4.2: unable to load package `HDBC-postgresql-0.99.2.1'
This sounds like it's not finding your PostgreSQL libraries. First, can you confirm that PQserverVersion still occurs in your libpq-fe.h? Next, try strace on your ghci session. Grep for libpq in the output. It may be instructive. In my case, I saw: stat64("/usr/lib/haskell-packages/ghc6/lib/HDBC-postgresql-0.99.2.1/libpq_dyn.so", 0xb763a1e0) = -1 ENOENT (No such file or directory) stat64("/usr/lib/haskell-packages/ghc6/lib/HDBC-postgresql-0.99.2.1/libpq.so", 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

Hi, sorry for the delay in replying. You were right -- it was not finding the correct version of the library. In fact, all I had to do was change the order in my LD_LIBRARY_PATH -- but thanks for the suggestion on strace -- I will certainly be using this tool for future problems. Many thanks Martin John Goerzen wrote:
On 2006-07-10, Martin Percossi
wrote: Hi, I'm having problems using HDBC-postgresql (I've tried both 0.99.2.1 and 1.0.0.0) 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-0.99.2.1 ... linking ... ghc-6.4.2: /home/mpercossi/opt/lib/HDBC-postgresql-0.99.2.1/HSHDBC-postgresql-0.99.2.1.o: unknown symbol `PQserverVersion' ghc-6.4.2: unable to load package `HDBC-postgresql-0.99.2.1'
This sounds like it's not finding your PostgreSQL libraries.
First, can you confirm that PQserverVersion still occurs in your libpq-fe.h?
Next, try strace on your ghci session.
Grep for libpq in the output. It may be instructive.
In my case, I saw:
stat64("/usr/lib/haskell-packages/ghc6/lib/HDBC-postgresql-0.99.2.1/libpq_dyn.so", 0xb763a1e0) = -1 ENOENT (No such file or directory) stat64("/usr/lib/haskell-packages/ghc6/lib/HDBC-postgresql-0.99.2.1/libpq.so", 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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
John Goerzen
-
Martin Percossi