gtk+hs and libgmp

Simon Marlow simonmar@microsoft.com
Thu, 25 Oct 2001 11:04:49 +0100


> When trying to compile the examples in gtk+hs, I get the=20
> following link
> errors:
> /opt/ghc/lib/ghc-5.02/libHSstd.a(PrelFloat__413.o): In=20
> function `shP2_2_alt':
> PrelFloat__413.o(.text+0x2b0): undefined reference to `__gmpz_cmp_si'
> etc..
> When linking simple programs, this doesn't occur.
> I have the following gmp's installing:
> /usr/lib/libgmp.so.2.0.2
> /usr/local/lib/libgmp.so.3.1.1
> /opt/ghc/lib/ghc-5.02/libgmp.a
> It seems that the programs only link with the version in=20
> /usr/local/lib.
> I tried putting this path in 'library_dirs' for package 'gmp' in
> 'package.conf', but to no avail. Only when I explicitly put
> '/usr/local/lib/libgmp.so' in 'extra_ld_opts' for package 'gmp'
> did it work.

The version in /opt/ghc/lib/ghc-5.02 should work, as should =
/usr/local/lib/libgmp.so.3.1.1.  The version in /usr/lib looks like GMP =
2, so that would cause the link errors.

Make sure the link command line doesn't have -L/usr/lib on it, or at =
least not before -L/usr/local/lib and -L/opt/ghc/lib/ghc-5.02.

Cheers,
	Simon