7

Using native OpenGL

/home/software/Mercury_3.3/c_linux/bin/mercury.x: error while loading shared libraries: libGL.so.1: wrong ELF class: ELFCLASS64
1
  • 1
    Could you at least explain what are you trying to do?
    – Braiam
    Mar 31, 2014 at 0:50

1 Answer 1

12

Looks like your application is a 32 bits application but is trying to load a 64bits library. On a 64bits installation, you can have both version (32 bits and 64 bits) of any libraries installed. 32bits can be found under /usr/lib32 and 64bits under /usr/lib64.

On Linux, libraries are search using a path sequence, a little bit like the PATH variable list all the directories to look for the executable you want to run when no path is given. This sequence to search for libraries is defined in a variable called LD_LIBRARY_PATH.

The problem is that the directory for the 64bits versions comes before the directory with the 32bits versions. And usually the name of the library is identical for the 32bits and 64bits version.

You can overcome this problem by creating a small startup script for your application like this one :

#!/bin/bash

export LD_LIBRARY_PATH=/usr/lib32:/usr/lib64:$LD_LIBRARY_PATH

<your binary> $*

If there is already a script to start this application, you can just add the line

export LD_LIBRARY_PATH=/usr/lib32:/usr/lib64:$LD_LIBRARY_PATH

to it, near the top.

I'll prefer the first method, creating a specific script, as any startup script provided by the package will be probably overwritten in case of update.

Not the answer you're looking for? Browse other questions tagged .