Freezing a static executable

W

Will Ware

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:
$ ldd /usr/local/bin/python
linux-gate.so.1 => (0xffffe000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7f44000)
libdl.so.2 => /lib/libdl.so.2 (0xb7f40000)
libutil.so.1 => /lib/libutil.so.1 (0xb7f3c000)
libm.so.6 => /lib/tls/libm.so.6 (0xb7f17000)
libc.so.6 => /lib/tls/libc.so.6 (0xb7de9000)
/lib/ld-linux.so.2 (0xb7f70000)
Then I typed this:
/usr/local/bin/python
/home/wware/Python-2.4.1/Tools/freeze/freeze.py foo.py
ldd foo
$ ldd foo
linux-gate.so.1 => (0xffffe000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7f5a000)
libdl.so.2 => /lib/libdl.so.2 (0xb7f56000)
libutil.so.1 => /lib/libutil.so.1 (0xb7f52000)
libm.so.6 => /lib/tls/libm.so.6 (0xb7f2d000)
libc.so.6 => /lib/tls/libc.so.6 (0xb7dff000)
/lib/ld-linux.so.2 (0xb7f86000)
What stupid thing am I doing wrong?
TIA for any advice
Will Ware
 
S

Serge Orlov

Will said:
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.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top