LIBSSL 静态库与 fpic 的编译问题
我使用编译 libssl
CC="gcc34 -fPIC" CXX="g++34 -fPIC" CFLAGS="-m64 -fPIC" ./config --prefix=/workspace/libs/gcc34/64/ssl shared && make clean && make && make install
但是当我尝试将此静态生成的库与我的动态库链接时 我发现
relocation R_X86_64_PC32 against `OPENSSL_cpuid_setup' can not be used when making a shared object; recompile with -fPIC
我给了 fpic 选项有什么问题吗?
I compiled libssl using
CC="gcc34 -fPIC" CXX="g++34 -fPIC" CFLAGS="-m64 -fPIC" ./config --prefix=/workspace/libs/gcc34/64/ssl shared && make clean && make && make install
but when I try to link this static generated library with my dynamic library
I am getting
relocation R_X86_64_PC32 against `OPENSSL_cpuid_setup' can not be used when making a shared object; recompile with -fPIC
I had given fpic option what is wrong there ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这对我有用,openssl-1.0.1c
this worked for me, openssl-1.0.1c
建议使用
-Wl,-Bsymbolic
来修复此错误。https://openssl-dev.openssl.narkive。 com/uAKes0jM/openssl-org-1521-bug-report
http://www.opensubscriber.com/message/[电子邮件受保护]/1901249.html
There're recommendations to use
-Wl,-Bsymbolic
to fix this error.https://openssl-dev.openssl.narkive.com/uAKes0jM/openssl-org-1521-bug-report
http://www.opensubscriber.com/message/[email protected]/1901249.html
最后,我想,我找到了解决方案:
当 LDFLAGS 设置为强化而 CFLAGS 未设置时,会出现“在创建共享对象时,不能使用 R_X86_64_PC32 反对未定义符号;使用 -fPIC 重新编译”。
在你的情况下,我猜你不应该设置 CFLAGS 。
参考:https://bugzilla.redhat.com/show_bug.cgi?id=1304277
Finally, I think, I found the solution:
This "R_X86_64_PC32 against undefined symbol can not be used when making a shared object; recompile with -fPIC" happens when LDFLAGS are set with hardening and CFLAGS not.
In your case you shouldn't set CFLAGS I guess .
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1304277