id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	difficulty	ghcversion	platform
564	Cabal doesn't use LD options when testing linking	igloo		"
When checking to see if the C libraries are available, Cabal isn't using the LD options that it has been given.

This example is using GHC's `ghc-cabal` program, but that's just a thin wrapper around the Cabal library. It looks like it's in `checkForeignDeps` in `Distribution.Simple.Configure` that it goes wrong. Note that `--ld-options=""-L/usr/local/lib ""` is passed, but not used in the `gcc` commands that do the linking.
{{{
$ ""inplace/bin/ghc-cabal"" configure --with-ghc=""/home/kili/src/ghc/ghc-head/inplace/bin/dummy-ghc"" --with-ghc-pkg=""/home/kili/src/ghc/ghc-head/inplace/bin/ghc-pkg"" --with-gcc=""gcc"" --configure-option=--with-cc=""gcc"" --with-hscolour=""/usr/local/bin/HsColour"" --configure-option=CFLAGS=""-O -I/usr/local/include  "" --configure-option=LDFLAGS=""-L/usr/local/lib  "" --gcc-options=""-O -I/usr/local/include  "" --ld-options=""-L/usr/local/lib "" -v3  -- dist-install libraries/integer-gmp
[boring stuff skipped]
(""sh"",[""configure"",""--with-compiler=ghc"",""--with-cc=gcc"",""CFLAGS=-O -I/usr/local/include  "",""LDFLAGS=-L/usr/local/lib  ""])
checking build system type... x86_64-unknown-openbsd4.5
checking host system type... x86_64-unknown-openbsd4.5
checking target system type... x86_64-unknown-openbsd4.5
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for __gmpz_fdiv_qr in -lgmp... yes
configure: creating ./config.status
config.status: creating integer-gmp.buildinfo
config.status: creating gmp/config.mk
Reading parameters from ./integer-gmp.buildinfo
(""/usr/bin/gcc"",[""-O"",""-I/usr/local/include"",""/tmp/2499.c"",""-o"",""/tmp/2499"",""-O"",""-I/usr/local/include"",""-D__GLASGOW_HASKELL__=611"",""-I."",""-I/home/kili/src/ghc/ghc-head/includes"",""-I/home/kili/src/ghc/ghc-head/libffi/build/include"",""-lgmp""])
/usr/bin/gcc returned ExitFailure 1 with error message:
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status
(""/usr/bin/gcc"",[""-O"",""-I/usr/local/include"",""/tmp/2499.c"",""-o"",""/tmp/2499"",""-lgmp""])
/usr/bin/gcc returned ExitFailure 1 with error message:
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status
(""/usr/bin/gcc"",[""-O"",""-I/usr/local/include"",""/tmp/2499.c"",""-o"",""/tmp/2499"",""-lgmp""])
/usr/bin/gcc returned ExitFailure 1 with error message:
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status
(""/usr/bin/gcc"",[""-O"",""-I/usr/local/include"",""/tmp/2499.c"",""-o"",""/tmp/2499"",""-c"",""-O"",""-I/usr/local/include"",""-D__GLASGOW_HASKELL__=611"",""-I."",""-I/home/kili/src/ghc/ghc-head/includes"",""-I/home/kili/src/ghc/ghc-head/libffi/build/include""])
ghc-cabal: Missing dependency on a foreign library:
* Missing C library: gmp
This problem can usually be solved by installing the system package that
provides this library (you may need the ""-dev"" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
}}}
"	defect	new	high	Cabal-1.8	Cabal library	1.6.0.1	normal				unknown		
