Tuesday, September 17, 2013

error while loading shared libraries in Linux

install xmgrace in a SuSE linux system

'more /etc/SuSE-release' gives system info:
SUSE Linux Enterprise Desktop 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2

'xmgrace' result in one of two errors:

xmgrace: error while loading shared libraries: libpng14.so.14: cannot open shared object file: No such file or directory

or

xmgrace: error while loading shared libraries: libpng14.so.14: wrong ELF class: ELFCLASS32


First error indicate the library is missing
Second error indicate the library is 32bit (not 64bit)

'ldd /usr/bin/xmgrace', part of the output is:
        ...
        libt1.so.5 => /usr/lib64/libt1.so.5 (0x00007f06d0acf000)
        libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00007f06d08ab000)
        libpng14.so.14 => not found
        libm.so.6 => /lib64/libm.so.6 (0x00007f06d0631000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f06d042d000)
        ...

Solution is to download the right library, google '64 bit libpng14.so.14'
result in a package named "brlcad-7.20.2-0.openSUSE.x86_64.rpm"
which has the needed library and many other libraries also
at rpm.pbone.net

Download the package
and install it by
'sudo zypper install brlcad-7.20.2-0.openSUSE.x86_64.rpm'
Then the library is installed under /usr/brlcad/lib,
copy to /usr/lib64 by 'sudo cp /usr/brlcad/lib/libpng14.so.14 /usr/lib64'

enjoy 'xmgrace' !