Today, I wanted to do some profiling of a Java application in Eclipse (3.4 aka Ganymede) on my Ubuntu 8.10 box at work. Google pointed me to the Eclipse TPTP (Test & Performance Tools) platform, which I installed through the Eclipse plug-in installer thingy, that weird acting constantly blocking/reloading user interface located under the "help" menu (of all places!), but lets not get us carried away by that for the moment.

After installation (and the obligatory eclipse restart), I tried to use the new tool, but soon my enthusiasm was curbed as I got a nice red error message

IWAT0435E An error occurred when connecting to the host

on the monitor tab of the profile configuration dialog. No profiling for me, sir. Bummer.

Getting ready for what started to smell like another jumping through hoops session, I googled the warning and got to this eclipse bug report. Apparently, some component of TPTP requires a prehistoric version of libstdc++. Unfortunately, that version was not available anymore in the standard Ubuntu repositories since Ubuntu 8.04 or something.

A workaround for this is described in this blog post. It's pretty straight forward: get a deb file libstdc++2.10-glibc2.2_2.95.4-27_i386.deb and install it with sudo dpkg ....

The problem is now that the workaround involves root actions. First, one hasn't always the required root permissions to do so. More importantly however, I don't like installing external debs and other stuff as root because it can interfere with the packaging system, pollute system directories and break things in ugly, or worse, unrecoverable ways.

I always install third party stuff (with which I mean things that are not available through the standard packaging system) in my home directory under ~/usr. For example, I build autotools-managed software with the option --prefix=~/usr, so things end up in ~/usr/bin, ~/usr/lib, ~/usr/share, etcetera.

I managed to install the deb file described above also in ~/usr as follows. First, I extracted the deb file to a temporary directory to get an idea of its contents:

dpkg -x libstdc++2.10-glibc2.2_2.95.4-27_i386.deb tmp/

This resulted in the following file tree:

tmp/
`-- usr
    |-- lib
    |   |-- libstdc++-3-libc6.2-2-2.10.0.so
    |   `-- libstdc++-libc6.2-2.so.3 -> libstdc++-3-libc6.2-2-2.10.0.so
    `-- share
        `-- doc
            `-- libstdc++2.10-glibc2.2
                |-- README.Bugs.gz
                |-- README.Debian
                |-- changelog.Debian.gz
                `-- copyright

So I just had to move the shared libraries libstdc++*.so to ~/usr/lib, or alternatively, extract the deb file directly int my home directory:

dpkg -x libstdc++2.10-glibc2.2_2.95.4-27_i386.deb ~/

One important missing piece of the puzzle is to make sure these shared libraries can be found at run time (or compile time in case you want to compile against them). The trick is to set the LD_LIBRARY_PATH and LD_RUN_PATH environment variables, typically in your ~/.bashrc or ~/.profile startup scripts:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/usr/lib
export LD_LIBRARY_PATH
LD_RUN_PATH=$LD_RUN_PATH:~/usr/lib
export LD_RUN_PATH

And Eclipse TPTP profiling lived happily ever after. I hope.