Q: Making Python use no shared extension modules?

cmkl cmkleffner at gmx.de
Fri Jun 11 10:10:28 CEST 2004

mrmakent at cox.net (Michael Kent) wrote in message news:<e7604b14.0406100612.40befded at posting.google.com>...
> I need to deploy Python 'frozen' apps to machine without a Python
> installation.  I want to be able to deploy just the app's executable,
> without having to also ship/install any shared-library extensions for
> Python.
> To do this, I need to be able to build and install Python on my
> development machines (AIX 4.3, HPUX, Unixware, Linux) such that Python
> is one monolithic executable, without dependency on any shared
> libraries (other than standard OS shared libraries).  In other words,
> no shared libraries for Python extension modules, I need all extension
> modules to be linked in via libpython*.a.
> I've been fighting with this for some time.  There does not seem to be
> a clean/simple way of doing this short of hacking the Modules/Setup*
> files.  What is the accepted way of doing this?  Is there no configure
> command-line option to do this that works on all platforms?  I'm aware
> of '--disable-shared'; it seems to only partially/unreliably work.

Two years ago I carried out all the steps on a Linux machine and later on 
a HPUX 11 workstation to build a 'single file interpreter python'. This 
was for Python-2.1 but I think later Python versions will build the same
way. Basically what you need is a line in Modules/Setup which contains: 
instead of
as a marker to accomplish static versus shared linking.
As next step all needed extensions have to specified in Modules/Setup
and maybe you have manually to exclude some extensions in 'setup.py'.

If you restart the <configure, make , make test> loop over and over
again DON'T forget to clean with: 
   make clean ; rm config.cache ; rm config.status

Be sure to use gnu's make (gmake on some systems) binary.


More information about the Python-list mailing list