使用“共享"选项编译 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): relocation R_X86_64_32 针对`a local symbol' 不能在创建共享对象时使用;用 -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.
因此,如果您在调用配置脚本之前将 -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屋!