"error while loading shared libraries: libGL.so.1: wrong ELF class: ELFCLASS32" installing ATI drivers

Solution 1:

Note that:

For Ubuntu 16.04 LTS and above, the AMD Catalyst or fglrx driver is no longer supported by AMD.

If you are using 16.04 LTS or above, you are very likely on your own. The following is only meant for the case described in the question. I can't guarantee that it would work on later versions.

The problem that we solved by commenting was that you were using 32-bits libraries in a 64-bits system.

wrong ELF class: ELFCLASS32

The ending of the class should have been 64, hence producing this error. The way to go is purging the 32-bits libraries then reinstalling the 64-bits.

sudo apt-get purge libgl1-mesa-glx:i386
sudo apt-get --reinstall install libgl1-mesa-glx

And refreshing our GNU linker:

sudo ldconfig

Once everything is ok, ldconfig -p | grep libGL.so.1 should show:

libGL.so.1 (libc6) => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
libGL.so.1 (libc6) => /usr/local/lib/libGL.so.1

If you ever need the 32-bits libraries for running 32-bits applications, you could do so installing the libgl1-mesa-glx:i386 package. But in this case remember to setting your LD_LIBRARY_PATH temporally to where the 32bits libraries are, so it won't mess up your other programs.

 export LD_LIBRARY_PATH="/path/to/library/"
 ./run_some_32_bit_program