Difference between revisions of "HOW-TO:Compile Kodi for Ubuntu"

From Official Kodi Wiki
Jump to: navigation, search
Line 1: Line 1:
{{redv|Warning:|This page is '''deprecated'''.<br />Starting with Kodi v18 "Leia", Kodi's build guides are kept '''[https://github.com/xbmc/xbmc/blob/master/docs/README.md alongside the code]''', where it is much easier to keep them up-to-date with current code.}}
This guide will show you how to compile XBMC for Ubuntu.
This guide will show you how to compile XBMC for Ubuntu.

Revision as of 12:13, 4 July 2018

Warning: This page is deprecated.
Starting with Kodi v18 "Leia", Kodi's build guides are kept alongside the code, where it is much easier to keep them up-to-date with current code.

This guide will show you how to compile XBMC for Ubuntu.

We currently recommend Ubuntu Precise(12.04) or later. A gfx-adapter with OpenGL acceleration is highly recommended and 24/32 bitdepth is required with OpenGL.

1 Getting the source code

Enter the following into the command line.

sudo apt-get install git-core
cd $HOME
git clone git://github.com/xbmc/xbmc.git xbmc

2 Installing the required Ubuntu packages

Two methods exist to install the required Ubuntu packages:

Note: For supported old Ubuntu versions, some packages might be outdated. For those, you can either compile them manually, or use our backports available from our official stable PPA: http://launchpad.net/~team-xbmc/+archive/ppa

2.1 Use a single command to get all build dependencies

Note: Supported on ubuntu >= 11.10 (oneiric)

You can get all build dependencies used for building the packages on the PPA

Add the unstable and build-depends PPAs:

sudo apt-get install python-software-properties software-properties-common
sudo add-apt-repository ppa:team-xbmc/unstable
sudo add-apt-repository ppa:team-xbmc/xbmc-ppa-build-depends
sudo apt-get update

Here is the magic command to get the build dependencies (used to compile the version on the PPA).

sudo apt-get build-dep xbmc

Note: Avoid using "aptitude" for the build-dep command. It doesn't resolve everything.

Optional: If you do not want xbmc to be installed via PPA, you can removed the PPAs again:

sudo add-apt-repository -r ppa:team-xbmc/unstable
sudo add-apt-repository -r ppa:team-xbmc/xbmc-ppa-build-depends

For developers and anyone else who compiles frequently it is recommended to use ccache

sudo apt-get install ccache

A tip for those with multiple computers at home is to check out distcc (totally unsupported from xbmc of course)

sudo apt-get install distcc

2.2 Alternative: Manual dependency installation

For Ubuntu (all versions >= 7.04):

sudo apt-get install automake autopoint bison build-essential ccache cmake curl cvs default-jre fp-compiler gawk gdc gettext git-core gperf libasound2-dev libass-dev libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbluetooth-dev libbluray-dev libbluray1 libboost-dev libboost-thread-dev libbz2-dev libcap-dev libcdio-dev libcec-dev libcec1 libcrystalhd-dev libcrystalhd3 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 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 libshairport-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

For >= 10.10:

sudo apt-get install autopoint libltdl-dev

On 8.10 and older versions, libcurl is outdated and thus XBMC will not compile properly. In this case you will have to manually compile the latest version.

wget http://curl.sourceforge.net/download/curl-7.19.7.tar.gz
tar -xzf curl-7.19.7.tar.gz
cd curl-7.19.7
./configure --disable-ipv6 --without-libidn --disable-ldap --prefix=/usr
sudo make install

For >= 12.10

sudo apt-get install libtag1-dev

For <= 12.04.

We need a new version of taglib than what is available. We supply a Makefile in lib/taglib to make it easy to install into /usr/local.
sudo apt-get remove libtag1-dev
make -C lib/taglib
sudo make -C lib/taglib install

Unless you are proficient with how linux libraries and versions work, do not try to provide it yourself, as you will likely mess up for other programs.

3 How to compile

To create the XBMC executable manually perform these steps:

  • A full listing of supported options can be viewed by typing ./configure --help
  • By adding -j<number> to the make command, you describe how many concurrent jobs will be used. So for dualcore the command is: make -j2
  • You may need to run this with sudo (sudo make install) if your user doesn't have write permissions to the prefix you have provided (as in the default case, /usr/local).

Enter the following into the command line
cd $HOME/xbmc/
make install

This will install XBMC in the prefix provided in 4.1 as well as a launcher script.

To override the location that XBMC is installed, use PREFIX=<path>. For example:

make install DESTDIR=$HOME/xbmc

3.1 Test Suite

XBMC has a test suite which uses the Google C++ Testing Framework. The framework is provided directly in XBMC's source tree and has very little requirements in order to build and run. See the README file for the framework at 'lib/gtest/README' for specific requirements.

To compile and run XBMC's test suite, the configure option '--enable-gtest' has to be explicitely set during the configure stage. Once configured, to build the testsuite, type the following.

make check

To compile the test suite without running it, type the following.

make testsuite

The test suite program can be run manually as well. The name of the test suite program is 'xbmc-test' and will build in the XBMC source tree. To bring up the 'help' notes for the program, type the following.

./xbmc-test --gtest_help

The most useful options are,

List the names of all tests instead of running them. The name of TEST(Foo, Bar) is "Foo.Bar".
Run only the tests whose name matches one of the positive patterns but none of the negative patterns. '?' matches any single character; '*' matches any substring; ':' separates two patterns.

Note: If the '--enable-gtest' option is not set during the configure stage, the make targets 'check,' 'testsuite,' and 'testframework' will simply show a message saying the framework has not been configured, and then silently succeed (i.e. it will not return an error).

4 How to run

How to run xbmc depends on the type of installation you have done. It is possible to run XBMC without the requirement to install xbmc anywhere else. In this case, type the following from the top source directory.


If you chose to install XBMC using '/usr' or '/usr/local' as the PREFIX, you can just issue 'xbmc' in a teminal session.

If you overridden PREFIX to install XBMC into some non-standard location, you will have to run xbmc by directly running 'xbmc.bin'. For example.


5 Uninstalling

sudo apt-get remove xbmc*

Issue "make uninstall" ("sudo make uninstall" if you user doesn't have write permission to the install directory) from your source tree. If you would like to also remove any settings and 3rd party addons (skins, scripts, etc) you should also run rm -rf ~/.xbmc

Note: If you have rerun configure with a different prefix, you will either need to rerun configure with the correct prefix for this step to work correctly.

6 See also