Freezing a static executable

Serge Orlov Serge.Orlov at gmail.com
Mon Jun 5 09:14:55 EDT 2006


Will Ware wrote:
> I am trying to freeze a static executable. I built a static Python
> executable this way:
>     ./configure --disable-shared --prefix=/usr/local
>     make
>     make install
> Even that didn't give me a really static executable, though:

AFAIK it's not supported because the interpreter won't be able to load
C extensions if compiled statically. There is a bootstrap issue, to
build a static python executable you need extensions built but to build
extensions you need python, so you need unconventional build procedure.

After python build is finished you get static library libpython2.4.a.
Then you need all extensions you're going to use built as .a files (I'm
not even sure there is a standard way to do it). Then you need to write
a loader like in py2exe, exemaker, pyinstaller, etc that will
initialize python interperter and extensions. Those three pieces
(libpython2.4.a, extensions, loader) can be linked as a static
executable.


> What stupid thing am I doing wrong?

You are just trying to do something nobody was really interested to
implement.




More information about the Python-list mailing list