Darryl Gove's blog
Redistributable libraries
Steve Clamage and I just put together a short article on using the redistributable libraries that are shipped as part of the compiler. The particular one we focus on is stlport4 since this library is commonly substituted for the default libCstd.
There are two points to take away from the article. First of all, that the required libraries should be copied into a new directory structure for distribution with your application - this makes it easy to patch them, and ensures that the correct version is picked up. The second point is to use the $ORIGIN token when linking the application to specify the path, relative to the location of the executable, where the library will be found at runtime.
Runtime linking is one of my bugbears. I really get fed up with software that requires libraries to be located in particular places in order for it to run, or worse software that requires LD_LIBRARY_PATH to be set for the application to locate the libraries (see Rod Evan's blog entry).
Posted at 10:25AM May 15, 2008 by Darryl Gove in Sun | Comments[1]



Protecting $ORIGIN is great fun. For the shell, I like setting ORIGIN='$ORIGIN', this way even if you don't protect it enough, it still works. There is nothing as easy for makefiles. And the real fun begins when your makefiles are generated (say by qmake) and you need one more level of protection :-) Maybe the choice to use '$' before ORIGIN (and the other special RPATH components) was not the best...
Posted by Marc on May 16, 2008 at 02:30 AM PDT #