Ubuntu – “error while loading shared libraries: libGL.so.1: wrong ELF class: ELFCLASS32” installing ATI drivers

mesasoftware installationxorg

I was following the instructions on section 3.2 of this page.

Everything went well until step 8, which is to use sudo amdconfig --initial
to create a new xorg.conf file, but I get the following error:

amdconfig: error while loading shared libraries: libGL.so.1: wrong ELF class: ELFCLASS32

I tried creating the file /etc/ld.so.conf.d/lib32.conf with /usr/lib32 inside, as the second answer here suggested, and ran sudo ldconfig but nothing changed.

EDIT: Installed libgl1-mesa-glx:i386 and ran sudo ldconfig, and problem persisted even after rebooting.

EDIT2: Since step seven of the first link, after rebooting my top and side panels of unity and also the dash are missing, but I'm assuming this will be fixed when I finish the drivers installation.

EDIT3: Same error happens with fglrxinfo and glxinfo command (before following step 7 glx info was normal).

EDIT4: output of lspci -v | grep -A10 VGA (complete output)

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) (prog-if 00 [VGA controller])
    Subsystem: Dell Device 0572
    Flags: bus master, fast devsel, latency 0, IRQ 45
    Memory at c1000000 (64-bit, non-prefetchable) [size=4M]
    Memory at b0000000 (64-bit, prefetchable) [size=256M]
    I/O ports at 4000 [size=64]
    Expansion ROM at <unassigned> [disabled]
    Capabilities: <access denied>
    Kernel driver in use: i915
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Chelsea LP [Radeon HD 7730M] (prog-if 00 [VGA controller])
    Subsystem: Dell Device 0572
    Flags: bus master, fast devsel, latency 0, IRQ 16
    Memory at a0000000 (64-bit, prefetchable) [size=256M]
    Memory at c0000000 (64-bit, non-prefetchable) [size=256K]
    I/O ports at 3000 [size=256]
    Expansion ROM at c0040000 [disabled] [size=128K]
    Capabilities: <access denied>
    Kernel driver in use: fglrx_pci

EDIT: output of dpkg -S libGL.so.1:

       libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
       libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0

Best Answer

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