Freeze statically

Discussion in 'Python' started by Sebastien Dudek, Jul 11, 2011.

  1. Hi everyone!

    Let me explain you my big adventure. So I trying to make a static
    python executable using the native Python freeze. I've modified the
    file Modules/Setup.dist using this perl cli : perl -pi -e 's!(^#
    \*shared\*)!*static*\n$1!' Modules/Setup.dist

    Then ./configure, make && make install

    If I'm using my python interpreter to build with freeze a simple
    project that we can call "hello world". It works perfectly but it is
    still : "dynamically linked (uses shared libs)". So modifying the
    Makefile using '-static' for linking, I hopped I could make it static.

    But... it fail :
    +------------------------------------------------------------------------------------------------------------------------------------------
    +
    ....
    /home/fluxius/Python-2.7.2/./Modules/pwdmodule.c:156: warning: Using
    'setpwent' in statically linked applications requires at runtime the
    shared libraries from the glibc version used for linking
    /home/fluxius/Python-2.7.2/./Modules/pwdmodule.c:168: warning: Using
    'endpwent' in statically linked applications requires at runtime the
    shared libraries from the glibc version used for linking
    /usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer
    equality in `/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/
    4.5.2/../../../libc.a(strcmp.o)' can not be used when making an
    executable; recompile with -fPIE and relink with -pie
    collect2: ld returned 1 exit status
    make: *** [hello] Erreur 1
    +------------------------------------------------------------------------------------------------------------------------------------------
    +

    Help me please!! =)
    Sebastien Dudek, Jul 11, 2011
    #1
    1. Advertising

  2. Actually, there is a solution but not very clean.

    I was surprise by two différent tools:
    - Statifier (but it needs to be compiled without ASLR)
    - And ErminePro which is very powerful to transform dynamic
    executables to static.

    But if someone is aware about compiling python code to static more
    properly, I'm in!


    On Jul 11, 2:24 pm, Sebastien Dudek <> wrote:
    > Hi everyone!
    >
    > Let me explain you my big adventure. So I trying to make a static
    > python executable using the native Python freeze. I've modified the
    > file Modules/Setup.dist using this perl cli : perl -pi -e 's!(^#
    > \*shared\*)!*static*\n$1!' Modules/Setup.dist
    >
    > Then ./configure, make && make install
    >
    > If I'm using my python interpreter to build with freeze a simple
    > project that we can call "hello world". It works perfectly but it is
    > still : "dynamically linked (uses shared libs)". So modifying the
    > Makefile using '-static' for linking, I hopped I could make it static.
    >
    > But... it fail :
    > +------------------------------------------------------------------------------------------------------------------------------------------
    > +
    > ...
    > /home/fluxius/Python-2.7.2/./Modules/pwdmodule.c:156: warning: Using
    > 'setpwent' in statically linked applications requires at runtime the
    > shared libraries from the glibc version used for linking
    > /home/fluxius/Python-2.7.2/./Modules/pwdmodule.c:168: warning: Using
    > 'endpwent' in statically linked applications requires at runtime the
    > shared libraries from the glibc version used for linking
    > /usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer
    > equality in `/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/
    > 4.5.2/../../../libc.a(strcmp.o)' can not be used when making an
    > executable; recompile with -fPIE and relink with -pie
    > collect2: ld returned 1 exit status
    > make: *** [hello] Erreur 1
    > +------------------------------------------------------------------------------------------------------------------------------------------
    > +
    >
    > Help me please!! =)
    Sebastien Dudek, Jul 15, 2011
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    17
    Views:
    1,695
    Chris Riesbeck
    Nov 3, 2003
  2. puzzlecracker
    Replies:
    9
    Views:
    1,508
    puzzlecracker
    Dec 30, 2005
  3. joe martin
    Replies:
    3
    Views:
    368
    Francis Glassborow
    Jul 16, 2003
  4. LinuxN00b

    Statically Linking Libraries

    LinuxN00b, Aug 6, 2003, in forum: C++
    Replies:
    1
    Views:
    350
    Thomas Matthews
    Aug 6, 2003
  5. Replies:
    5
    Views:
    226
    Olivier Renaud
    Mar 15, 2007
Loading...

Share This Page