statically linking the entire runtime (HPUX Python2.1)

cmkl cmkleffner at gmx.de
Thu Jun 14 11:36:09 EDT 2001


hi,

freeze.py is your friend! It lives in the source-code distribution
directory: ./Tools/freeze

1) You need the python sources, you need a C compiler

2) You have to build, test and install python from source

3) Somewhere in your install directory is the static
   python runtime library  libpythonxxx.a

4) copy the freeze directory somewhere
   python freeye.py -h gives some help on necessary options

5) python /whateverdir/freeze.py -o mydir -e /somedir/informixdb test.py
   will copy a lot of files in mydir/   - type 'make' there and you 
   will get your pythenabled binary

   /somedir/informixdb in this example is a directory with 
   additional objectfiles for C-modules (informixdb int his case)

6) If you are not happy with the Makefile, change
   ./lib/python2.0/config/Makefile

Unfortunately python2.1 comes with 'setup.py', which will install
alot of C-modules as shared library. 

Carl


GADGIL PRASAD     /INFRA/INFOTECH <GADGILP at INFOTECH.ICICI.com> wrote in message news:<mailman.992502501.26945.python-list at python.org>...
> hello,
> 
> forgive me for ignorance, but I didnt know of creating a standalone exe from
> a 
> python prog on unix, I went all the way to rewrite a python code to C prog
> cause, 
> I needed to have a binary only. I guess, FAQ doesn't mention this. Utils I
> guess
> do something similar for win platforms like py2exe which I use.
> 
> Can a easy to follow procedure be posted by the knowledgable for those not
> very 
> proficient in handling C source compilations inolving make and whatnot.
> 
> /prasad
> 
> -----Original Message-----
> From: Andrew MacIntyre [mailto:andymac at bullseye.apana.org.au]
> Sent: Wednesday, June 13, 2001 5:30 PM
> To: python-list at python.org
> Subject: Re: statically linking the entire runtime (HPUX Python2.1)
> 
> 
> On 12 Jun 2001, cmkl wrote:
> 
> > On HP-UX I'm trying to build python2.1 without building the C-modules
>  found
> > in Modules/ as shared libraries. With the Version 2.0 this was the
>  default.
> > I played around with configure, setup.py and Modules/Setup but I always
> > end up with a binary depending on various shared libraries.
> > I need this, bacause I want to freeze my pythons scripts as a single
>  binary.
> > Distribution is much easier this way.
> > What is the trick to do that?
> 
> I don't know specifically about HP-UX, but in general:
> 1: uncomment the modules you want in Modules/Setup
> 2: comment any "*shared*" terms in Modules/Setup
> 3: don't bother with setup.py, as its only for dynload modules
> 
> --
> Andrew I MacIntyre                     "These thoughts are mine alone..."
> E-mail: andrew.macintyre at aba.gov.au    (work) | Snail: PO Box 370
>         andymac at bullseye.apana.org.au  (play) |        Belconnen  ACT  2616
>         andymac at pcug.org.au           (play2) |        Australia



More information about the Python-list mailing list