From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1463 invoked by alias); 25 Jun 2014 01:47:14 -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 1242 invoked by uid 89); 25 Jun 2014 01:46:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vc0-f171.google.com Received: from mail-vc0-f171.google.com (HELO mail-vc0-f171.google.com) (209.85.220.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 25 Jun 2014 01:46:40 +0000 Received: by mail-vc0-f171.google.com with SMTP id id10so1215901vcb.16 for ; Tue, 24 Jun 2014 18:46:38 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.58.248.34 with SMTP id yj2mr3900052vec.43.1403660797944; Tue, 24 Jun 2014 18:46:37 -0700 (PDT) Received: by 10.221.50.202 with HTTP; Tue, 24 Jun 2014 18:46:37 -0700 (PDT) In-Reply-To: <214EDCB8-BEE1-4E6D-801E-D57B46AD7424@dell.com> References: <56168225.tkKpPXRO26@dabox> <214EDCB8-BEE1-4E6D-801E-D57B46AD7424@dell.com> Date: Wed, 25 Jun 2014 01:47:00 -0000 Message-ID: Subject: Re: Is it possible to statically link python into gdb? From: Terry Guo To: Paul_Koning@dell.com Cc: tim@krieglstein.org, gdb@sourceware.org, Antonio Cavallo Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00077.txt.bz2 On Mon, Jun 23, 2014 at 11:48 PM, wrote: > > On Jun 23, 2014, at 9:49 AM, Tim Sander wrote: > >> Hi Terry >>> I am trying to build a gdb with python support which doesn't depend on >>> system python at all. I can manage to build python into static library >>> like libpython2.7.a, then I can see that this static library is linked >>> into gdb. With command ldd, there is no libpython dependence in final >>> gdb. So far all good. But when run this gdb on another machine, I ran >>> into below errors and gdb can't be initiated: >>> >>> Could not find platform independent libraries >>> Could not find platform dependent libraries >>> Consider setting $PYTHONHOME to [:] >>> >>> I am working on Ubuntu x86 machines with gdb from master branch and >>> Python 2.7. Could some one please help me? Thanks in advance. >> I don't know much about python but might it be that you need the *.py fi= les >> of PYTHONHOME/lib nevertheless to get a running python interpreter? > > I assume you=E2=80=99d need at least a couple, for the standard Python st= artup machinery to work. Some of that can be suppressed when Python is inv= olved by a command; I assume this can also be done when Python is embedded. > > Note also that a lot of Python modules are not just .py files but also .s= o files or equivalent. > > paul Hi folks, Very appreciate your help. Indeed the python that is statically linked into gdb needs other modules to run correctly. I now worked around this issue by following steps: 1). build and install python 2.7 in dynamic way (produced the libpython2.7.so instead of libpython2.7.a). This python is installed to my own path instead of system path. 2). unset the variable PYTHONHOME and then export PYTHONHOME=3DMY-OWN-PATH:/usr, then configure, build and install gdb. 3). now copy the gdb to other machine, everything works fine. The only requirement is user will need to install libpython2.7 in their machine. 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. BR, Terry