[Haskell-beginners] Compiling with HDBC

Christopher Howard christopher.howard at frigidcode.com
Fri May 13 07:35:29 CEST 2011


Hi. I'm very new to Haskell, but I'm trying to compile a simple program
that uses HDBC with ODBC. I am working on an amd64 Gentoo Linux system.
I've installed hdbc and hdbc-odbc with the unixOBDC bindings. So far, I
created a small hello world type program. It doesn't use any HDBC
functionality yet, but I inserted the following two lines at the top to
see if I could compile correctly:

import Database.HDBC
import Database.HDBC.ODBC

However, when I try to compile I get this:

$ ghc Main.hs
Main.o: In function `s1cY_info':
(.text+0x1ef): undefined reference to
`__stginit_HDBCzmodbczm1zi1zi3zi0_DatabaseziHDBCziODBC_'
Main.o: In function `s1cY_info':
(.text+0x1fb): undefined reference to
`__stginit_HDBCzm2zi2zi6zi1_DatabaseziHDBC_'
collect2: ld returned 1 exit status

Though, these errors do not show up when I run the .hs file with runhaskell.

I'm guessing I just don't know how to link to the correct library or
libraries. I tried adding -lodbc to the ghc line but that did not help.
In /usr/lib I see libodbc.so, as well as the directories hdbc-1.1.3 and
hdbc-odbc-1.1.3.0. I would appreciate any guidance.

-- 
frigidcode.com
theologia.indicium.us



More information about the Beginners mailing list