Loading IBM MQ libraries
When deciding how to load IBM MQ libraries, you need to consider a number of factors, including: your environment, whether we can change your existing applications, whether you want a primary installation, where IBM MQ is installed, and whether the location of IBM MQ is likely to change.
This information applies to IBM WebSphere MQ Version 7.1, or later version, libraries.
How IBM MQ libraries are located and loaded depends on your installation environment:- On UNIX and Linux systems, if a copy of IBM WebSphere MQ Version 7.1, or later version, is installed in the default location, existing applications continue to work in the same way as previous versions. However, if the applications need symbolic links in /usr/lib, you must either select a Version 7.1, or later version, installation to be the primary installation, or manually create the symbolic links.
- If IBM WebSphere MQ Version 7.1, or later version, is installed in a non-default location, which is the case if IBM WebSphere MQ Version 7.0.1 is also installed, you might need to change your existing applications so that the correct libraries are loaded.
Optimally, you should ensure the IBM MQ library, that is loaded by the operating system, is the one with which the queue manager is associated.
The methods for loading IBM MQ libraries vary by platform, and each method has benefits and drawbacks.Platform | Option | Benefits | Drawbacks |
---|---|---|---|
UNIX and Linux systems | Set or change the embedded runtime search path (RPath) of the application.
This option requires you to recompile and link the application. For more information about compiling and linking applications, see Building a procedural application. |
|
|
UNIX and Linux systems | Set the LD_LIBRARY_PATH environment variable , using setmqenv, or crtmqenv, with the
-k or -l option. ( On AIX , this environment variable is LIBPATH |
|
|
Windows systems | Set the PATH variable using setmqenv, or crtmqenv. |
|
|
UNIX, Linux, and Windows systems | Set the primary installation to a Version 7.1, or later, installation. See Change the primary installation.
For more information about the primary installation, see Choosing a primary installation. |
|
|
Library loading considerations for HP-UX
The sample compilation commands in the product documentation for previous versions of IBM MQ included the -W1, +noenvvar link option for 64-bit applications. This option disables the use of LD_LIBRARY_PATH to load shared libraries. If you want our applications to load IBM MQ libraries from a location other than the location specified in the RPath, you must update our applications. We can update the applications by recompiling and linking without the -W1, +noenvvar link option, or by using the chatr command.
To find out how our applications currently load libraries, see Operating system library loading mechanisms.
Library loading considerations for Linux
Applications compiled using some versions of gcc, for example, version 3.2.x, can have an embedded RPath that cannot be overridden using the LD_LIBRARY_PATH environment variable. We can determine if an application is affected by using the readelf -d applicationName command. The RPath cannot be overridden if the RPATH symbol is present and the RUNPATH symbol is not present.
Library loading considerations for Solaris
The sample compilation commands in the product documentation for previous versions of IBM MQ included the -lmqmcs -lmqmzse link options. The appropriate versions of these libraries are now loaded automatically by IBM MQ. If IBM MQ is installed in a non-default location, or if there are multiple installations on the system, you must update our applications. We can update the applications by recompiling and linking without the -lmqmcs -lmqmzse link options.
Operating system library loading mechanisms
On Windows systems, several directories are searched to find the libraries:- The directory the application is loaded from.
- The current directory.
- The directories in the PATH environment variable, both the global PATH variable and the PATH variable of the current user.
On UNIX and Linux systems, there are a number of methods that might have been used to locate the libraries to load:
- Use the LD_LIBRARY_PATH environment variable (also LIBPATH on AIX, and SHLIB_PATH on HP-UX ). If this variable is set, it defines a set of directories that are searched for the required IBM MQ libraries. If any libraries are found in these directories, they are used in preference of any libraries that might be found using the other methods.
- Use an embedded search path (RPath). The application might contain a set of directories to search for the IBM MQ libraries. If the LD_LIBRARY_PATH is not set, or if the required libraries were not found using the variable, the RPath is searched for the libraries. If your existing applications use an RPath, but we cannot recompile and link the application, you must either install IBM WebSphere MQ Version 7.1 in the default location, or use another method to find the libraries.
- Use the default library path. If the IBM MQ libraries are not found after searching the LD_LIBRARY_PATH variable and RPath locations, the default library path is searched. Usually, this path contains /usr/lib or /usr/lib64. If the libraries are not found after searching the default library path, the application fails to start because of missing dependencies.
- AIX: dump
- HP-UX: chatr
- Linux: readelf
- Solaris: elfdump