From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18596 invoked by alias); 12 Sep 2012 23:23:03 -0000 Received: (qmail 18587 invoked by uid 22791); 12 Sep 2012 23:23:02 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Sep 2012 23:22:49 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TBwGd-00059H-2b from meador_inge@mentor.com ; Wed, 12 Sep 2012 16:22:47 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 12 Sep 2012 16:22:47 -0700 Received: from [172.30.4.105] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Wed, 12 Sep 2012 16:22:46 -0700 Message-ID: <50511945.2070400@codesourcery.com> Date: Wed, 12 Sep 2012 23:23:00 -0000 From: Meador Inge User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120424 Thunderbird/12.0 MIME-Version: 1.0 To: CC: Subject: Using Py_SetPythonHome Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2012-09/txt/msg00031.txt.bz2 Hi All, I noticed in Nov 2010 Joel proposed adding a call to Py_SetPythonHome in this thread [1]. However, it seems that got dropped. I would like to bring this topic up again. The use case I am having trouble with is the one where gdb gets shipped with: (1) its own pythonxy.so, (2) a zipped standard library, and (3) a directory for the standard library module shared libraries. In this case, Py_SetPythonHome needs to be called before Py_Initialize so that the standard library pieces can even be found (Py_Initialize does some imports). So, I was playing around with something like what Joel proposed, but before Py_Initiliaze: diff --git a/gdb/python/python.c b/gdb/python/python.c index 482f53e..fa86e61 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1353,6 +1353,7 @@ message == an error message without a stack will be printe This must be done before calling Py_Initialize. */ Py_SetProgramName (concat (ldirname (python_libdir), SLASH_STRING, "bin", SLASH_STRING, "python", NULL)); + Py_SetPythonHome (ldirname (python_libdir)); #endif Py_Initialize (); Is there another way around the problem I am having? Have the feelings concerning Py_SetPythonHome changed since comments in [1] ? [1] http://sources.redhat.com/ml/gdb-patches/2010-11/msg00328.html -- Meador Inge CodeSourcery / Mentor Embedded http://www.mentor.com/embedded-software