This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA PATCH] Fix --dynamic-list test's workaround for http://bugs.python.org/issue4434.


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"],


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]