From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10637 invoked by alias); 28 Jul 2010 17:23:56 -0000 Received: (qmail 10594 invoked by uid 22791); 28 Jul 2010 17:23:54 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Jul 2010 17:23:46 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D84E82BAAD2 for ; Wed, 28 Jul 2010 13:23:44 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id G52IRlOwSkky for ; Wed, 28 Jul 2010 13:23:44 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A33902BAABD for ; Wed, 28 Jul 2010 13:23:44 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 2C8E5F58FA; Wed, 28 Jul 2010 10:23:39 -0700 (PDT) Date: Wed, 28 Jul 2010 17:23:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [RFC] python-config.py --ldflags should return relocated path to libpython Message-ID: <20100728172339.GL13267@adacore.com> References: <1278627885-9416-1-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1278627885-9416-1-git-send-email-brobecker@adacore.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-07/txt/msg00488.txt.bz2 > There are currently 2 issues, I think, with python-config --ldflags: > > 1. When python is configured with --enable-shared: > -L/lib is missing. This is a problem if python was > installed in a non-standard location. > > 2. When Python is configured without --enable-shared: > The path to the libpython archive is provided in the command output, > but the path that gets returned is the path used at configure time. > If the Python install was copied over to a different machine and > then installed at a different location, then the path in -L > is incorrect (by comparison, python-config --cflags returns > the location with the correct prefix). [...] > This patch should fix both situations. I will also send the patch > upstream to the Python developers, to see what they say. No comment either on the Python side or on the gdb-patches side. > gdb/ChangeLog: > > * python/python-config.py: When --ldflags is specified, make sure > that the paths printed are relative to the run-time prefix. > Always provide the path to libpython, even when the python > install provides a shared version of libpython. I think it's too late for 7.2, but I would like to apply this patch on the HEAD. Any objections? If we ever create a 7.2.1, and this patch was shown to not cause any problem, then perhaps I'll consider it for backporting on the 7.2 branch - if approved by the GMs. > Tested on x86_64-linux, with 2.5 and 2.6. Briefly tested with 2.7, > but only by running python-config.py and visually verifying the output. > > --- > gdb/python/python-config.py | 15 ++++++++++++++- > 1 files changed, 14 insertions(+), 1 deletions(-) > > diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py > index 0230eb4..aa4aea3 100644 > --- a/gdb/python/python-config.py > +++ b/gdb/python/python-config.py > @@ -50,8 +50,21 @@ for opt in opt_flags: > # add the prefix/lib/pythonX.Y/config dir, but only if there is no > # shared library in prefix/lib/. > if opt == '--ldflags': > + # Provide the location where the Python library is installed. > + # We always provide it, because Python may have been installed > + # at a non-standard location. > if not getvar('Py_ENABLE_SHARED'): > - libs.insert(0, '-L' + getvar('LIBPL')) > + # There is no shared library in prefix/lib. The static > + # library is in prefix/lib/pythonX.Y/config. > + # > + # Note that we cannot use getvar('LIBPL') like we used to, > + # because it provides the location at build time, which might > + # be different from the actual location at runtime. > + libdir = sysconfig.get_python_lib(standard_lib=True) + '/config' > + else: > + # The Python shared library is installed in prefix/lib. > + libdir = sysconfig.PREFIX + '/lib' > + libs.insert(0, '-L' + libdir) > libs.extend(getvar('LINKFORSHARED').split()) > print ' '.join(libs) > > -- > 1.7.1 -- Joel