On Sun, May 20, 2007 at 02:42:59PM +0200, Andy Polyakov via RT wrote:
> > Title: Failed to link static openssl libraries (or non-PIC x86_64cpuid.s)
> > OS: FC4
> > HARDWARE: AMD x86 64bit
> > OPENSSL VERSION: 0.9.8e
> > OPTIONS:
> > CFLAGS="-fPIC -O2" ./config no-dso no-shared no-threads 
> > no-zlib -fPIC -O2 --prefix=/home/dmitri/php/install
> > 
> > Details:
> > It worked just fine with all 0.9.7*. Since 0.9.8 an attempt to link against 
> > static openssl like below
> > gcc -shared  dbg.lo dbg_bp.lo dbg_cmd.lo dbg_net.lo dbg_ser.lo dbg_prof.lo 
> > dbg_sec.lo 
> > bg_logo.lo  -L/home/dmitri/php/install/lib -lssl -lcrypto  -Wl,-rpath 
> > -Wl,/home/dmitri/php/install/lib 
> >  -Wl,-soname -Wl,dbg.so -o .libs/dbg.so
> > 
> > returns with error:
> > 
> > /usr/bin/ld: /home/dmitri/php/install/lib/libcrypto.a(x86_64cpuid.o): 
> > relocation R_X86_64_PC32 against `OPENSSL_cpuid_setup' can not be used when 
> > making a shared object; recompile with -fPIC
> 
> Use -Bsymbolic to link your shared object, add -Wl,-Bsymbolic to your 
> gcc command line. In the nutshell this means that OpenSSL calls your 
> library makes can't be overridden by another copy of OpenSSL mapped into 
> application address space. Ideally you should also abstain from 
> exporting any OpenSSL symbols from your shared object.

The problem is that he's trying to make a shared library linked to a
static library, and the static library isn't built with -fPIC.  This
might work on some arches (i386) but really doesn't work on x84_64.
x84_64 does not allow text relocations in shared libraries.

Either he needs to rebuild his static version of openssl with -fPIC, or
make openssl a shared library.  Normally you make a static version
without -fPIC and a shared version with -fPIC.


Kurt

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to