Freeze statically

Sebastien Dudek fluxius at gmail.com
Fri Jul 15 04:06:48 EDT 2011


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 <flux... at gmail.com> 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!! =)




More information about the Python-list mailing list