[Haskell-cafe] Type problem with simple takusen code (was: Trivialdatabase access in Haskell)

Paul Moore p.f.moore at gmail.com
Wed Dec 13 06:40:22 EST 2006

On 12/13/06, Bayley, Alistair <Alistair_Bayley at invescoperpetual.co.uk> wrote:
> > From: Paul Moore [mailto:p.f.moore at gmail.com]
> This appears to be caused by ghci/runhaskell wanting to link the entire
> library at once, rather than just the modules you're using. I don't know
> if this is a bug or a feaure with ghci; anybody else want to comment?
> This problem affects both ghci and runhaskell. It does not affect ghc,
> though. I'm not sure what the best solution is; we might have to do what
> Krasimir did with HSQL and make each database-specific module a separate
> package.
> For now, if you want to use Takusen, you are stuck with ghc (the
> compiler). This invocation:
>   > ghc --make db.hs -o db
> should make you a working db.exe.

Thanks for the explanation - it's no problem using ghc, I was only
using runhaskell for (a tiny bit of) convenience.

Having said that, I now get

>ghc --make db.hs -o db
[1 of 1] Compiling Main             ( db.hs, db.o )
Linking db.exe ...
D:\Apps\GHC\gcc-lib\ld.exe: cannot find -lsqlite3
collect2: ld returned 1 exit status

This may be because I have a sqlite3.dll in my PATH, but no
development libs. Would that make configure think that sqlite is
available, but because the build needs the link library, fail at that
stage? If so, I may well be heading for a problem with Oracle, as I
have the client only installed, so the OCI DLLs are present, but not
the headers and lib files. (I've hit this one before, and can get
round it, though).

I had a look on the sqlite website, but can't find a "development
libraries" download. I'm reluctant to get bogged down in building
sqlite, so I'm leaving it there for now.

To work around this, I removed sqlite3.exe from my PATH, and set up an
oracle directory in my PATH which did include OCI. Then runhaskell
Setup.hs configure reported no sqlite, no postgres, and Oracle from
where I wanted. I reinstalled Takusen with these options.

However, now when I run ghc --make, I get a string of link errors from
Oracle stuff (OCIconstants.o). This is serious progress - I'm linking
the right stuff this time. I've seen similar issues before, where I
tried to use gcc to link to the Oracle-supplied OCI libraries (or at
least I think that was it), as Oracle supply MSVC compatible libraries
instead. Could this be relevant here? I know ghc uses the gcc linker,
so it seems like a possibility.

> I have added a README.txt to the darcs repo, which hopefully provides a
> lot of this missing information. I haven't added uninstall instructions
> though :-)

That looks excellent - it would have given me exactly what I needed.


More information about the Haskell-Cafe mailing list