darcs patch: Fix detection of libiconf.

Matthias Kilian kili at outback.escape.de
Wed Jun 24 10:43:02 EDT 2009


On Wed, Jun 24, 2009 at 02:13:48PM +0100, Ian Lynagh wrote:
> > $ nm /usr/local/lib/libiconv.a | grep iconv_open
> > 00011f84 T libiconv_open
> > 000124b8 T libiconv_open_into
> > 
> > And iconv.h #defines iconv_open to libiconv_open:
> > $ grep -w libiconv_open /usr/local/include/iconv.h
> > #define iconv_open libiconv_open
> 
> Ah, I see what you mean. Does the attached patch work for you?

Yes, it seems to fix configure.

> > There is, however, still the problem that library and include paths
> > passed to configure via the environment (like LDFLAGS, CPPFLAGS)
> > aren't recognized by cabal, so even if configure is successfull,
> > cabal (or ghc-pkg configure, in my case) will fail.
> 
> In rules/build-package-data.mk there are two lines:
> 
> $1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$(filter-out -Werror,$$(SRC_CC_OPTS)) $$($1_CC_OPTS) $$($1_$2_CC_OPTS)"
> $1_$2_CONFIGURE_OPTS += --configure-option=LDFLAGS="$$(SRC_LD_OPTS) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)"
> 
> If you add two more lines:
> 
> $1_$2_CONFIGURE_OPTS += --gcc-options="$$(filter-out -Werror,$$(SRC_CC_OPTS)) $$($1_CC_OPTS) $$($1_$2_CC_OPTS)"
> $1_$2_CONFIGURE_OPTS += --ld-options="$$(SRC_LD_OPTS) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)"
> 
> then does that fix the problem?

The second added line doesn't work as expected.  I explicitely have
to set CFLAGS="-I/usr/local/include -L/usr/local/lib".  It seems
like cabal only uses --gcc-options when running gcc (and ignoring
--ld-options). So for now, the addition of --gcc-options helps me
to build ghc-head again. FYI, below is the output of ghc-cabal with
an added -v3 when CFLAGS="-I/usr/local/include" (without
-L/usr/local/lib).

Ciao,
	Kili

$ "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.



More information about the Libraries mailing list