build kodi krypton for dietpi on xu4

Moderators: meveric, mdrjr, odroid

build kodi krypton for dietpi on xu4

Unread postby zefor » Thu Apr 06, 2017 4:27 am

First, I am by no means an expert. These are the steps I took to compile kodi 17.1 "krypton" on the xu4 and/or xu3 running dietpi, and can make no assumption that these steps will work on any other board, or any other OS.
* If you are on a fresh install of dietpi, of course use apt to update, upgrade, and dist-upgrade before you attempt any of this.

Thanks go to-
nogareth, this guide got me started and still contains useful information viewtopic.php?f=95&t=12859
Oversun for maintaining his xbmc repo
meveric, for answering my questions and pointing me in the right direction.
Google search engine, always a useful tool.

I had also installed mate desktop in dietpi and I used mate terminal to enter commands. I installed gedit to create the files I needed to upgrade GCC. If you would like to use gedit also then:
Code: Select all
sudo apt-get install gedit

Step 1
Get the Kodi build dependencies:
Code: Select all
apt-get install git \
        automake autopoint bison build-essential ccache cmake curl cvs \
        default-jre fp-compiler gawk gdc gettext gperf libasound2-dev \
        libass-dev libavcodec-dev libavfilter-dev libavformat-dev \
        libavutil-dev libbluetooth-dev libboost-dev libboost-thread-dev \
        libbz2-dev libcap-dev libcdio-dev doxygen gnutls-dev libtag1-dev \
        libcurl3 libcurl4-gnutls-dev libcwiid-dev libcwiid1 libdbus-1-dev \
        libenca-dev libflac-dev libfontconfig-dev libfreetype6-dev \
        libfribidi-dev libglew-dev libiso9660-dev libjasper-dev freeglut3-dev uuid-dev \
        libjpeg-dev libltdl-dev liblzo2-dev libmad0-dev libmicrohttpd-dev \
        libmodplug-dev libmp3lame-dev libmpeg2-4-dev libmpeg3-dev \
        libmysqlclient-dev libnfs-dev libogg-dev libpcre3-dev libplist-dev \
        libpng-dev libpostproc-dev libpulse-dev libsamplerate-dev \
        libsdl-dev libsdl-gfx1.2-dev libsdl-image1.2-dev \
        libsdl-mixer1.2-dev libsmbclient-dev libsqlite3-dev libssh-dev \
        libssl-dev libswscale-dev libtiff-dev libtinyxml-dev libtool \
        libudev-dev libusb-dev libva-dev libva-egl1 libva-tpi1 libvdpau-dev \
        libvorbisenc2 libxml2-dev libxmu-dev libxrandr-dev libxrender-dev \
        libxslt1-dev libxt-dev libyajl-dev mesa-utils nasm pmount \
        python-dev python-imaging python-sqlite swig unzip yasm zip \
        zlib1g-dev libtag-extras-dev gnutls-dev liblockdev1-dev uuid-dev \
        libgif-dev libsdl2-dev liblcms2-dev libcrossguid-dev

A few more things to install:

Code: Select all
apt-get install libegl1-mesa-dev

A warning from meveric:
meveric wrote:
derko wrote:the error:
checking for main in -lEGL... no
configure: error: Could not find a required library

Any idea ?

apt-get install libegl1-mesa-dev
You might have to reinstall the Mali GPU drivers afterwards though, since some headers are different.

For my purposes, I had no issues with the drivers, kodi works great.

Step 2
You need to upgrade your gcc from version 4.9 because it is too old. A warning about upgrading from meveric:
meveric wrote:actually you need a newer version of GCC to get it to compile, but you also need to recompile some dependencies that are also compiled against GCC 4.9 or else you can't link them.
It's easier to build your own gcc rather than waiting for new packages... I don't think I'll backport any GCC versions directly from Stretch to Jessie, but I also use a locally compiled GCC 6.3 and was able to compile Kodi 17.1 for Debian Jessie, but it's somewhat tricky and the dependencies for Kodi break other existing programs.

Since I am really only using dietpi for kodi, I have not run into any issues with other programs.... venture at your own risk.

How I upgraded gcc successfully:

go to /etc/apt/sources.list.d
create a file (can be named anything just needs a .list extension) and copy and paste
Code: Select all
deb testing main contrib non-free
and save it. (example: "name.list")

then go to /etc/apt/preferences.d and create a file containing
Code: Select all
Package: *
Pin: release a=testing
Pin-Priority: 100

save it (I just named it preference and saved it in gedit with no special extension)

In terminal:
Code: Select all
sudo apt-get update

Code: Select all
sudo apt-get install -t testing gcc

You can check to see that your gcc updated with:
Code: Select all
gcc -v

