Package: ghc6
Version: 6.12.1-13
Severity: normal
Hi,

I found that ghc cannot compile static binaries anymore. It fails with
a big list of linker errors against functions from libpthread. Compiling
attached source with

ghc -Wall -O -static -optl-static -o test test.hs

generates a long list of errors like:

/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/libffi.a(closures.o): In 
function `init_mparams':
(.text+0x3e): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/libffi.a(closures.o): In 
function `init_mparams':
(.text+0x53): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/libffi.a(closures.o): In 
function `init_mparams':
(.text+0xca): undefined reference to `pthread_mutex_init'
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/libffi.a(closures.o): In 
function `ffi_closure_free':
(.text+0x565): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/libffi.a(closures.o): In 
function `T.229':
(.text+0x10c0): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/libffi.a(closures.o): In 
function `T.229':
(.text+0x10d5): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/libffi.a(closures.o): In 
function `ffi_closure_alloc':
(.text+0x132c): undefined reference to `pthread_mutex_unlock'

'ghc -v3' shows that linking is not done against libpthread. Also adding
'-optl-lpthread' doesn't help as it is placed before all other libraries.
Manually copying the linker command and adding -lpthread at the end does
work.

Best,
Jaap


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.32-trunk-amd64 (SMP w/3 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ghc6 depends on:
ii  gcc                       4:4.4.4-2      The GNU C compiler
ii  libbsd-dev                0.2.0-1        utility functions from BSD systems
ii  libc6                     2.11.2-2       Embedded GNU C Library: Shared lib
ii  libc6-dev                 2.11.2-2       Embedded GNU C Library: Developmen
ii  libffi-dev                3.0.9-2        Foreign Function Interface library
ii  libffi5                   3.0.9-2        Foreign Function Interface library
ii  libgmp3-dev               2:4.3.2+dfsg-1 Multiprecision arithmetic library 
ii  libgmp3c2                 2:4.3.2+dfsg-1 Multiprecision arithmetic library
ii  libncurses5               5.7+20100313-2 shared libraries for terminal hand
ii  perl [perl5]              5.10.1-14      Larry Wall's Practical Extraction 

ghc6 recommends no packages.

Versions of packages ghc6 suggests:
pn  ghc6-doc                      <none>     (no description available)
pn  ghc6-prof                     <none>     (no description available)
pn  haskell-doc                   <none>     (no description available)

-- no debconf information
import IO
main = do	putStr "Hello world!\n"

Reply via email to