Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [RFA PATCH] Fix --dynamic-list test's workaround for http://bugs.python.org/issue4434.
Date: Thu, 07 Mar 2013 23:14:00 -0000	[thread overview]
Message-ID: <20130307231400.13859.88836.stgit@brno.lan> (raw)

After a chat on IRC, I noticed that my gdb binary was linking with
-Wl,--export-dynamic instead of the better -Wl,--dynamic-list.

Turns out the link/run test that checks for static python has a bug:

    configure:11856: checking for the dynamic export flag
    configure:11909: gcc -o conftest -g3 -O0 -fno-strict-aliasing -DNDEBUG -fwrapv -static-libstdc++ -static-libgcc -Wl,--dynamic-list=../../src/gdb/proc-service.list conftest.c -ldl -lncurses -lz -lm >&5
    /tmp/ccHIJn3p.o: In function `main':
    /home/pedro/gdb/mygit/build/gdb/conftest.c:173: undefined reference to `Py_Initialize'
    /home/pedro/gdb/mygit/build/gdb/conftest.c:174: undefined reference to `PyRun_SimpleStringFlags'
    /home/pedro/gdb/mygit/build/gdb/conftest.c:175: undefined reference to `Py_Finalize'
    collect2: error: ld returned 1 exit status
    configure:11909: $? = 1
    configure: program exited with status 1
    configure: failed program was:

... it doesn't actually link with -lpython.

This looks to me to be the correct fix.  I now get:

    configure:11856: checking for the dynamic export flag
    configure:11910: gcc -o conftest -g3 -O0  -fno-strict-aliasing -DNDEBUG -fwrapv   -static-libstdc++ -static-libgcc  -Wl,--dynamic-list=../../src/gdb/proc-service.list -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic conftest.c -ldl -lncurses -lz -lm    >&5
    configure:11910: $? = 0
    configure:11910: ./conftest
    configure:11910: $? = 0
    configure:11929: result: -Wl,--dynamic-list

OK?

gdb/
2013-03-07  Pedro Alves  <palves@redhat.com>

	* configure: Regenerate.
	* configure.ac (check dynamic export flag): Link python test with
	$PYTHON_LIBS.
---
 gdb/configure    |    1 +
 gdb/configure.ac |    1 +
 2 files changed, 2 insertions(+)

diff --git a/gdb/configure b/gdb/configure
index c54709c..68cd436 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -11888,6 +11888,7 @@ rm -f core conftest.err conftest.$ac_objext \
      # Problem does not happen for the recommended libpythonX.Y.so linkage.
      old_CFLAGS="$CFLAGS"
      CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+     LDFLAGS="$LDFLAGS $PYTHON_LIBS"
      if test "$cross_compiling" = yes; then :
   true
 else
diff --git a/gdb/configure.ac b/gdb/configure.ac
index e501766..71c5efb 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1687,6 +1687,7 @@ if test "${gdb_native}" = yes; then
      # Problem does not happen for the recommended libpythonX.Y.so linkage.
      old_CFLAGS="$CFLAGS"
      CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+     LDFLAGS="$LDFLAGS $PYTHON_LIBS"
      AC_RUN_IFELSE(
        AC_LANG_PROGRAM(
          [#include "]${have_libpython}[/Python.h"],


             reply	other threads:[~2013-03-07 23:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 23:14 Pedro Alves [this message]
2013-03-11 18:14 ` Jan Kratochvil
2013-03-11 18:35   ` Pedro Alves
2013-03-11 18:52     ` [commit] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130307231400.13859.88836.stgit@brno.lan \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox