Kodi Segmentation Fault on Start


Recently I updated from OpenSUSE 13.2 to Leap 42.1, and together KDE 4 to 5.4, but all of a sudden Kodi stopped working. The symptom is that Kodi only shows the splash screen and then force closes dumping a crash log.

If running from the commandline, usually it gives an error of segmentation fault (sth. like below).

/usr/bin/kodi: line 168:  6211 Segmentation fault      (core dumped) "$LIBDIR/${bin_name}/${bin_name}.bin" $SAVED_ARGS
After digging into the crash log and googling around for a while I found there are two major possible problems that leads to my case.

libcec not installed

This problem is easy to spot, since there is usually an error message in the crash log like below.

ERROR: Unable to load libcec.so.3.0, reason: libcec.so.3.0: cannot open shared object file: No such file or directory
ERROR: Initialise - failed to initialise bus cec
Just install libcec3_0 from the main repo should work. Basically it enables you to control Kodi through your TV remote, even if you don't really need it. (Notice there is also a libcec package which won't solve the problem.)
$sudo zypper in libcec3_0

ffmpeg with messed up dependencies

This one took me quite a while to figure out. It seems if you have both the packman repo and official OpenSUSE repo, the dependencies of ffmpeg can get messed up. Solution is also easy, go to Yast and make sure all dependencies of ffmpeg come from packman, if not, you may need to change vendor for those packages. For example, if you wanna use the ffmpeg package from the packman repo, you can do the following.

$sudo zypper in --from packman ffmpeg

By