在 Ubuntu 11.04 上构建静态版本的 Python
在查看类似问题后,看来我应该能够构建因此,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 的目标?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论