I tried asking this question at StackOverflow, but the dead silence that followed made me wonder if some more Ubuntu-specific expertise might be required.
I am trying to build a static version of Python thusly:
./configure --disable-shared LDFLAGS="-static -static-libgcc" CPPFLAGS="-static"
However, running make configured as above eventually barfs up some warnings and an error:
gcc -pthread -static -static-libgcc -Xlinker -export-dynamic -o python \
Modules/python.o \
libpython2.7.a -lpthread -ldl -lutil -lm
<SNIP>
libpython2.7.a(posixmodule.o): In function `posix_initgroups':
Python-2.7.2/./Modules/posixmodule.c:3981: warning: Using 'initgroups' 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
I'm stuck. It appears to be asking me to recompile libc. I thought -static-libgcc would be enough, but apparently it is not. I don't know if there is something wrong with the libc being linked or if there is something wrong with my compilation flags. This makes it hard to proceed. Does anyone know what is going on here, and how to achieve my goal of building a static python on Ubuntu 11.04?
real static build? Seeing as others have built static versions of Python, I am prone to believe it can be done. – Adoring Gumdrop Sep 30 '11 at 14:45Using 'foo' in statically linked applications...warnings, I still get the linker error. And I want to build static to get a similar environment to when I later port the project to iOS, and additionally I want to understand the problem better. – Adoring Gumdrop Sep 30 '11 at 19:47