Tuesday, July 17, 2007

C++ is evil

Somewhere between TSM version 5.2.4 and 5.4.0 the XBSA library changed to a C++ library, which means it needed the C++ run-time libraries to run. The problem is that when using dlopen(3c) to load this library from a standard C application the C++ run-time libraries don't get loaded properly. We ran into this when our AFS backup system stopped working after we upgraded our TSM clients to 5.4.0 (bad IBM!). It turns out that ld.so.1(1) has some cool debugging flags which made finding the problem pretty easy. You can setenv LD_DEBUG to a list of parameters, run your program, and *poof*, you have all the information you need on how the dynamic libraries are loaded.

As it turns out, it was a 2 line fix to the AFS butc source code to pre-load the C++ libraries, and all is happy. The patch can be found here.

No comments: