Category Archives: *nix

Install libstdc++.so.5 on Ubuntu 10.04 64-bit

I recently got a new laptop and, as often in that case, had to install a fresh Ubuntu 10.04 64-bit (to replace a Windows XP) and all the software and tools I need as a developer.

One of the software I had to install was the Tibco Enterprise Messaging Service (an implementation of the Java Message Service, JMS). The installation went fine (I had to deactivate all the visual effects in order to see the content of the dialog boxes though – under System > Preferences > Appearance) but I had some troubles starting EMS.

/opt/tibco/ems/5.0/bin/tibemsd

/opt/tibco/ems/5.0/bin/tibemsd: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

EMS requires libstdc++.so.5 but only libstdc++.so.6 is nowadays bundled with Ubuntu. After some Googling I finally came across a solution that worked.

wget http://security.ubuntu.com/ubuntu/pool/universe/i/ia32-libs/ia32-libs_2.7ubuntu6.1_amd64.deb
dpkg-deb -x ia32-libs_2.7ubuntu6.1_amd64.deb ia32-libs
sudo cp ia32-libs/usr/lib32/libstdc++.so.5.0.7 /usr/lib32/
cd /usr/lib32
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

If you have another solution that you’d like to share, please leave a comment!

Unix – how to search for a string in multiple gzip compressed files

Sometimes you need to look for specific errors in the log files of a couple of nodes. Luckily – for me – the system administrators have done a nice job gathering all the log files on one machine. Each node has its own folder (named after its IP address) and the logs are compressed (gunzip).

Now let’s look for a call to the “getSomeInformation” method made by the merchant 123 that should hopefully have reached one of the nodes. I will use zcat and cross my fingers…

zcat 10.1.*.*/application-a/http-requests-log.gz | grep 'getSomeInformation&merchant=123'

Ubuntu, choosing the default Java to use

Considering that you have several JVM installed on your Ubuntu box, use the following command to interactively change the default Java flavor you want to run.

sudo update-alternatives --config java

You can then choose the Java alternative you would like /usr/bin/java to point to.

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection   Path                              Priority   Status
------------------------------------------------------------
  0  /usr/lib/jvm/java-6-openjdk/jre/bin/java  1061  auto mode
  1  /usr/lib/jvm/java-6-openjdk/jre/bin/java  1061  manual mode
* 2  /usr/lib/jvm/java-6-sun/jre/bin/java      63    manual mode

Press enter to keep the current choice[*], or type selection number: