Bug#294481: ghci -lpthread fails

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Feb 10 16:04:04 EST 2005


On Thu, 2005-02-10 at 16:58 +0000, Ian Lynagh wrote: 
> On Wed, Feb 09, 2005 at 11:13:36PM +0100, Juliusz Chroboczek wrote:
> > Package: ghc6
> > Version: 6.2.2-2
> > 
> > /usr/lib/libpthread.so (comes from libc6-dev 2.3.2.ds1-20) is a GNU
> > linker script, not a shared object.  This breaks ghci.
> 
> Known problem:
> 
> http://www.haskell.org/pipermail/glasgow-haskell-users/2004-May/006671.html
> 
> What is your particular problem?
> 
> CCing glasgow-haskell-users at haskell.org as someone there may have an
> answer, or be interested to know the problem exists if not.

There are two workarounds that I know of:

      * simply omit -lpthread. This often works since pthread is a
        dependency of other libs so it will just work automatically. 
      * use -pthread instead of -lpthread. This is valid option to gcc
        and tells it to link in the pthreads library. However ghci does
        not recognise the option so ghci will not load pthread itself
        (but hopefully it will be pulled in as a dependency by the
        dynamic linker) but when doing ordinary linking with ghc the
        program will be linked to the pthreads shared library. The
        -pthread option has to go in "extra_ld_opts" in the package
        file.

You cannot just stick -lpthread in the extra_ld_opts since ghci will
notice any options which look like -l* and load the libs anyway.

Duncan



More information about the Glasgow-haskell-users mailing list