Step 3
Build shairplay.. I needed to do this in order to get through the configure part of building kodi.
Code: Select all
git clone

Code: Select all
cd shairplay

Code: Select all
sudo apt-get install autoconf automake libtool
sudo apt-get install libltdl-dev libao-dev libavahi-compat-libdnssd-dev
sudo apt-get install avahi-daemon

Code: Select all
sudo make install

Code: Select all

Even when installing libcec-dev and libbluray-dev with apt, I still encountered errors while running configure. Building them from source fixes this.
Code: Select all
git clone
git clone
git clone
git clone

Code: Select all
mkdir platform/build
mkdir libcec/build

Code: Select all
apt-get install cmake libxrandr-dev python-dev swig ANT

Code: Select all
cd platform/build
cmake ..
make -j8
make install

Code: Select all
cd libcec/build
cmake -DHAVE_EXYNOS_API=1 ..
make -j8
make install

Code: Select all
rm -rf libbluray/contrib/libudfread
ln -s "${HOME}/libudfread" libbluray/contrib
cd libbluray
./configure --disable-bdjava
sudo make install

Step 4
Get Kodi from oversuns repo
Code: Select all
git clone

Code: Select all
cd xbmc

A fantastic Idea from nongareth, but with a few minor changes:
Code: Select all
nano build

Copy and paste:
Code: Select all
CFLAGS="-I/usr/src/xbmc/tools/depends/target/ffmpeg/ffmpeg-install/include -fpermissive -mfloat-abi=hard -mfpu=neon-vfpv4 -ftree-vectorize -mvectorize-with-neon-quad -ffast-math -O3 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2" \
LDFLAGS="-L/usr/lib/python2.7/config-arm-linux-gnueabihf/" \
./configure --enable-gles --disable-gl --disable-vdpau --disable-vaapi \
            --disable-openmax --enable-xrandr --disable-rsxs --enable-libusb \
            --disable-projectm --enable-nfs --enable-non-free --disable-optical-drive --enable-libbluray \
            --disable-joystick --disable-debug --enable-optimizations --enable-ccache \
            --enable-alsa --enable-mysql --enable-airplay --enable-airtunes --with-platform=samsung-exynos --enable-libcec \
            --enable-sdl --enable-pulse --enable-x11 --prefix=/usr --enable-samba --enable-codec=mfc

Code: Select all
 chmod +x build

Step 5.
create a file called patch.diff and copy and past this into it
Code: Select all
diff --git a/xbmc/windowing/X11/GLContextEGL.cpp b/xbmc/windowing/X11/GLContextEGL.cpp
index fed5d7b..45aedb9 100644
--- a/xbmc/windowing/X11/GLContextEGL.cpp
+++ b/xbmc/windowing/X11/GLContextEGL.cpp
@@ -36,6 +36,7 @@
   #include <GLES2/gl2.h>
   #include <GLES2/gl2ext.h>
+  #include <X11/Xutil.h>
 #include "GLContextEGL.h"

Code: Select all
git apply patch.diff

Step 6.
Code: Select all
make -j8

If you see the message "Kodi built successfully"
Code: Select all
make install

* Make sure you delete those two files you created after updating gcc, if not, when you do update, upgrade, dist-upgrade it will break your system.

Now, after I built kodi, it crashed upon opening (only happened when kodi was already installed). No worries, simply do this:
Code: Select all
mv ~/.kodi ~/kodi-backup

After all of this, I had a working Kodi 17.1 Krypton. Again, I am no expert.... these are simply the steps I used to get kodi upgraded to krypton in dietpi. I am sure more can be added to this guide over time to make it even better. I hope someone finds this useful, and does not need to go through the headaches that I did ;)
Posts: 51
Joined: Mon Dec 29, 2014 9:45 pm
languages_spoken: english
ODROIDs: Odroid-xu3 lite
3 Odroid-XU4's

Re: build kodi krypton for dietpi on xu4

Unread postby Linuxghost » Fri Dec 08, 2017 12:51 am

Thank you very much for this howto Zefor.
I have tried to use Kodi on Ubuntu Mate but it fails;
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
and then dumps the core...
Tomorrow i will try your howto.
Will let you know the result. :)
Posts: 6
Joined: Thu Dec 07, 2017 11:00 pm
Location: Zwolle, The Netherlands
languages_spoken: dutch,english,german,french,frisian

Re: build kodi krypton for dietpi on xu4

Unread postby meveric » Fri Dec 08, 2017 1:06 am

The Guide is for Debian Jessie not for Ubuntu 16.04 and some steps will fail if you try them on Ubuntu or are simply unnecessary.
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
Posts: 8365
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Return to Ubuntu (All Linux'es)

Who is online

Users browsing this forum: No registered users and 1 guest