Building Kodi 17 on Ubuntu Mate 16.04 LTS
#1
Finally got this done. I originally used the Kodi15.txt guide floating around, but found that some packages weren't in the new Xenial repos.. specifically, liblockdev1-dev. Looking at the dependency list in the readme's that come with the Kodi source, and it seems that package isn't even needed. Maybe in older versions, but not the newer releases. So... removed that from my apt list, and the build went fine. Smile

I do my set up a little differently. I use an external usb ssd drive, as well as a usb stick formatted to swap. I monitored the system resources during a build once... 1gb of swap was used at the highest point. Definitely helpful. The way I set up the os on the external ssd... flash the image to both the microsd, and the external drive, then edit the /boot/cmndline.txt on the microsd to point root to the 2nd partition of the external drive. It's always /dev/sda2. Even if adding other usb drives, I've never had the os disk change dev id's. The swap usb.. that's another story. I use UUID=xxx in my fstab. Otherwise, I'd lose my swap if I plugged in another usb stick just to transfer files. Also, I've tried with the swap on the os's ssd itself, but it actually runs better with a separate drive for the swap.

edit: I use a powered usb hub for the ssd and usb swap drive, as well as my Hauppauge ATSC tv tuner. If you use external drives, use a powered hub. The Pi itself may not supply enough power for both the Pi, and the drives.



Here's my steps... modify as needed.


Flash Ubuntu Mate 16.04 image to microsd

- edit /boot/config.txt

arm_freq=900
gpu_mem=256
max_usb_current=1

** note.. I use gpu_mem=256mb right out of the box, and have never had a freeze during a compile using -j4 (all 4 cores). On Ubuntu that is... Raspbian would still freeze, unless dropped down to -j3 (3 cores). Popcornmix says you can drop down to 16mb for the build, then increase back up when you're done. It's up to you.


Flash same image to external drive, then open with gparted - expand root partition to use the entire disk.


Upon first boot...

Code:
$ sudo apt-get install cpufrequtils

$ sudo nano /etc/init.d/cpufrequtils

GOVERNOR="performance"

$ sudo update-rc.d ondemand disable

$ sudo reboot

$ cpufreq-info

ubuntu@mate:~$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], please.
analyzing CPU 0:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 900 MHz
  available frequency steps: 600 MHz, 900 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 600 MHz and 900 MHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 900 MHz.
  cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26%  (1)
analyzing CPU 1:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 900 MHz
  available frequency steps: 600 MHz, 900 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 600 MHz and 900 MHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 900 MHz.
  cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26%  (1)
analyzing CPU 2:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 900 MHz
  available frequency steps: 600 MHz, 900 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 600 MHz and 900 MHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 900 MHz.
  cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26%  (1)
analyzing CPU 3:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 900 MHz
  available frequency steps: 600 MHz, 900 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 600 MHz and 900 MHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 900 MHz.
  cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26%  (1)
ubuntu@mate:~$



$ sudo apt-get install gparted synaptic

$ sudo synaptic

- select usb swap drive
- right click drive window
- select "Swapon"
- select "Information"
- copy UUID id

$ sudo nano /etc/fstab

UUID=597b4b5b-91e0-4c5e-b1c3-b1cbfea57790  none swap    sw      0       0


$ sudo reboot

$ free mem

ubuntu@mate:~$ free mem
              total        used        free      shared  buff/cache   available
Mem:         948016      183272      395040       10708      369704      727464
Swap:       7576572           0     7576572
ubuntu@mate:~$

right-click taskbar, add:

- CPU Frequency Scaling Monitor
- System Monitor


open System - Control Center

- disable screen saver and power management

right-click Workspace on bottom panel

- reduce to 1 workspace


$ sudo synaptic

Settings - Repositories

- Ubuntu Software - enable all
- Other Software - enable all
- Updates - Important & Recommended only

close Synaptic


$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo rpi-update
$ sudo reboot

