From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10584 invoked by alias); 7 Mar 2013 23:14:17 -0000 Received: (qmail 10573 invoked by uid 22791); 7 Mar 2013 23:14:15 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_LN X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Mar 2013 23:14:02 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r27NE1g3008104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Mar 2013 18:14:01 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r27NE0XO029253 for ; Thu, 7 Mar 2013 18:14:01 -0500 Subject: [RFA PATCH] Fix --dynamic-list test's workaround for http://bugs.python.org/issue4434. To: gdb-patches@sourceware.org From: Pedro Alves Date: Thu, 07 Mar 2013 23:14:00 -0000 Message-ID: <20130307231400.13859.88836.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00319.txt.bz2 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 * 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"],