开发者

Building a static version of Python on Ubuntu 11.04

After looking at a similar question, it appears that I am supposed to be able 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. Does anyone know what is going on here, and how to achieve my goal of building a static python on Ubuntu 11.04?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