aMule Forum

English => Compilation problems => Topic started by: Gerd78 on January 16, 2011, 12:22:40 AM

Title: bfd check fails with binutils-2.21
Post by: Gerd78 on January 16, 2011, 12:22:40 AM
Just noticed in config.log after updating binutils to the openSUSE 11.4 ("factory") package:
Code: [Select]
configure:13922: checking for bfd
configure:13948: gcc -o conftest     conftest.c -lbfd -liberty  -lz  >&5
conftest.c: In function 'main':
conftest.c:177:19: warning: initialization discards qualifiers from pointer target type
/usr/lib/gcc/i586-suse-linux/4.5/../../../libbfd.a(plugin.o): In function `try_load_plugin':
/usr/src/packages/BUILD/binutils-2.21/build-dir/bfd/../../bfd/plugin.c:132: undefined reference to `dlopen'
/usr/src/packages/BUILD/binutils-2.21/build-dir/bfd/../../bfd/plugin.c:139: undefined reference to `dlsym'
/usr/src/packages/BUILD/binutils-2.21/build-dir/bfd/../../bfd/plugin.c:135: undefined reference to `dlerror'
collect2: ld returned 1 exit status
configure:13948: $? = 1
-lbfd seems to require -ldl (as it's called on Linux, might be called differently on other systems) now.
Title: Re: bfd check fails with binutils-2.21
Post by: Gerd78 on January 19, 2011, 05:25:38 PM
Correcting myself: The determining factor is not binutils version 2.21, but whether binutils was compiled with --enable-plugins. It just happened that openSUSE added --enable-plugins at the same time the package was updated to version 2.21 (http://lists.opensuse.org/opensuse-commit/2011-01/msg00301.html).

Is this the right way to fix it? Appears to work for me.
Code: [Select]
--- ./acinclude.m4
+++ ./acinclude.m4
@@ -439,7 +439,7 @@
 
  AC_MSG_CHECKING([for bfd])
  result=no
- for bfd_ldadd in "" "${LIBINTL}"; do
+ for bfd_ldadd in "" "${LIBINTL}" "-ldl"; do
  MULE_BACKUP([LIBS])
  MULE_BACKUP([LDFLAGS])
  MULE_PREPEND([LIBS], [-lbfd -liberty ${bfd_ldadd} ${ZLIB_LIBS}])
Title: Re: bfd check fails with binutils-2.21
Post by: GonoszTopi on January 19, 2011, 08:02:51 PM
Is this the right way to fix it?
Better this way:
Code: [Select]
--- ./acinclude.m4
+++ ./acinclude.m4
@@ -439,7 +439,7 @@
 
  AC_MSG_CHECKING([for bfd])
  result=no
- for bfd_ldadd in "" "${LIBINTL}"; do
+ for bfd_ldadd in "" "${LIBINTL}" "-ldl" "-ldl ${LIBINTL}"; do
  MULE_BACKUP([LIBS])
  MULE_BACKUP([LDFLAGS])
  MULE_PREPEND([LIBS], [-lbfd -liberty ${bfd_ldadd} ${ZLIB_LIBS}])
Title: Re: bfd check fails with binutils-2.21
Post by: Gerd78 on January 19, 2011, 09:45:15 PM
Hm, I thought that glibc systems have libintl integrated in glibc and non-glibc systems have dlopen/dlsym/dlerror integrated in their respective libc, but now I see you may be right, Solaris seems to have both libintl and libdl outside its libc.

I did not actually test this on Solaris, however. Anyway, the extra test does certainly no harm, in the worst case it is not used.
Title: Re: bfd check fails with binutils-2.21
Post by: GonoszTopi on January 20, 2011, 10:04:37 PM
Committed in rev. 10436.
Title: Re: bfd check fails with binutils-2.21
Post by: Gerd78 on January 20, 2011, 10:55:29 PM
Thanks!