As I've said before, AIX shared libraries are a bit unusual.

As another example of that, consider that while most *ix's put shared libraries in a file with a ".so" extension, and then that file contains a bunch of PIC-compiled .o's. Static libraries are placed in a file with a ".a" extension, and again contain .o files that needn't be compiled PIC.

However, on AIX, both shared libraries and static libraries go into a single ".a" file. The shared version goes into the .a as a single file with a ".so" extension, while the static version goes into the .a as a series of PIC-compiled .o's. That's right, the static .o's are PIC, because all objects on AIX are PIC.

In addition, on AIX, both the 32 bit and the 64 bit version of a library, whether static or shared (see above) go into the same .a file. If you want the 32 bit version, you need $OBJECT_MODE==32 or to specify -X 32, and if you want the 64 bit version, you need $OBJECT_MODE==64 or to specify -X 64.

This leads to a problem with most contemporary Makefile's. Namely, when you "make install", the "install" rule is probably going to want to wipe out any .a's and start over. So it's easy to get .a's with 64 bit objects, or to get .a's with 32 bit objects, but getting both requires some extra futzing around.

That's the purpose of my merge-libs script. To use it, you first build your 32 bit version, and "make install" it as you would normally. Then you build the 64 bit version, but instead of using "make install" again (which would wipe out your 32 bit version), you instead find all the .a's in your build tree, and run something like:




Hits: 5594
Timestamp: 2024-12-27 08:52:00 PST

Back to Dan's tech tidbits

You can e-mail the author with questions or comments: