From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31333 invoked by alias); 25 Jun 2014 14:37:01 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 31317 invoked by uid 89); 25 Jun 2014 14:37:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 25 Jun 2014 14:36:59 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id CCACA1162AA; Wed, 25 Jun 2014 10:36:57 -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 sU13hDWuq1wL; Wed, 25 Jun 2014 10:36:57 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 97350116210; Wed, 25 Jun 2014 10:36:57 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id B925C40F75; Wed, 25 Jun 2014 07:36:57 -0700 (PDT) Date: Wed, 25 Jun 2014 14:37:00 -0000 From: Joel Brobecker To: Terry Guo Cc: Paul_Koning@dell.com, tim@krieglstein.org, gdb@sourceware.org, Antonio Cavallo Subject: Re: Is it possible to statically link python into gdb? Message-ID: <20140625143657.GI5253@adacore.com> References: <56168225.tkKpPXRO26@dabox> <214EDCB8-BEE1-4E6D-801E-D57B46AD7424@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-06/txt/msg00080.txt.bz2 > I admit that I have to make a compromise here. I am delivering gdb to > my customer and my expectation is that they can use my gdb with python > support no matter there is python in their system and no matter the > version of their installed python. After a lot of attempts, I think I > can't reach my expectation. I guess I have to live with my above > workaround. What we do is statically link Python into GDB, and then distribute both GDB + Python. As long as the path to Python is inside the configured prefix, the path to the Python libraries should be "relocatable", allowing users to install the binary package anywhere and GDB will always find them. One thing we also do that's not done in the FSF version of GDB is the following: @@ -1680,6 +1680,10 @@ message == an error message without a stack will be printed."), #else Py_SetProgramName (progname); #endif + + /* We override any value that the PYTHONHOME might have, as we want + to make sure that we use the Python library that comes with GDB. */ + Py_SetPythonHome (ldirname (python_libdir)); #endif Py_Initialize (); Some users have had their own version of Python which may be incompatible with the version we ship in GDB, so we make sure that within GDB, we use the Python that we built with. -- Joel