在Ubuntu 11.04上构建Python的静态版本

时间:2011-09-29 14:13:17

标签: python gcc build static-libraries static-linking

在查看similar question之后,我认为我应该能够构建一个静态版本的Python:

./configure --disable-shared LDFLAGS="-static -static-libgcc" CPPFLAGS="-static"

但是,运行上面配置的make最终会阻止一些警告和错误:

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

我被困住了。它似乎要求我重新编译libc。我认为-static-libgcc就够了,但显然不是。有谁知道这里发生了什么,以及如何实现我在Ubuntu 11.04上构建静态python的目标?

0 个答案:

没有答案