[openssl-dev] Creating libssl.so and libcrypto.so for AIX

aixtools aixtools at gmail.com
Wed Feb 4 09:50:52 UTC 2015


Hi,

To be compatible with the way IBM distributes openssl in 
/usr/lib/libssl.a and /usr/lib/libcrypto.a I would like to make the .so 
"archives" as well.

Actually, these are archives in the 'ar' command sense, but become 
members of the archive.

I have been trying to understand how Makefile.shared works, and under 
the target
syslink.aix I have not been able to establish what

SYMLINK_SOD=    \
         if [ -n "$$INHIBIT_SYMLINKS" ]; then (print true) ; else \
                 print $$SHLIB - $$SHLIB_SOVER - $$SHLIB_SUFFIX; \
                 print   " - " "$$SHLIB_COMPAT"; \
         (print false); fi;

SYMLINK_SO=     \
         if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
                 prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
                 if [ -n "$$SHLIB_COMPAT" ]; then \
                         for x in $$SHLIB_COMPAT; do \
                                 ( $(SET_X); rm -f 
$$SHLIB$$x$$SHLIB_SUFFIX; \
                                   ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX 
); \
                                 prev=$$SHLIB$$x$$SHLIB_SUFFIX; \
                         done; \
                 fi; \
                 if [ -n "$$SHLIB_SOVER" ]; then \
                         ( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \
                           ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \
                 fi; \
         fi

# Targets to build symbolic links when needed
symlink.gnu symlink.solaris symlink.svr3 symlink.svr5 symlink.irix \
symlink.aix symlink.reliantunix:
         $(CALC_VERSIONS); \
         SHLIB=lib$(LIBNAME).so; \
         $(SYMLINK_SOD)
         $(SYMLINK_SO)

# (the SYMLINK_SOD is my way to print the variables used by SYSLINK_SO)

Make with debug info

michael at x071:[/data/prj/openssl/openssl-1.0.2]make --debug=bj link-shared
GNU Make 3.82
Built for powerpc-ibm-aix5.3.0.0
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
  File `link-shared' does not exist.
Must remake target `link-shared'.
Invoking recipe from Makefile:338 to update target `link-shared'.
GNU Make 3.82
Built for powerpc-ibm-aix5.3.0.0
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
  File `symlink.aix-shared' does not exist.
    File `symlink.aix' does not exist.
   Must remake target `symlink.aix'.
Invoking recipe from Makefile.shared:588 to update target `symlink.aix'.
make[1]: Entering directory `/data/prj/openssl/openssl-1.0.2'
SHLIB_COMPAT=; SHLIB_SOVER=; if [ -n "1.0.0;" ]; then prev=""; for v in 
`echo "1.0.0 ;" | cut -d';' -f1`; do SHLIB_SOVER_NODOT=$v; 
SHLIB_SOVER=.$v; if [ -n "$prev" ]; then SHLIB_COMPAT="$SHLIB_COMPAT 
.$prev"; fi; prev=$v; done; fi; \
SHLIB=libcrypto.so; \
if [ -n "$INHIBIT_SYMLINKS" ]; then (print true) ; else print $SHLIB - 
$SHLIB_SOVER - $SHLIB_SUFFIX; print   " - " "$SHLIB_COMPAT"; (print 
false); fi;
libcrypto.so - .1.0.0 -
  -
false

Any help with understanding how to create a libcrypto.so and libssl.so 
(similiar to what libz does! is appreciated)

Info: libz does this

xlc -G -O -qmaxmem=8192 -D_LARGEFILE64_SOURCE=1 -o libz.so.1.2.8 
adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo 
inftrees.lo trees.lo zutil.lo compress.lo uncompr.lo gzclose.lo gzlib.lo 
gzread.lo gzwrite.lo  -lc

I am puzzled that it is not made because openssl Makefile knows about 
the -G argument, but does not apply it to create a 'member' with the 
combined .o files.

I am hoping that someone is willing to think about an elegant solution - 
compared to any (unstable) hack I might come up with.

I have tried, with no success, to just make libssl.so, libssl.so.1.0.2

However, when I tried to make libssl.so.1.0.0 I did get a lot of 
'activity' (called AIX cc/xlc with no arguments and I get the man page 
... this prefixes it

michael at x071:[/data/prj/openssl/openssl-1.0.2]make libssl.so.1.0.0
[ -z "" ] || cc -DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN 
-DHAVE_DLFCN_H -q64 -O2 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst 
-DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM 
-DVPAES_ASM -Iinclude \
         -DFINGERPRINT_PREMAIN_DSO_LOAD -o fips_premain_dso  \
         fips_premain.c fipscanister.o \
         libcrypto.a
make[1]: Entering directory `/data/prj/openssl/openssl-1.0.2'
make[2]: Entering directory `/data/prj/openssl/openssl-1.0.2'
SHLIB_COMPAT=; SHLIB_SOVER=; if [ -n "1.0.0;" ]; then prev=""; for v in 
`echo "1.0.0 ;" | cut -d';' -f1`; do SHLIB_SOVER_NODOT=$v; 
SHLIB_SOVER=.$v; if [ -n "$prev" ]; then SHLIB_COMPAT="$SHLIB_COMPAT 
.$prev"; fi; prev=$v; done; fi; \
OBJECT_MODE=`expr "x-q64 -G" : 'x\-[a-z]*\(64\)'` || : ; \
OBJECT_MODE=${OBJECT_MODE:-32}; export OBJECT_MODE; \
SHLIB=libcrypto.so; \
SHLIB_SUFFIX=; \
ALLSYMSFLAGS='-bnogc'; \
NOALLSYMSFLAGS=''; \
SHAREDFLAGS='-DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN 
-DHAVE_DLFCN_H -q64 -O2 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst 
-DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM 
-DVPAES_ASM -q64 -G -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
echo SHOBJECTS=libcrypto.o; ALL=$ALLSYMSFLAGS; ALLSYMSFLAGS=; 
NOALLSYMSFLAGS=; ( :; ld  -r -o libcrypto.o $ALL libcrypto.a  ); ( :; 
LIBDEPS="${LIBDEPS:--L.  }"; SHAREDCMD="${SHAREDCMD:-cc}"; 
SHAREDFLAGS="${SHAREDFLAGS:--DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE 
-DDSO_DLFCN -DHAVE_DLFCN_H -q64 -O2 -DB_ENDIAN -qmaxmem=16384 -qro 
-qroconst -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM 
-DAES_ASM -DVPAES_ASM -q64 -G}"; LIBPATH=`for x in $LIBDEPS; do echo $x; 
done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed 
-e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${SHAREDCMD} 
${SHAREDFLAGS} -o $SHLIB$SHLIB_SOVER$SHLIB_SUFFIX $ALLSYMSFLAGS 
$SHOBJECTS $NOALLSYMSFLAGS $LIBDEPS ) && if [ -n "$INHIBIT_SYMLINKS" ]; 
then :; else prev=$SHLIB$SHLIB_SOVER$SHLIB_SUFFIX; if [ -n 
"$SHLIB_COMPAT" ]; then for x in $SHLIB_COMPAT; do ( :; rm -f 
$SHLIB$x$SHLIB_SUFFIX; ln -s $prev $SHLIB$x$SHLIB_SUFFIX ); 
prev=$SHLIB$x$SHLIB_SUFFIX; done; fi; if [ -n "$SHLIB_SOVER" ]; then ( 
:; rm -f $SHLIB$SHLIB_SUFFIX; ln -s $prev $SHLIB$SHLIB_SUFFIX ); fi; fi 
&& rm -f libcrypto.o
SHOBJECTS=libcrypto.o



   xlc(1)                     IBM (2010)                      xlc(1)
...

Signed (Sincerely Lost :p),
Michael



More information about the openssl-dev mailing list