Wednesday, 7 December 2011

Ensuring vmc++ has the standard library

The short answer:

If you're getting an error like this:
./vmcpp: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
while running VMC++, then you need to add gcc-3.3 to your system, which adds the missing library file mentioned in the error.  In Ubuntu, you can fix this by adding this line to your /etc/apt/sources.list file (choose your mirror from http://packages.ubuntu.com/hardy/i386/libstdc++5/download):

deb http://ubuntu.wikimedia.org/ubuntu/ hardy main universe

and then opening synaptic, reloading, and installing the libstdc++5 package:
sudo apt-get install libstdc++5


More details

In my version of Ubuntu (10.04 lucid), the standard c++ library is the one that comes packaged with gcc-4.4. Unfortunately, the version of the VMC++ monte carlo package that I have was compiled with an older version of gcc. Here is the message I received:
 ./vmcpp: error while loading shared libraries: libvmcpp.so: cannot open shared object file: No such file or directory 
Ooops, that's actually the first error I received while running the program. That simply requires the addition of the lib files that came with the VMC++ executable (including libphsp_source.so, libsimple_source.so, libvmcpp.so) to your system's library path.  If you don't want to install them the 'correct' way, you can get away with adding their directory to the environment variable LD_LIBRARY_PATH, like this (in bash):
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd` 
Indeed, the real error I received was this:
./vmcpp: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
This required some digging.  A Google search revealed the Ubuntu repositories containing my desired package (libstdc++5).  After choosing the package (the one with /usr/lib/libstdc++.so.5 for my system) and -- on the next page -- my architecture (i386), I was guided to the download location.  I added the appropriate line to my /etc/apt/sources.list file, reloaded my synaptic, then installed the package libstdc++5.

No comments:

Post a Comment