I'm trying to install a CAN emulator software with GTK and I keep getting an error.

CANMate: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory

But when apt says libgtk-3 is installed:

$ sudo apt install libgtk-3-0 libgtk-3-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgtk-3-0 is already the newest version (3.22.30-1ubuntu1).
libgtk-3-dev is already the newest version (3.22.30-1ubuntu1).

And the shared lib can be found inside /usr/lib/x86_64-linux-gnu.

$ ls | grep libgtk-3

I think the installation file CANMatev1.3.deb is failing to locate the shared lib while installation.

Can you please, help me resolve this error?

  • try re-creating your dynamically linked list of run-time libraries cache with sudo ldconfig. The [list of] directories aren't searched, only the cache is. – guiverc Nov 8 '18 at 12:07
  • @guiverc I tried sudo ldconfig and tried reinstalling sudo dpkg -i <deb.name>. But when I try calling program after the installation, it still says libgtk-3.so.0: cannot open shared object file – clmno Nov 8 '18 at 12:11
  • Although package information (via dpkg -i) shows the architecture as "all", the actual CANMate application appears to be a 32-bit binary - hence you will likely need to enable multiarch and install the libgtk-3-0:i386 package – steeldriver Nov 8 '18 at 12:27
  • @steeldriver Thank you! It worked. How did you know it was a x32 arch? Would like to know so that I can check the next time something similar happens. – clmno Nov 8 '18 at 12:40
  • @clmno please see below – steeldriver Nov 8 '18 at 12:50

On a hunch, let's see if the problem is that the application is 32-bit

  • unpack the deb to a local directory

    $ mkdir ./tmproot
    $ dpkg -x CANMAte_V1.3_Linux/deb/CANMatev1.3.deb ./tmproot
  • examine the application binary

    $ file ./tmproot/usr/bin/CANMate 
    ./tmproot/usr/bin/CANMate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=061c53b0a1b07aca998506681c2a93039181979e, not stripped

So, since you are using a 64-bit OS, you will need to enable multiarch and install the 32-bit version of any required libraries

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libgtk-3-0:i386

See also How to run 32-bit app in Ubuntu 64-bit?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.