IBM AIX configuration notes

LIBPATH environment variable

The LIBPATH environment variable defines the search path for shared libraries. Make sure LIBPATH contains all required library directories, including the system library path /lib and /usr/lib.

Shared libraries archives

On AIX®, shared libraries are usually provided in .a archives containing the shared object(s). For example, the DB2® client library libdb2.a contains both the 32-bit (shr.o) and the 64-bit (shr_64.o) versions of the shared library. Not all products follow this rule; for example Oracle 9.2 provides libclntsh.a with shr.o on 64-bit platforms, and Informix® provides both .a archives with static objects and .so shared libraries as on other platforms.

The runtime system database drivers are created with the library archives or with the .so shared objects, according to the database type and version. No particular manipulation is needed to use any supported database client libraries on this platform.

The dump command

On IBM® AIX, you can check the library dependencies with the dump command:

$ dump -Hv -X64 libstckp.so

Unloading shared libraries from memory

In production environments, AIX loads shared libraries into the system shared library segment in order to improve program load time. Once a shared library is loaded, other programs using the same library are attached to that memory segment.

Once a shared library is loaded by the system, you cannot copy the executable file unless you unload the library from the system memory. This problem will occur when installing a new version of the software, even if it is installed in a different directory. Since shared libraries will have the same name, AIX will not allow multiple versions of the same library to load. Therefore, before installing a new version, make sure all shared libraries are unloaded from memory.

The genkld command prints the list of shared libraries currently loaded into memory. The slibclean command unloads a shared library from the system shared library segment.

POSIX Threads and shared libraries

When using a thread-enabled shared library like Oracle's libclntsh, the program using the shared object must be linked with thread support, otherwise you can experience problems (like segmentation fault when the runner program ends). IBM recommends using the xlc_r compiler to link a program with pthread support.

By default, the runtime system provided for AIX platforms is linked with pthread support.

Java™ Interface

When using the Java Interface with the IBM Java VM (J9VM) on AIX, you may need to set the path to native shared libraries in the LIBPATH environment variable, if you get java.lang.UnsatisfiedLinkError exceptions:

$ LIBPATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/j9vm:$JAVA_HOME/jre/lib/ppc64:$LIBPATH
$ export LIBPATH

This is required when using Java code that needs to access native code supplied as part of the JRE. For example, without setting LIBPATH to the appropriate path, the JVM cannot find the shared library libnet.so.

Using the -Djava.library.path=path-to-native-library java VM option does not seem to help.