Q: Making Python use no shared extension modules?

M

Michael Kent

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.
 
S

simo

I don't think you can do it.

The closest you'd get is McMillan Installer's --onefile which
basically zips up all the modules into one file, which decompressed on
the fly when run, although when I've tried it on clean Linux boxes, it
still requires non-Python stuff (like a wxPython app still requires
wxTGK installed).
 
C

cmkl

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:
*static*
instead of
*shared*
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.

Carl
 
M

Michael Kent

I don't think you can do it.

The closest you'd get is McMillan Installer's --onefile which
basically zips up all the modules into one file, which decompressed on
the fly when run, although when I've tried it on clean Linux boxes, it
still requires non-Python stuff (like a wxPython app still requires
wxTGK installed).

Thanks for the reponse, but let's make sure we are talking about the
right problem.

I know that I can put '*static*' in Modules/Setup, which will cause
all of the extension modules build via the Setup mechanism to be
staticly-linked to the Python executable. That's what I'm after, but
it requires me to specifically turn-on each extension module that I
want staticly-linked. What I'm really after is some sort of configure
option that says "universally build all extension modules so that they
will be staticly-linked into the Python executable, build NO shared
libraries". You would think such an option exists. You would think
it was '--disable-shared'. But this does not seem to be the case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top