Shared library support just isn't ready yet in OpenSSL.  Configure and
the Makefiles need work to do it right.

Here's a completely unsupported recipe for HPUX 10.20.  It assumes you
know the difference between static, static pic, and dynamic libraries.
If it doesn't work you're on your own.  I'm mostly posting it to show
what's involved and to illustrate how (I think) shared library builds
should go when/if they're implemented.  High points:

    - All three flavors of the libraries (static, static pic, and dynamic)
      are useful, and if you build the dynamic libs you end up building the
      static pic ones on the way, so they should be saved.

    - The compiler's pic flag should be used for building the libraries but
      not for apps.  Currently there is no distinction between app and
      library flags.

    - At least on HPUX the libraries should be installed before the
      executables are built, so that the executables can be linked with the
      libraries already installed in their final location.  Otherwise quirks
      in HPUX's dynamic library search mechanism mess things up.  Yes, that
      makes it hard to test the result before overwriting the previous
      released build.

=====

Make sure directory /usr/local/ssl/lib/ exists and is writable before you
start.  And since you're in the US, if you're using rsaref you need to build
a static pic version of it (cc +z) and uncomment the associated line in the
attached makefile and fix the path there.

    # Configure for pic and build the static pic libraries
    ./Configure hpux-cc +z
    make clean
    make DIRS="crypto ssl rsaref"
    # Rename the static pic libs and build dynamic libraries from them
    make -f shlib/Makefile.hpux-cc
    # Copy the libraries to /usr/local/ssl/lib (they have to be in their
    # final location when linking applications).
    chmod 444 lib*_pic.a
    chmod 555 lib*.so.1
    cp -p lib* /usr/local/ssl/lib
    # Reconfigure without pic
    Configure hpux-cc
    make clean
    # Hack the Makefiles to pick up the dynamic libraries during linking
    sed 's/PEX_LIBS=.*$/PEX_LIBS=-L/usr/local/ssl/lib/ 
-Wl,+b,/usr/local/ssl/lib:/usr/lib' Makefile >xxx; mv xxx Makefile
    sed 's/-L\.\.//' apps/Makefile >xxx; mv xxx apps/Makefile
    sed 's/-L\.\.//' test/Makefile >xxx; mv xxx test/Makefile
    # Build the static libs and the executables in one make.
    make
    # Install everything
    make install

Assuming everything goes as planned, that gives you static, static pic,
and dynamic libraries in /usr/local/ssl/lib/ and executables in
/usr/local/ssl/bin/ and in ./test/ that use them.

My shlib/Makefile.hpux-cc is included below.


shlib/Makefile.hpux-cc
=====
# Makefile.hpux-cc

major=1

slib=libssl
sh_slib=$(slib).so.$(major)

clib=libcrypto
sh_clib=$(clib).so.$(major)

rlib=libRSAglue

#RSAREFLIB=./$(rlib)_pic.a /usr/local/ssl/lib/librsaref_pic.a


all : $(clib).sl $(slib).sl


$(rlib)_pic.a : $(rlib).a
        echo "Copying $? to $@"
        cp -p $? $@

$(clib)_pic.a : $(clib).a
        echo "Copying $? to $@"
        cp -p $? $@

$(slib)_pic.a : $(slib).a
        echo "Copying $? to $@"
        cp -p $? $@

$(sh_clib) : $(clib)_pic.a $(RSAREFLIB)
        echo "collecting all object files for $@"
        find . -name \*.o -print > allobjs
        for obj in `ar t $(clib)_pic.a`; \
        do \
                grep /$$obj allobjs; \
        done >objlist
        echo "linking $@"
        ld -b -s -z +h $@ -o $@ `cat objlist` $(RSAREFLIB) -lc 
        rm allobjs objlist

$(clib).sl : $(sh_clib)
        rm -f $@
        ln -s $? $@

$(sh_slib) : $(slib)_pic.a $(clib).sl
        echo "collecting all object files for $@"
        find . -name \*.o -print > allobjs
        for obj in `ar t $(slib)_pic.a`; \
        do \
                grep /$$obj allobjs; \
        done >objlist
        echo "linking $@"
        ld -b -s -z +h $@ +b /usr/local/ssl/lib:/usr/lib -o $@ `cat objlist` \
                        -L. -lcrypto -lc
        rm -f allobjs objlist
        
$(slib).sl : $(sh_slib)
        rm -f $@
        ln -s $? $@
=====
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to