使用“共享"选项编译OpenSSL吗? [英] Compile OpenSSL with the 'shared' option?
问题描述
在CentOS 5.4上,OpenSSL可以正常编译,而无需使用共享"选项.但是当我通过该选项时,编译失败并显示为:
On CentOS 5.4, OpenSSL compiles fine without 'shared' option. But when I passed that option the compilation fails with:
/usr/bin/ld:libcrypto.a(x86_64-gcc.o):在创建共享库时不能使用针对本地符号"的重定位R_X86_64_32;用-fPIC重新编译
/usr/bin/ld: libcrypto.a(x86_64-gcc.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
当我尝试:./config shared CFLAGS=-fPIC
时不起作用.
When I try: ./config shared CFLAGS=-fPIC
that doesn't work.
如何使OpenSSL使用共享"选项进行编译?
What can I do to get OpenSSL to compile with the 'shared' option?
谢谢
推荐答案
这里存在同样的问题,但通常Makefile将考虑环境变量作为编译器或链接器选项.
Same problem here, BUT usually Makefiles will consider environment variables for compiler or linker options.
因此,如果在调用configure脚本之前将-fPIC
选项 放置,则应注意这一点.您可以执行以下操作:
So, if you place the -fPIC
option before calling the configure script, it should take care of it. You can do it with:
CFLAGS=-fPIC ./config shared --prefix=/your/path
或
export CFLAGS=-fPIC
./config shared --prefix=/your/path
对我有用.
这篇关于使用“共享"选项编译OpenSSL吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!