$ sudo apt-get install build-essential make git-core checkinstall libboost1.58-all-dev swig curl libgnutls-dev libxml2-dev libxslt1-dev libfreetype6-dev libfontconfig1-dev libfribidi-dev libmpeg2-4-dev libmad0-dev libjpeg8-dev libsamplerate0-dev libogg-dev libvorbis-dev libflac-dev libtiff5-dev liblzo2-dev cmake zip unzip libsqlite3-dev libpng12-dev libpcre3-dev libjasper-dev libsdl1.2-dev libsdl-image1.2-dev libass-dev libmodplug-dev libcdio-dev libtinyxml2-dev libyajl-dev libgpg-error-dev libgcrypt11-dev libmicrohttpd-dev autoconf libtool autopoint libudev-dev python-dev python-imaging libmysqlclient-dev libcurl4-gnutls-dev libbz2-dev libtinyxml-dev libssh-dev libxrandr-dev libsmbclient-dev libcap-dev gawk gperf debhelper libiso9660-dev ccache default-jre doxygen librtmp-dev libnfs-dev libgif-dev libplist-dev libshairport-dev libbluray-dev libbluray1 libbluetooth-dev uuid-dev libtag1-dev libspeex-dev

$ git clone --recursive git://github.com/Pulse-Eight/libcec.git

$ cd libcec/src/platform && mkdir build && cd build && cmake ..

$ make -j4

$ sudo make install && cd

$ cd libcec && mkdir build && cd build && cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..

$ make -j4

$ sudo make install && cd

$ git clone -b master git://github.com/xbmc/xbmc.git kodi

$ sudo make -C kodi/tools/depends/target/crossguid PREFIX=/usr/local

$ cd kodi/project

$ git clone -b master https://github.com/kodi-pvr/pvr.hts.git

$ cmake -DADDONS_TO_BUILD=pvr.hts -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../kodi/addons -DPACKAGE_ZIP=1 ../../kodi/project/cmake/addons

$ make

$ cd ..

# git clean -xfd && git reset --hard
# make clean && ccache -cC

$ nano tools/depends/target/ffmpeg/autobuild.sh

add to the rest below "./configure --prefix=$FFMPEG_PREFIX \"

--enable-libspeex \


$ ./bootstrap

$ CFLAGS="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -mfloat-abi=hard -mcpu=cortex-a7 -mfpu=neon-vfpv4" CXXFLAGS="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -mfloat-abi=hard -mcpu=cortex-a7 -mfpu=neon-vfpv4" LDFLAGS="-L/opt/vc/lib" FFMPEG_OPTS="--cpu=cortex-a7" ./configure --disable-gl --enable-gles --with-platform=raspberry-pi2 --disable-x11 --disable-vaapi --disable-vdpau --disable-avahi --enable-libcec --disable-pulse --enable-optical-drive --enable-libusb --disable-vtbdecoder --enable-alsa --enable-player=omxplayer --enable-libbluray --with-ffmpeg=auto

$ make -j3

$ strip kodi.bin

$ sudo checkinstall


# fix keyboard privelages for user 'ubuntu'

$ sudo usermod -aG tty ubuntu

$ sudo su -c 'echo "KERNEL==\"tty[0-9]*\", GROUP=\"tty\", MODE=\"0660\"" >> /etc/udev/rules.d/99-input.rules'



------------------------
  Kodi Configuration:
------------------------
  Kodi Version:    17.0-ALPHA1
  git Rev.:    20160501-0bae239
  Debugging:    Yes
  Profiling:    No
  Optimization:    Yes
  SWIG Available:    Yes
  JRE Available:    Yes
  Doxygen Available:    Yes
  Crosscomp.:    No
  target ARCH:    arm
  target CPU:    cortex-a7
  OpenGLES:    Yes
  ALSA:        Yes
  DBUS:        Yes
  VDPAU:    No
  VAAPI:    No
  OpenMax:    No
  X11:        No
  Bluray:    Yes
  TexturePacker:Yes
  MID Support:    No
  ccache:    Yes
  ALSA Support:    Yes
  PulseAudio:    No
  Google Test Framework Configured:    Yes
  Google Breakpad Configured:    No
  Avahi:    No
  mDNSEmbedded:    No
  Non-free:    Yes
  MySQL:    Yes
  Webserver:    Yes
  libssh support:    Yes
  libRTMP support:    Yes
  libsmbclient support:    Yes
  libnfs client support:Yes
  AirPlay support:    Yes
  AirTunes support:    No
  UPnP support:        Yes
  Optical drive:    Yes
  libudev support:    Yes
  libusb support:    No
  libcec support:    Yes
  libbluetooth support:    Yes
  libcap support:    Yes
  additional players:    Yes, omxplayer
  additional codecs:    No
  prefix:    /usr/local
