Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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: libXmu.so.6: 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

2 Answers 2

up vote 1 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 libXmu.so.6 -print 2>/dev/null, in my case it was in /usr/lib/x86_64-linux-gnu/libXmu.so.6

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libXmu.so.6/lib:${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: libXm.so.4: 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 libXm.so.4 -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/libXm.so.4/lib:${LD_LIBRARY_PATH}

Meaning my LD_LIBRARY_PATH was /usr/lib/x86_64-linux-gnu/libXm.so.4/lib:/usr/lib/x86_64-linux-gnu/libXmu.so.6

This didn't change the error message asking for libXm.so.4 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 libXmu.so.6 libraries after installing ia32-libs, but for libXm.so.4 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/libXmu.so.6), so I created one such link with:

sudo ln -s /usr/lib/x86_64-linux-gnu/libXm.so.4.0.4 /usr/lib/i386-linux-gnu/libXm.so.4

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

error while loading shared libraries: libXm.so.4: 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/libXm.so.4/lib:/usr/lib/x86_64-linux-gnu/libXmu.so.6.2.0/lib:/usr/lib/x86_64-linux-gnu/libXmu.so.6

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

sudo cp /usr/lib/x86_64-linux-gnu/libXm.so.4.0.4 /usr/lib/i386-linux-gnu/libXm.so.4.0.4
sudo ln -fs /usr/lib/i386-linux-gnu/libXm.so.4.0.4 /usr/lib/i386-linux-gnu/libXm.so.4

(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/libXm.so.4/lib:/usr/lib/x86_64-linux-gnu/libXmu.so.6.2.0/lib:/usr/lib/x86_64-linux-gnu/libXmu.so.6

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.