[openssl.org #1102] Missing -fPIC flag in the default configuration to build static library

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[openssl.org #1102] Missing -fPIC flag in the default configuration to build static library

Rich Salz via RT


OpenSSL version: output of 'openssl version -a'
        bash-2.05# openssl version -a
        OpenSSL 0.9.7g 11 Apr 2005
        built on: Fri Jun  3 12:06:08 IST 2005
        platform: hpux-parisc-gcc
        options:  bn(64,32) md2(int) rc4(ptr,int) des(ptr,risc1,16,long)
idea(int) blowfish(idx)
        compiler: gcc -DOPENSSL_THREADS  -DDSO_DL -DOPENSSL_NO_KRB5
-D_REENTRANT -O3 -DB_ENDIAN -DBN_DIV2W
        OPENSSLDIR: "/usr/local/ssl"

OS Name, Version, Hardware platform
        bash-2.05# uname -a
        HP-UX chromium B.10.20 A 9000/785

Compiler Details (name, version)
        bash-2.05# gcc -v
        Reading specs from
/usr/local/gcc3.4.2/lib/gcc/hppa2.0-hp-hpux10.20/3.4.2/specs
        Configured with: ../gcc-3.4.2/configure --prefix=/usr/local/gcc3.4.2
--enable-languages=c,c++ --with-ld=/usr/ccs/bin/ld --with-gnu-as
--with-as=/usr/local/bin/as --disable-nls
        Thread model: single
        gcc version 3.4.2


Problem Description

There is a difference in the compilation flags in OpenSSL-0.9.6l and
OpenSSL-0.9.7g. The -fPIC flag is missing.
On HP-UX, if you build a shared library that needs to be statically
linked to libcrypto.a, you get linker error as shown below

        g++ -fPIC -c test1.o -I/usr/local/ssl/include
        g++ -fPIC -c test2.o -I/usr/local/ssl/include
        g++ -shared -fPIC -o libtest.sl test1.o test2.o -L/usr/local/ssl/lib
-lcrypto -lssl -lm
Ex: /usr/ccs/bin/ld: Invalid loader fixup for symbol "default_malloc_ex".

However the same code works with OpenSSL-0.9.6l
        bash-2.05# /usr/local/ssl-0.9.6l/bin/openssl  version -a
        OpenSSL 0.9.6l 04 Nov 2003
        built on: Mon Dec  1 19:36:51 GMT 2003
        platform: hpux-parisc-gcc
        options:  bn(64,32) md2(int) rc4(ptr,int) des(ptr,risc1,16,long)
idea(int) blowfish(idx)
        compiler: gcc -fPIC -DTHREADS  -DDSO_DL -D_REENTRANT -O3 -DB_ENDIAN
-DBN_DIV2W

Both the versions (ie OpenSSL-0.9.6l and OpenSSL-0.9.7g) are build with
default configuration.

The same has been observed in case of SunOS 5.7 (I did not try on other
versions or flavors)


Regds,
Manish Pai
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]