darcs patch: Fix detection of libiconf.

Matthias Kilian kili at outback.escape.de
Wed Jun 24 05:35:54 EDT 2009

On Wed, Jun 24, 2009 at 01:10:28AM +0100, Ian Lynagh wrote:
> > Thanks for the patch; unfortunately, it makes the build fail for me on
> > OS X:
> > 
> > I haven't looked into what's going wrong yet.
> OK, there were a number of problems, starting with the C program it
> tests not compiling due to NULL not being defined.

Ouch! Sorry.

> Can you try with this instead, and let me know if it works for you please?
> And if not, please send me a copy of your config.log and base.buildinfo.
> AC_SEARCH_LIBS(iconv_open, iconv,
>                [EXTRA_LIBS="$EXTRA_LIBS $ac_lib"],
>                [exit 1])

No, I can't, because now the build stops even earlier during ghc-cabal
configure ,,, libraries/integer-gmp (see end of mail for the output).

But your proposed AC_SEARCH_LIBS won't help anyway, because it
generates a test program that just references the iconv_open()
function without #including <iconv.h>. However, on OpenBSD, libiconv.a
does not define a symbol named iconv_open but libiconv_open:

$ 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

I think if you take my diff and either just add an #include <stdlib.h>
*or* remove the iconv(cd,NULL,NULL,NULL,NULL), it should survive
on OS X.

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.


here's the current failure on libraries/integer-gmp:

"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-pk
g" --with-gcc="gcc" --configure-option=--with-cc="gcc"  --with-hscolour="/usr/local/bin/HsColour" --configure-option=CFLAGS="-O -g -O2  " --configure-option=LD
FLAGS="-L/usr/local/lib  " -- dist-install libraries/integer-gmp
Configuring integer-gmp-
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
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.
gmake[1]: *** [libraries/integer-gmp/dist-install/package-data.mk] Error 1

More information about the Libraries mailing list