RE: Bug#294481: ghci -lpthread fails

On 10 February 2005 23:35, Ian Lynagh wrote:
On Thu, Feb 10, 2005 at 07:00:47PM +0100, Juliusz Chroboczek wrote:
Hi Ian,
What is your particular problem?
Running Darcs under ghci.
This seems to work for me (at least in as much as ghci loads and FastPackedString.lengthPS (FastPackedString.packString "Foo") says 3):
rm -rf .libs rm *ghcidarcsfoo* touch ghcidarcsfoo.c libtool --mode=compile gcc -g -O -c ghcidarcsfoo.c libtool --mode=link gcc -g -O -o libghcidarcsfoo.la ghcidarcsfoo.lo -lpthread -rpath /usr/lib libtool --mode=install cp libghcidarcsfoo.la `pwd`/libghcidarcsfoo.la libtool --finish /usr/lib ghci -cpp -package unix -package parsec -O -funbox-strict-fields -Werror -package util -I. -DHAVE_CURSES -optl-lcurses -optl-lz -L`pwd` -optl-lghcidarcsfoo darcs.lhs compat.o fpstring.o zlib_helper.o c_context.o
Is there a problem with this? Could something along these lines be done when -lfoo (as opposed to -optl-lfoo, which for consistency should probably be left alone) is given on the ghci command-line?
I'm no library expert, so there may be a cleaner/simpler/more portable equivalent to the above.
I'm not that familiar with libtool, but I guess what you're doing here is creating a dummy shared library which is linked against -lpthread, and linking that into GHCi? I don't see any reason why we couldn't automate the process, except that getting all the fiddly details right would probably be a nightmare. And would you require libtool to be installed? What about other platforms - Mac OS X? Cheers, Simon

On Fri, Feb 11, 2005 at 11:27:21AM -0000, Simon Marlow wrote:
On 10 February 2005 23:35, Ian Lynagh wrote:
I'm no library expert, so there may be a cleaner/simpler/more portable equivalent to the above.
I'm not that familiar with libtool, but I guess what you're doing here is creating a dummy shared library which is linked against -lpthread, and linking that into GHCi?
Yup.
I don't see any reason why we couldn't automate the process, except that getting all the fiddly details right would probably be a nightmare.
Like I say, I'm no expert either :-(
And would you require libtool to be installed? What about other platforms - Mac OS X?
If the necessary bits aren't available then you can fall back to acting like -optl-foo and are no worse off than currently. I think libtool is supposed to take care of the portability side for you, so hopefully lots of special casing won't be necessary. I don't know how well that works in practice, though. Thanks Ian
participants (2)
-
Ian Lynagh
-
Simon Marlow