Re: ghci and ld scripts

2004-05-23 Thread Duncan Coutts
On Fri, 2004-05-21 at 17:22, Sven Panne wrote:
 Simon Peyton-Jones wrote:
  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. [...]
 
 I've just made a quick test on my SuSE 9.1 Linux and it seems to be the
 case that an explicit -lpthread is not necessary anymore, even for
 programs using pthread calls. Strange, but handy. :-) Could you try if
 things work for you without adding pthread to extra_libraries?

That does seem to work, thanks. The joys of linker magic.

I guess that solves my immediate problem, but doesn't help answer
Simon's question of what we do in general. :-(

If we were using .so's for packages rather than .o's then we'd be using
the system linker and we wouldn't have the problem, but that is a longer
term project.

Duncan

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ghci and ld scripts

2004-05-21 Thread Sven Panne
Simon Peyton-Jones wrote:
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. [...]
I've just made a quick test on my SuSE 9.1 Linux and it seems to be the
case that an explicit -lpthread is not necessary anymore, even for
programs using pthread calls. Strange, but handy. :-) Could you try if
things work for you without adding pthread to extra_libraries?
Another way would be using some kind of autoconf/shell magic to test
for the linker script and install a link to /lib/libpthread.so.0 with
the name myownpthread.so to the installation directory of your package
and add myonwpthread to extra_libraries. Ugly...
Cheers,
   S.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


ghci and ld scripts

2004-05-16 Thread Duncan Coutts
So here's the problem:

We have a Haskell binding to a C library (one of the gtk extension libs)
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/libpthread.so: invalid ELF header)

Inspecting /usr/lib/libpthread.so 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/libpthread.so.0 /usr/lib/libpthread_nonshared.a )

So we should get ghci to dynamically load /lib/libpthread.so.0, however
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
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users