ghci and ld scripts

Simon Peyton-Jones simonpj at
Fri May 21 14:20:11 EDT 2004

We've no idea what to do here.  In your case it'd be possible to just
ignore the script, but presumably not so in general.

If anyone who understands the problem properly would like to advise,
we'd be happy to hear from them. Parsing ld scripts seems beyond what
our linker is ever going to do!


| -----Original Message-----
| From: glasgow-haskell-users-bounces at
| bounces at] On Behalf Of Duncan Coutts
| Sent: 16 May 2004 16:48
| To: GHC-users list
| Subject: ghci and ld scripts
| So here's the problem:
| We have a Haskell binding to a C library (one of the gtk extension
| which uses the pthread library. So we put "pthread" in the
| extra_libraries section of our ghc package conf file.
| This works fine when building standalone programs, however when we try
| and use this package in ghci we get this error:
| ...
| Loading package gtk2 ... linking ... done.
| Loading package sourceview ... ghc-6.2.1: can't load .so/.DLL for:
| pthread (/usr/lib/ invalid ELF header)
| Inspecting /usr/lib/ we find that indeed it is not a .so
| file but a gnu ld script:
| /* GNU ld script
|    Use the shared library, but some functions are only in
|    the static library, so try that secondarily.  */
| OUTPUT_FORMAT(elf32-i386)
| GROUP ( /lib/ /usr/lib/libpthread_nonshared.a )
| So we should get ghci to dynamically load /lib/,
| there is no way to specify this in the package.conf file.
| It turns out that we don't need ghci to load this .so because it is a
| dep of another .so that we do load, however if I leave it out then
| building standalone progs would fail to link.
| Has anyone come across this before? How do you deal with it?
| Duncan
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list