Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm installing IRAF on a new machine, and when I try to launch xgterm, I get the error message:

xgterm: error while loading shared libraries: cannot open shared object file: No such file or directory

However, the package that contains this library, libXmu6, is both installed and up to date.

Any help would be appreciated.

share|improve this question
up vote 2 down vote accepted

There is two things you may try: (i) install the -dev package of the library - e.g. sudo apt-get install libxmu-dev or (ii) if you are using a 32bits installation of IRAF in a 64bits machine, install the 32bits library e.g. sudo apt-get install libxmu6:i386

share|improve this answer

If installing the dev package doesn't work, you may have to export it to the LD_LIBRARY_PATH variable.

You can find it with find / -iname -print 2>/dev/null, in my case it was in /usr/lib/x86_64-linux-gnu/

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/${LD_LIBRARY_PATH}

NB if the $LD_LIBRARY_PATH variable is empty at the start you should omit the lib... onwards.

This didn't change the situation for me, and on this advice I ran sudo apt-get install ia32-libs which worked, to a degree, now changing my error message to

error while loading shared libraries: cannot open shared object file: No such file or directory

(i.e. number 4 not 6)

This can be installed with sudo apt-get install libxm4, the resultant location found with find / -iname -print 2>/dev/null, and added to the $LD_LIBRARY_PATH with (e.g. for my result)

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/${LD_LIBRARY_PATH}

Meaning my LD_LIBRARY_PATH was /usr/lib/x86_64-linux-gnu/

This didn't change the error message asking for however. For this library (which I can see is there with locate...) I installed OpenMotif (not sure if this is necessary)

sudo apt-get install libmotif-dev

And eventually figuerd out the 32 bit package requirement will work with the libraries after installing ia32-libs, but for needs explicit declaration of 32-bit status by using links in the /usr/lib/i386-linx-gnu folder. This was clear when I ran:

/usr/lib/i386-linux-gnu $ ls ../*/libXm*

(showing notably only ../i386-linux-gnu/, so I created one such link with:

sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/i386-linux-gnu/

I then managed to advance to the next error message (woohoo!) as mentioned on other help pages:

error while loading shared libraries: wrong ELF class: ELFCLASS64

...which was odd since that's where I'd just put the link... This page suggested a workaround but I couldn't install libx3motif.deb as amd64 breaks a dependency (and I wasn't about to go uninstalling crucial components like that for the sake of this).

This answer highlights the need to have the 32-bit package earlier in the $LD_LIBRARY_PATH than the 64 bit ones.

export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/

This changed nothing. I tried copying the file to the i386 folder and redirecting the link

sudo cp /usr/lib/x86_64-linux-gnu/ /usr/lib/i386-linux-gnu/
sudo ln -fs /usr/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/

(The -f flag forces retargeting i.e. you don't have to rm and remake)

I struggled with this for a little while longer (not quite sure what the final straw was) until finding success with this in my .bashrc:

export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/

So, this is proof that you don't need 32 bit packages installed, just to point symlinks in the 32 bit lib folder to the 64 bit packages... Sorry for the TMI but just might be useful for anyone stuck in future

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.