------------------------




tvheadend backend server:

sudo apt-get install liburiparser-dev libavcodec-dev libavformat-dev libswscale-dev libavresample-dev libhdhomerun-dev dvb-apps libkqueue-dev fakeroot libavahi-client-dev

# for latest release

$ git clone https://github.com/tvheadend/tvheadend.git

# for 4.0.9 release

$ git clone -b release/4.0 https://github.com/tvheadend/tvheadend.git

# personally, I use 4.0.8

https://github.com/tvheadend/tvheadend/archive/v4.0.8.tar.gz


$ cd tvheadend (whatever the version)

$ ./Autobuild.sh && cd

# you'll have 2 packages in your home directory..
# tvheadend*.deb, and tvheadend-dbg*.deb
# Select the tvheadend*.deb

$ sudo dpkg -i tvheadend (whatever the version).deb


That's it. Pretty easy, really. Should take about 4 hours in total... still quicker than cross-compiling from an Ubuntu pc. Wink


Enjoy Smile


Code:
http://www.gadgetguy.com.au/cms/wp-content/uploads/2015/12/sandisk-extreme-500-portable-ssd-2015-review-04-450x253.jpg

Code:
https://www.adafruit.com/products/961



edit: a manual fix for the black screen when exiting Kodi: [ctrl]+[alt]+[f8] followed by [ctrl]+[alt]+[f7]. There's scripts, but they didn't always work for me. This was just as quick.
Reply
#2
I forgot to mention...

After sudo checkinstall, it's going to take another 20 to 30 minutes, and look as if it's stuck going through a list of countries, then stuck on India. Don't worry... let it do it's thing. As long as you don't see ubuntu@mate:~$ or whatever your user and home name, then it's still doing it's thing. The cursor should still be blinking. Just be patient. Smile


Code:
tar: (India): Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

Installing Debian package...OK

Erasing temporary files...OK

Deleting temp dir...OK


**********************************************************************

Done. The new package has been installed and saved to

/home/ubuntu/kodi/kodi_17.0.000-1_armhf.deb

You can remove it from your system anytime using:

      dpkg -r kodi

**********************************************************************
Reply
#3
Thanks for this guide Smile . This could be interesting to test .

One question : are the hardware decoders available ? because I see :

VDPAU: No
VAAPI: No
OpenMax: No
X11: No
Reply
#4
Hardware decoders (OMX, MMAL -default)) are available.
I have tested SD and HD with pvr.mythtv addon to mythtv 0.28 backend.

The only issue I have found is blank screen on exit from Kodi.

Mike
Reply
#5
Thanks for the confirmation Mike.

For blank/black screen on exit, you could try :

https://gist.github.com/aperezm-vlex/75d...f0db8f5894

or

https://www.raspberrypi.org/forums/viewt...p?t=100811
Reply
#6
(2016-05-03, 09:15)fab67 Wrote: Thanks for this guide Smile . This could be interesting to test .

One question : are the hardware decoders available ? because I see :

VDPAU: No
VAAPI: No
OpenMax: No
X11: No

I just used what was in the original kodi15.txt guide. I thought that was just for pc based machines. I've never tried. Tongue
Reply
#7
(2016-05-03, 15:23)fab67 Wrote: Thanks for the confirmation Mike.

For blank/black screen on exit, you could try :

https://gist.github.com/aperezm-vlex/75d...f0db8f5894

or

https://www.raspberrypi.org/forums/viewt...p?t=100811

I just use [ctrl]+[alt]+[f8] followed by [ctrl]+[alt]+[f7].
Reply
#8
You can change --disable-avahi to --enable-avahi in the config line as well. You might need to install libavahi-client-dev from the tvheadend backend server's apt list first though. This is my 2nd build, so everything's already installed. If you're building the backend as well, then just install everything at once. If not, then just use libavahi-client-dev.
Reply
#9
I made an edit to the steps for pvr.hts...

Code:
make -j4 && cd ..

..seems to make the files, but it doesn't actually copy the pvr.hts folder to kodi/addons.


