public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] Fix --enable-plugins --without-python
@ 2010-10-17 10:41 Jan Kratochvil
  2010-11-02 18:43 ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2010-10-17 10:41 UTC (permalink / raw)
  To: gdb-patches

Hi,

currently --enable-plugins --without-python will:
Reading symbols from .../gdb...I'm sorry, Dave, I can't do that.  Symbol format `elf64-x86-64' unknown.

due to missing elfread.c due to:

 configure:14941: checking for ELF support in BFD
 configure:14960: gcc -o conftest -g -I./../include -I../bfd -I./../bfd     -L../bfd -L../libiberty conftest.c -lbfd -liberty  -lncurses -lz -lm    >&5
-configure:14960: $? = 0
-configure:14968: result: yes
+/usr/bin/ld: ../bfd/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
+/usr/bin/ld: note: 'dlsym@@GLIBC_2.2.5' is defined in DSO /lib64/libdl.so.2 so try adding it to the linker command line
+[...]
+configure:14968: result: no

Tested on x86_64-fedora13-linux-gnu.

As bfd/ uses just:

bfd/configure.in
# AC_PLUGINS setting $plugins is called by ACX_LARGEFILE.
ACX_LARGEFILE
AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")

bfd/Makefile.am
if PLUGINS
LIBDL = -ldl
endif

and I believe bfd/ is assumed to have the same configure options as gdb/ (is
it?) proposing this patch.


Thanks,
Jan


gdb/
2010-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix configure --enable-plugins --without-python.
	* configure.ac (for ELF support in BFD) <"$plugins" = "yes">: New.
	* configure: Regenerate.

--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1838,6 +1838,9 @@ OLD_LIBS=$LIBS
 CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd"
 LDFLAGS="$LDFLAGS -L../bfd -L../libiberty"
 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
+if test "$plugins" = "yes"; then
+  LIBS="-ldl $LIBS"
+fi
 LIBS="-lbfd -liberty $intl $LIBS"
 AC_CACHE_CHECK([for ELF support in BFD], gdb_cv_var_elf,
 [AC_TRY_LINK(
@@ -1851,6 +1854,9 @@ if test $gdb_cv_var_elf = yes; then
   CONFIG_OBS="$CONFIG_OBS elfread.o"
   AC_DEFINE(HAVE_ELF, 1,
 	    [Define if ELF support should be included.])
+  if test "$plugins" = "yes"; then
+    OLD_LIBS="-ldl $OLD_LIBS"
+  fi
 fi
 CFLAGS=$OLD_CFLAGS
 LDFLAGS=$OLD_LDFLAGS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] Fix --enable-plugins --without-python
  2010-10-17 10:41 [patch] Fix --enable-plugins --without-python Jan Kratochvil
@ 2010-11-02 18:43 ` Joel Brobecker
  2010-11-05  1:52   ` Jan Kratochvil
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2010-11-02 18:43 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

> gdb/
> 2010-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Fix configure --enable-plugins --without-python.
> 	* configure.ac (for ELF support in BFD) <"$plugins" = "yes">: New.
> 	* configure: Regenerate.

Grumpf! It would be nice if BFD was telling us which libraries we need
to link against bfd, just as Gtk+, Python, etc, do.

I'm a little concern that this is a bit primitive, and good enough only
on GNU/Linux or maybe Unix.  Or rather, that this might break the build
on some platforms such as Windows.  But that's not the case, since
the user would need to use --enable-plugins to enable plugins (it's
not automatic), so I don't see a better solution that's actually
worth the effort.

> +if test "$plugins" = "yes"; then
> +  LIBS="-ldl $LIBS"
> +fi

A comment explaining the dependency would be nice (likewise below). 

> +  if test "$plugins" = "yes"; then
> +    OLD_LIBS="-ldl $OLD_LIBS"
> +  fi

-- 
Joel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] Fix --enable-plugins --without-python
  2010-11-02 18:43 ` Joel Brobecker
@ 2010-11-05  1:52   ` Jan Kratochvil
  2010-11-05  9:08     ` Mark Kettenis
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2010-11-05  1:52 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Tue, 02 Nov 2010 08:43:41 -1000, Joel Brobecker wrote:
> Grumpf! It would be nice if BFD was telling us which libraries we need
> to link against bfd, just as Gtk+, Python, etc, do.

I agree we should port the sourceware tree to pkg-config. :-)


> I'm a little concern that this is a bit primitive, and good enough only
> on GNU/Linux or maybe Unix.  Or rather, that this might break the build
> on some platforms such as Windows.  But that's not the case, since
> the user would need to use --enable-plugins to enable plugins (it's
> not automatic), so I don't see a better solution that's actually
> worth the effort.

