开发者

LIBSSL Static lib Compiling issue with fpic

开发者 https://www.devze.com 2023-04-02 19:02 出处:网络
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 &&a

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 ?


this worked for me, openssl-1.0.1c

./config -fPIC
make
make install


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/openssl-users@openssl.org/1901249.html


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

0

精彩评论

暂无评论...
验证码 换一张
取 消