
On 31/05/2011 13:24, Daniel Fischer wrote:
On Tuesday 31 May 2011 12:31:36, Simon Marlow wrote:
The ticket has low priority, but if anybody has an idea how to check whether libbfd depends on libz in the configure script, I'd appreciate it.
Could you install a shared version of libbfd?
I have one,
$ locate libbfd /home/dafis/.deps/libbfd.Plo /usr/lib/libbfd-2.20.0.20100122-6.so /usr/lib/libbfd.a /usr/lib/libbfd.la
The problem is, as far as I can tell, that a) libbfd.a is picked up instead of the .so in the first place, and b) that both depend on libz:
$ ldd /usr/lib/libbfd-2.20.0.20100122-6.so linux-gate.so.1 => (0xffffe000) libz.so.1 => /lib/libz.so.1 (0xb743e000) libc.so.6 => /lib/libc.so.6 (0xb72d3000) /lib/ld-linux.so.2 (0xb76fd000)
What you need is libbfd.so, which is a symbolic link to the versioned library (libbfd-2.20.0.20100122-6.so). This is normally installed by the development version of the library (e.g. libbfd-dev on Debian-derived distros). The shared version has the dependency built-in, so the GHC build system wouldn't have to do anything (that's how it works here).
I'm far from an expert, but as far as I can see, there is already such a test, in configure.ac:
AC_CHECK_LIB(bfd, bfd_init)
I think that only tests for the presence of the symbol in the library, it doesn't test that compiling an executable against that library actually works.
with a test using bfd_init in configure. Unfortunately, that doesn't detect if libz is needed without using some functions depending on it. If I had the slightest idea how to make it detect the dependency on libz, I happily would, but I've not yet found any introduction to shell scripting or using autotools accessible to a complete beginner.
Yes, I'm afraid the learning curve is a bit steep. It's so hard to get right that I wouldn't even attempt to try to fix it without a machine to test on! A good place to start would be tests that do similar things - a quick look at the code suggests AC_COMPILE_IFFELSE and AC_LINK_IFFELSE might be useful, also FP_CHECK_FUNC looks like it might do what you want. Cheers, Simon