bfd/Makefile.am also just adds `-ldl' (into *_LIBADD) so while I do not
understand what everything is emulated on these non-UNIX platforms I guess it
is either broken for --enable-plugins already even for bfd/ or it should work
even in gdb/ .


> A comment explaining the dependency would be nice (likewise below). 

Done.

Checked-in.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2010-11/msg00028.html

--- src/gdb/ChangeLog	2010/11/05 01:40:27	1.12297
+++ src/gdb/ChangeLog	2010/11/05 01:50:17	1.12298
@@ -1,5 +1,11 @@
 2010-11-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
+	Fix configure --enable-plugins --without-python.
+	* configure.ac (for ELF support in BFD) <"$plugins" = "yes">: New.
+	* configure: Regenerate.
+
+2010-11-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
 	* solib.c (solib_read_symbols): Call exception_fprintf even without
 	FROM_TTY.  Print also so->so_name.
 
--- src/gdb/configure	2010/10/06 16:02:43	1.318
+++ src/gdb/configure	2010/11/05 01:50:17	1.319
@@ -14937,6 +14937,10 @@
 CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd"
 LDFLAGS="$LDFLAGS -L../bfd -L../libiberty"
 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
+# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
+if test "$plugins" = "yes"; then
+  LIBS="-ldl $LIBS"
+fi
 LIBS="-lbfd -liberty $intl $LIBS"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5
 $as_echo_n "checking for ELF support in BFD... " >&6; }
@@ -14972,6 +14976,10 @@
 
 $as_echo "#define HAVE_ELF 1" >>confdefs.h
 
+  # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
+  if test "$plugins" = "yes"; then
+    OLD_LIBS="-ldl $OLD_LIBS"
+  fi
 fi
 CFLAGS=$OLD_CFLAGS
 LDFLAGS=$OLD_LDFLAGS
--- src/gdb/configure.ac	2010/10/06 16:02:43	1.132
+++ src/gdb/configure.ac	2010/11/05 01:50:18	1.133
@@ -1838,6 +1838,10 @@
 CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd"
 LDFLAGS="$LDFLAGS -L../bfd -L../libiberty"
 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
+# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
+if test "$plugins" = "yes"; then
+  LIBS="-ldl $LIBS"
+fi
 LIBS="-lbfd -liberty $intl $LIBS"
 AC_CACHE_CHECK([for ELF support in BFD], gdb_cv_var_elf,
 [AC_TRY_LINK(
@@ -1851,6 +1855,10 @@
   CONFIG_OBS="$CONFIG_OBS elfread.o"
   AC_DEFINE(HAVE_ELF, 1,
 	    [Define if ELF support should be included.])
+  # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
+  if test "$plugins" = "yes"; then
+    OLD_LIBS="-ldl $OLD_LIBS"
+  fi
 fi
 CFLAGS=$OLD_CFLAGS
 LDFLAGS=$OLD_LDFLAGS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] Fix --enable-plugins --without-python
  2010-11-05  1:52   ` Jan Kratochvil
@ 2010-11-05  9:08     ` Mark Kettenis
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Kettenis @ 2010-11-05  9:08 UTC (permalink / raw)
  To: jan.kratochvil; +Cc: brobecker, gdb-patches

> Date: Thu, 4 Nov 2010 15:51:49 -1000
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> 
> On Tue, 02 Nov 2010 08:43:41 -1000, Joel Brobecker wrote:
> > Grumpf! It would be nice if BFD was telling us which libraries we need
> > to link against bfd, just as Gtk+, Python, etc, do.
> 
> I agree we should port the sourceware tree to pkg-config. :-)

Oh dear god, no!

> > I'm a little concern that this is a bit primitive, and good enough only
> > on GNU/Linux or maybe Unix.  Or rather, that this might break the build
> > on some platforms such as Windows.  But that's not the case, since
> > the user would need to use --enable-plugins to enable plugins (it's
> > not automatic), so I don't see a better solution that's actually
> > worth the effort.
> 
> bfd/Makefile.am also just adds `-ldl' (into *_LIBADD) so while I do not
> understand what everything is emulated on these non-UNIX platforms I guess it
> is either broken for --enable-plugins already even for bfd/ or it should work
> even in gdb/ .

Ugh, no, this is broken.  On OpenBSD for example, there is no libdl, since
dlopen(3) and friends are available in libc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-05  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-17 10:41 [patch] Fix --enable-plugins --without-python Jan Kratochvil
2010-11-02 18:43 ` Joel Brobecker
2010-11-05  1:52   ` Jan Kratochvil
2010-11-05  9:08     ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).