AIX Open Source

 View Only

AIX Open Source Support Tips - Analyzing module loading errors

By Jan Harris posted Tue April 26, 2022 07:56 PM

  
One of the most common problems reported by AIX Toolbox for Open Source Applications users is failure to load dependent modules.

For example, 
# curl --help

(Note:  the errors are enumerated for analysis)
 
1)   exec():
     0509-036   Cannot load program curl because of the following  errors:
 
2)   0509-022   Cannot load module /opt/freeware/lib64/libcurl.a(libcurl.so.4).
 
3)   0509-150       Dependent module /opt/freeware/lib/libssl.a(libssl.so.1.0.2) could not be loaded.
 
4)   0509-152       Member libssl.so.1.0.2 is not found in archive
 
5)   0509-022   Cannot load module curl_64.
 
6)   0509-150   Dependent module /opt/freeware/lib64/libcurl.a(libcurl.so.4) could not be loaded.
 
7)   0509-022   Cannot load module .

Now, examine the first few errors.

1)   exec():
     0509-036 Cannot load program curl because of the following errors:

The curl program was found, but could not load.

2)   0509-022      Cannot load module         /opt/freeware/lib64/libcurl.a(libcurl.so.4).

3)   0509-150      Dependent module /opt/freeware/lib/libssl.a(libssl.so.1.0.2) could not be loaded.
 
4)   0509-152      Member libssl.so.1.0.2 is not found in archive

The curl program tried to load libcurl.a but failed because an expected member libssl.so.1.0.2 was not found in the dependent libssl.a archive. 


Examine the program to determine the library search path and dependencies.
# dump -X32_64 -Hv /opt/freeware/bin/curl

INDEX  PATH                          BASE                MEMBER
0      /opt/freeware/lib64:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
1                                    libc.a              shr_64.o
2                                    libpthreads.a       shr_xpg5_64.o
3                                    libcurl.a           libcurl.so.4
4                                    libz.a              libz.so.1
5                                    libssh2.a           libssh2.so.1
6      /opt/freeware/lib             libgssapi_krb5.a    libgssapi_krb5.so
7      /opt/freeware/lib             libkrb5.a           libkrb5.so
8      /opt/freeware/lib             libk5crypto.a       libk5crypto.so
9      /opt/freeware/lib             libcom_err.a        libcom_err.so
10     /opt/freeware/lib             liblber.a           liblber-2.4.so.2
11     /opt/freeware/lib             libldap.a           libldap-2.4.so.2

Now, examine the libcurl.a.

# dump -X32_64 -Hv /opt/freeware/lib64/libcurl.a
INDEX  PATH                          BASE                MEMBER
0      /opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
1                                    libgcc_s.a          shr.o
2                                    libssh2.a           libssh2.so.1
3      /opt/freeware/lib             libgssapi_krb5.a    libgssapi_krb5.so
4      /opt/freeware/lib             libkrb5.a           libkrb5.so
5      /opt/freeware/lib             libk5crypto.a       libk5crypto.so
6      /opt/freeware/lib             libcom_err.a        libcom_err.so
7      /opt/freeware/lib             liblber.a           liblber-2.4.so.2
8      /opt/freeware/lib             libldap.a           libldap-2.4.so.2
9                                    libc.a              shr_64.o
10                                   libssl.a            libssl.so.1.0.2
11                                   libcrypto.a         libcrypto.so.1.0.2
12                                   libz.a              libz.so.1
13                                   libpthreads.a       shr_xpg5_64.o
The  /opt/freeware/lib64/libcurl.a module fails to load because libssl.so.1.0.2 is not found in /opt/freeware/lib/libssl.a.

The module loads the first libssl.a in its search path. The error indicates it loads /opt/freeware/lib/libssl.a, which does not provide the libssl.so.1.0.2 dependency.

Now determine the source of the curl program.

#  rpm -qi --whatprovides `which curl` |  egrep "Name|Package|Build Host"
Name        : curl
Build Host  : pokndd5.pok.stglabs.ibm.com
Packager    : IBM AIX Toolbox <https://ibm.biz/AIXToolbox>

This curl package is from the AIX Toolbox for Open Source Software. AIX Toolbox packages use the openssl.base file set. There is no openssl rpm package available on the Toolbox download.

Check the system for any libssl.a installed by installp.

# lslpp -w `lslpp -f | grep libssl.a`
  File                                        Fileset               Type
  ----------------------------------------------------------------------------
  /usr/lib/libssl.a                           openssl.base          File


Examine the AIX libssl.a to ensure it provides the libssl.so.1.0.2 dependency.
# ar -tv /usr/lib/libssl.a
rwxr-xr-x     0/0     728648 Jan 18 10:20 2021 libssl.so
rwxr-xr-x     0/0     510766 Jan 18 10:20 2021 libssl.so.0.9.8
rwxr-xr-x     0/0     728648 Jan 18 10:20 2021 libssl.so.1.0.0
rwxr-xr-x     0/0     728648 Jan 18 10:12 2021 libssl.so.1.0.2
The AIX openssl.base libssl.a provides the libssl.so.1.0.2 member.

Now, examine the loaded library:

# ar -tv  /opt/freeware/lib/libssl.a
rwxr-xr-x   203/1     603254 May 03 16:39 2016 libssl.so.1.0.1
rw-r--r--   203/1     362538 May 03 16:40 2016 libssl.so.0.9.7
rw-r--r--   203/1     528217 May 03 16:40 2016 libssl.so.0.9.8
rwxr-xr-x   203/1     580902 May 03 16:40 2016 libssl.so.1.0.0

The loaded libssl.a does not provide the libssl.so.1.0.2 member. 

Determine the source of the loaded libssl.a.

# rpm -qi --whatprovides /opt/freeware/lib/libssl.a |  egrep "Name|Package|Build Host"
Name        : openssl
Build Host  : aix51.perzl.org

Root Cause: 
non-AIX Toolbox libssl.a is loaded instead of the AIX openssl.base libssl.a.

The built-in library search path for the AIX Toolbox curl (per dump -Hv) is:
 /opt/freeware/lib64:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib

If non-AIX toolbox libraries exist in this path, errors might occur.

Solution: 
Remove any openssl package, and use the AIX provided openssl.base to support AIX Toolbox for Open Source Software.

You might bypass this error, for curl, by adding /usr/lib to the front of the path. However, it is not recommended to set this path because AIX file set files could conflict with Open Source packages.
 
For example, xmllint would fail due to its dependency on the libxml2.so.2 provided by the libxml2-2.9.11-1.ppc package.

# LIBPATH=/usr/lib:$LIBPATH
# ./xmllint
exec(): 0509-036 Cannot load program xmllint_64 because of the following errors:
        0509-130 Symbol resolution failed for xmllint_64 because:
        0509-136   Symbol _GLOBAL__AIXI_libxml2_so (number 49) is not exported from
                   dependent module /usr/lib/libxml2.a[libxml2.so.2].
        0509-136   Symbol _GLOBAL__AIXD_libxml2_so (number 50) is not exported from
                   dependent module /usr/lib/libxml2.a[libxml2.so.2].
        0509-136   Symbol xmlSchemaValidateSetFilename (number 169) is not exported from
                   dependent module /usr/lib/libxml2.a[libxml2.so.2].
        0509-192 Examine .loader section symbols with the
                 'dump -Tv' command.


My original note is published as an AIX Technote on the IBM Support site.
1 comment
114 views

Permalink

Comments

Wed February 15, 2023 08:11 AM

Excellent article. Thanks!