Search code examples
linuxdockershared-librariesquartus

libpng12.so.0: cannot open shared object file: wrong ELF class: ELFCLASS64


I'm trying to install Quartus 13.0 on a docker container but I have a trouble with libpng12 lib.

builder@580847ded665:~$ ls -ld $(locate -r libpng.*\.so.*)
lrwxrwxrwx. 1 root root     18 Jan  6  2016 /lib/x86_64-linux-gnu/libpng12.so.0 -> libpng12.so.0.54.0
-rw-r--r--. 1 root root 149904 Jan  6  2016 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
lrwxrwxrwx. 1 root root     35 Jan  6  2016 /usr/lib/x86_64-linux-gnu/libpng12.so.0 -> /lib/x86_64-linux-gnu/libpng12.so.0
builder@580847ded665:~$ xvfb-run -a /home/builder/altera/13.0/quartus/bin/tb2_install --enable
tb2_install: error while loading shared libraries: libpng12.so.0: cannot open shared object file: wrong ELF class: ELFCLASS64

The problem is I have a 32 bit application trying to use a 64 bit library and it is not understanding it. Could anyone please help me to figure out how to fix this issue?


Solution

  • Here's what you can do. Download libpng12-0 package from here.

    Now head over to the folder where you've downloaded it and open the terminal from there. Switch to super user using:

    sudo su
    

    Install the downloaded package with the following command:

    dpkg -i libpng12-0_1.2.50-1ubuntu2.14.04.3_amd64.deb; apt-get install -f
    

    (The package name can change, make sure to change it accordingly).

    If you get an error like this:

    dpkg: error processing archive libpng12-0_1.2.50-1ubuntu2.14.04.3_amd64.deb (--install): trying to overwrite shared '/usr/share/doc/libpng12-0/changelog.Debian.gz'
    

    This means that you might have an existing libpng package installed on your system which is causing a conflict. Do this:

    mv /usr/share/doc/libpng12-0 /usr/share/doc/libpng12-0.backup
    

    This means that you are moving the conflict causing directory to another location.

    Finally,

    dpkg -i libpng12-0_1.2.50-1ubuntu2.14.04.3_amd64.deb; apt-get install -f
    

    My answer is specific to Bionic beaver and *64 architecture. You can checkout the link provided above to download other architecture-specific packages.

    Hope this helps!