我在StackOverflow上尝试了提出这个问题,但随后的死寂让我怀疑是否需要一些更专门的Ubuntu技术知识。
我正在尝试构建一个静态版本的Python,方法如下:
然而,按照上述配置运行
我卡住了。它似乎要求我重新编译libc。我以为
我正在尝试构建一个静态版本的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
就足够了,但显然不是这样。我不知道链接的libc是否有问题,还是我的编译标志有问题。这使得继续进行变得困难。有人知道这里发生了什么,以及如何在Ubuntu 11.04上构建静态Python吗?