change back to..

Code:
$ make
$ cd ..
Reply
#10
Finally I found time to follow your tutorial. I have to say that I used my previous raspbian installation where I already successfully compiled and installed kodi 16.

After the CFLAGS command I get the following error:
Code:
checking for LIBBLURAY... no
configure: error: Could not find a required library. Please see the README for your platform.

Any idea how to bypass that?

UPDATE: As I do not need bluray support, I changed it to --disable-libbluray
Reply
#11
(2016-05-11, 21:36)rucksman Wrote: Finally I found time to follow your tutorial. I have to say that I used my previous raspbian installation where I already successfully compiled and installed kodi 16.

After the CFLAGS command I get the following error:
Code:
checking for LIBBLURAY... no
configure: error: Could not find a required library. Please see the README for your platform.

Any idea how to bypass that?

UPDATE: As I do not need bluray support, I changed it to --disable-libbluray

Strange.. the libraries from the repos worked for me in Ubuntu. In Raspbian, I build it from source...

Code:
$ wget https://download.videolan.org/pub/videolan/libbluray/0.8.1/libbluray-0.8.1.tar.bz2

$ tar jxf libbluray-0.8.1.tar.bz2

$ cd libbluray*

$ ./bootstrap
$ ./configure
$ make -j4
$ sudo make install

  Summary:
  --------
  BD-J support:                  yes
  BD-J type:                     j2se
  Font support (freetype2):      yes
  Use system fonts (fontconfig): yes
  Metadata support (libxml2):    yes
  UDF filesystem support:        no
  Build examples:                yes
Reply
#12
I tried building libbluray from source, got another error because of missing ANT. I was too lazy to install ANT so I disabled libbluray. I have to say that I skipped your "apt-get install" due to the fact that I already have compiled kodi 16 and was quite sure that I have everything on board for compiling kodi 17.

Sadly enough I got an error during make. The line "CPP xbmc/music/windows/GUIWindowMusicNav.o" was there for a very long time, then an error occured (something with "music", I forgot to copy the error message). It's too late today, so I give it another try tomorrow.
Reply
#13
Code:
sudo apt-get install ANT openjdk-7-jdk gdc fpc libvdpau1 libvdpau-dev libdvdread-dev
Reply
#14
So I gave it another try yesterday evening, but (as expected) with the same result. During make again at "CPP xbmc/pvr/windows/GUIWindowPVRBase.o" there was no progress for a very long time, then the following message appeared:
Code:
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
../../Makefile.include:97: recipe for target 'VideoDatabase.o' failed
make[1]: *** [VideoDatabase.o] Error 1
Makefile:420: recipe for target 'xbmc/video/video.a' failed
make: *** [xbmc/video/video.a] Error 2
CPP     xbmc/pvr/windows/GUIWindowPVRChannels.o
make: *** Warte auf noch nicht beendete Prozesse...
The a few more line beginning with CPP appeared and then the build process stopped. There was no success message. Of course sudo checkinstall failed because the build process did not finish properly.
Reply
#15
(2016-05-13, 09:17)rucksman Wrote: So I gave it another try yesterday evening, but (as expected) with the same result. During make again at "CPP xbmc/pvr/windows/GUIWindowPVRBase.o" there was no progress for a very long time, then the following message appeared:
Code:
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
../../Makefile.include:97: recipe for target 'VideoDatabase.o' failed
make[1]: *** [VideoDatabase.o] Error 1
Makefile:420: recipe for target 'xbmc/video/video.a' failed
make: *** [xbmc/video/video.a] Error 2
CPP     xbmc/pvr/windows/GUIWindowPVRChannels.o
make: *** Warte auf noch nicht beendete Prozesse...
The a few more line beginning with CPP appeared and then the build process stopped. There was no success message. Of course sudo checkinstall failed because the build process did not finish properly.

I think something is stale (leftover from previous build attempts)
Suggest you clean your kodi git build tree:

cd kodi
git clean -xfd
git reset --hard
git pull --rebase

You will need to do ./bootstrap

then add --disable-ccache to your ./configure line

Mike
Reply

Logout Mark Read Team Forum Stats Members Help
Building Kodi 17 on Ubuntu Mate 16.04 LTS0