beautypg.com

Library directory structure, Recommended library directory structure – HP XC System 3.x Software User Manual

Page 44

background image

For released libraries, dynamic and archive, the usual custom is to have a ../lib directory that contains
the libraries. This, by itself, will work if the 32-bit and 64-bit libraries have different names. However, HP
recommends an alternative method. The dynamic linker, during its attempt to load libraries, will suffix
candidate directories with the machine type. The HP XC system on the CP4000 platform uses i686 for
32-bit binaries and x86_64 for 64-bit binaries. HP recommends structuring directories to reflect this
behavior. Therefore, if your released directory structure has a form similar to

Figure 4-1

, then ensure that

the LD_LIBRARY_PATH has /opt/mypackage/lib in it, which will then be able to handle both 32-bit
and 64-bit binaries that have linked against libmystuff.so.

Figure 4-1 Library Directory Structure

If you have an existing pattern using different names, HP recommends introducing links with the above
names. An example of this is shown in

Figure 4-2

.

Figure 4-2 Recommended Library Directory Structure

Linking an application using the library (dynamic or archive) requires you to specify the appropriate
subdirectory, depending on whether the application is 32-bit or 64-bit.

For example, to build a 32-bit application, you might enter:

<32-bit> -L/opt/mypackage/lib/i686 -lmystuff

To build a 64-bit application, you might enter:

<64-bit> -L/opt/mypackage/lib/x86_64 -lmystuff

44

Developing Applications