Search code examples
opensslldaixundefined-symbol

Multiple "Symbol X (number Y) is not exported from dependent module" on AIX 7.1


I'm working on AIX 7.1 and having problems linking due to multiple "Symbol X (number Y) is not exported from dependent module".

Error

Could not load program openssl:
Symbol resolution failed for /apps/10.00/openssl/product/openssl-1.0.2f/lib/libssl.so because:
        Symbol EC_curve_nist2nid (number 73) is not exported from dependent
          module /apps/tuxedo/product/12.1/lib/libcrypto.so.
        Symbol EVP_aes_256_cbc_hmac_sha256 (number 274) is not exported from dependent
          module /apps/tuxedo/product/12.1/lib/libcrypto.so.
        Symbol EVP_aes_128_cbc_hmac_sha256 (number 275) is not exported from dependent
          module /apps/tuxedo/product/12.1/lib/libcrypto.so.
        Symbol X509_get_signature_nid (number 282) is not exported from dependent
          module /apps/tuxedo/product/12.1/lib/libcrypto.so.
        Symbol X509_chain_up_ref (number 312) is not exported from dependent
          module /apps/tuxedo/product/12.1/lib/libcrypto.so.
        Symbol X509_chain_check_suiteb (number 313) is not exported from dependent
          module /apps/tuxedo/product/12.1/lib/libcrypto.so.

The below are the dependencies:

$ ldd `which openssl`
/cb/cb10b/rel/server/bin/openssl needs:
         /apps/10.00/openssl/product/openssl-1.0.2f/lib/libssl.so
         /apps/tuxedo/product/12.1/lib/libcrypto.so
         /usr/lib/libpthreads.a(shr_xpg5_64.o)
         /usr/lib/libc.a(shr_64.o)
         /unix

It can be seen that libcrypto.so comes from tuxedo and not openssl. So I exported LIBPATH to have openssl more before tuxedo libraries. This changes the ldd output as below:-

export LIBPATH=/apps/10.00/openssl/product/openssl-1.0.2f/lib:$LIBPATH
$ ldd `which openssl`
/cb/cb10b/rel/server/bin/openssl needs:
         /apps/10.00/openssl/product/openssl-1.0.2f/lib/libssl.so
         /apps/10.00/openssl/product/openssl-1.0.2f/lib/libcrypto.so
         /usr/lib/libpthreads.a(shr_xpg5_64.o)
         /usr/lib/libc.a(shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)

Although the ldd output shows the dependent libraries being picked from openssl directories. However, when I run the script I still get the same error as above. When I rename libcrypto.so to something else, (say libcrypto.s.bkp), then while running the libcrypto.so from openssl is being picked, so clearly there is something which causes the libcrypto.so to be searched in Tuxedo directory first and later in openssl directory.

I do not know what is causing the tuxedo libraries to have higher priority than the openssl libraries.


Solution

  • I am linking statically(no-shared) and that has solved it:-

        OPENSSL_VERSION=openssl-1.0.2f
    On AIX:
    ./Configure aix64-cc --prefix=$INSTALLDIR/openssl/product/$OPENSSL_VERSION --openssldir=$INSTALLDIR/openssl/product/$OPENSSL_VERSION/openssl threads  no-shared
    

    EDIT: Also, since I had get it installed on SunOs, here is the instruction

    ./Configure solaris64-sparcv9-cc --prefix=$INSTALLDIR/openssl/product/$OPENSSL_VERSION --openssldir=$INSTALLDIR/openssl/product/$OPENSSL_VERSION/openssl threads no-shared -KPIC