Unable to load libcec.so on Kodi

As part of a complete re-vamp of my home media setup (blog post coming soon on that!), I found myself trying to connect a Sony TV to an Intel NUC running Kodi v16 via one of PulseEight‘s brilliant USB-CEC Adapters. However, no matter what I tried (combinations of cables, all the settings on the TV, different ports on the NUC etc) I could not get Kodi to recognise the adapter. Despite the Kodi Wiki page on CEC suggesting that this should plug-and-play, I did not get any suggestion from either the TV or Kodi that the CEC dongle was being recognised.

After quite a lot of searching in the wrong place (at first I was convinced that my fresh install of Kodibuntu wouldn’t be the root cause), I found a couple of log lines that finally pointed me in the right direction:

DEBUG: Loading: libcec.so.3.0
ERROR: Unable to load libcec.so.3.0, reason: libcec.so.3.0: cannot open shared object file: No such file or directory

Turns out that Kodi is built against libcec.so.3.0, however the version in the repository (I believe that was bundled or at least suggested by Kodibuntu) is 3.1. Kodi should (theoretically) be built against libcec.so.3 (note the missing .0), which the appropriate symlinks would have taken care of, however it seems there are some changes between 3.0 and 3.1 that Kodi doesn’t like, so some simple switching of the links (I tried creating /usr/local/lib/libcec.so.3.0 -> /usr/local/lib/libcec.so.3.1, which in hindsight isn’t a great idea) caused various crashes that I wasn’t prepared to start debugging – so instead I used the suggestion in this forum thread:

$ apt-get install --reinstall libcec3=3.0.1-1~trusty

Which will put the old version of libcec on your machine. After a quick reboot, Kodi instantly recognised the CEC dongle as promised, and it has been working beautifully ever since!

One thought on “Unable to load libcec.so on Kodi

  1. Thank you for this post. It finally made me help get it working.
    I also own a NUC, and reinstalled it using Ubuntu Server 16.04.1 LTS and couldn’t figure out what the issue was until I did a
    sudo cat /home/kodi/.kodi/temp/kodi.log | grep -i cec
    to show me the message you had as well.

    Since I run a newer version of Ubuntu/Debian/whatever it’s called, I had to change the reinstall line a bit:
    sudo apt-get install –reinstall libcec3=3.0.3~xenial
    sudo apt-get install –reinstall cec-utils=3.0.3~xenial
    to get the utilities back again as well (those get removed with the first line.

    Did a reboot (because of general updates) and it got detected just fine now.

    Thanks again for your post!

Leave a Reply

Your email address will not be published. Required fields are marked *