[Haskell-cafe] GHC compilation with postres libs

Lemmih lemmih at gmail.com
Fri Feb 25 09:22:28 EST 2005


On Fri, 25 Feb 2005 22:15:02 +0800, Edwin Eyan Moragas <haaktu at gmail.com> wrote:
> Hi guys,
> 
> been spending some time compiling my app but nothing seems to work.
> 
> here's the picture:
> - created a Main.hsc which include some external libs.
> 
> - included this pragma is Main.hsc
> {-# OPTIONS -fglasgow-exts #-}
> 
> -compiled Main.hsc with:
> $ hsc2hs -I/usr/local/pgsql/include Main.hsc
> all went well with this
> 
> - tried compiling this way:
> $ ghc -o test -L/usr/local/pgsql/lib Main.hs
> here's the error:
> 
> Main.o(.text+0xbd): In function `r289_entry':
> : undefined reference to `PQgetvalue'
> Main.o(.text+0x28f): In function `r28b_entry':
> : undefined reference to `PQexec'
> Main.o(.text+0x42f): In function `r28d_entry':
> : undefined reference to `PQreset'
> Main.o(.text+0x573): In function `r28f_entry':
> : undefined reference to `PQfinish'
> Main.o(.text+0x6b7): In function `r28h_entry':
> : undefined reference to `PQstatus'
> Main.o(.text+0x82b): In function `r28j_entry':
> : undefined reference to `PQconnectdb'
> collect2: ld returned 1 exit status
> 
> any ideas?

Including header files isn't enough, you have to link with the libraries too.
And have you seen HSQL? It already provides a postgresql binding.

-- 
Friendly,
  Lemmih


More information about the Haskell-Cafe mailing list