Freezing a static executable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Will Ware

    #1

    Freezing a static executable

    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

  • Serge Orlov

    #2
    Re: Freezing a static executable

    Will Ware wrote:[color=blue]
    > 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:[/color]

    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.

    [color=blue]
    > What stupid thing am I doing wrong?[/color]

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

    Comment

    Working...