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

From Official Kodi Wiki
Jump to: navigation, search
m (syntaxhighlight fix)
 
Line 8: Line 8:
 
Enter the following into the command line.
 
Enter the following into the command line.
  
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get install git-core
 
sudo apt-get install git-core
 
cd $HOME
 
cd $HOME
Line 27: Line 27:
  
 
Add the unstable and build-depends PPAs:
 
Add the unstable and build-depends PPAs:
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get install python-software-properties software-properties-common
 
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/unstable
Line 36: Line 36:
  
 
Here is the magic command to get the build dependencies (used to compile the version on the PPA).
 
Here is the magic command to get the build dependencies (used to compile the version on the PPA).
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get build-dep xbmc
 
sudo apt-get build-dep xbmc
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 43: Line 43:
  
 
''Optional:'' If you do not want xbmc to be installed via PPA, you can removed the PPAs again:
 
''Optional:'' If you do not want xbmc to be installed via PPA, you can removed the PPAs again:
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo add-apt-repository -r ppa:team-xbmc/unstable
 
sudo add-apt-repository -r ppa:team-xbmc/unstable
 
sudo add-apt-repository -r ppa:team-xbmc/xbmc-ppa-build-depends
 
sudo add-apt-repository -r ppa:team-xbmc/xbmc-ppa-build-depends
Line 49: Line 49:
  
 
For developers and anyone else who compiles frequently it is recommended to use ccache
 
For developers and anyone else who compiles frequently it is recommended to use ccache
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get install ccache
 
sudo apt-get install ccache
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 55: Line 55:
  
 
A tip for those with multiple computers at home is to check out distcc (totally unsupported from xbmc of course)
 
A tip for those with multiple computers at home is to check out distcc (totally unsupported from xbmc of course)
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get install distcc
 
sudo apt-get install distcc
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 65: Line 65:
  
 
For >= 10.10:
 
For >= 10.10:
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get install autopoint libltdl-dev
 
sudo apt-get install autopoint libltdl-dev
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 71: Line 71:
  
 
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.
 
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.
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
wget http://curl.sourceforge.net/download/curl-7.19.7.tar.gz
 
wget http://curl.sourceforge.net/download/curl-7.19.7.tar.gz
 
tar -xzf curl-7.19.7.tar.gz
 
tar -xzf curl-7.19.7.tar.gz
Line 82: Line 82:
  
 
For >= 12.10
 
For >= 12.10
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get install libtag1-dev
 
sudo apt-get install libtag1-dev
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 89: Line 89:
 
For <= 12.04.
 
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.
 
: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.
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get remove libtag1-dev
 
sudo apt-get remove libtag1-dev
 
make -C lib/taglib
 
make -C lib/taglib
Line 108: Line 108:
  
 
;Enter the following into the command line
 
;Enter the following into the command line
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
cd $HOME/xbmc/
 
cd $HOME/xbmc/
 
./bootstrap
 
./bootstrap
Line 120: Line 120:
  
 
To override the location that XBMC is installed, use PREFIX=<path>. For example:  
 
To override the location that XBMC is installed, use PREFIX=<path>. For example:  
<syntaxhighlight lang="bash">make install DESTDIR=$HOME/xbmc</syntaxhighlight>
+
<syntaxhighlight lang=bash>make install DESTDIR=$HOME/xbmc</syntaxhighlight>
  
 
=== Test Suite ===
 
=== Test Suite ===
Line 128: Line 128:
 
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.
 
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.
  
<syntaxhighlight lang="bash">make check</syntaxhighlight>
+
<syntaxhighlight lang=bash>make check</syntaxhighlight>
  
  
 
To compile the test suite without running it, type the following.
 
To compile the test suite without running it, type the following.
  
<syntaxhighlight lang="bash">make testsuite</syntaxhighlight>
+
<syntaxhighlight lang=bash>make testsuite</syntaxhighlight>
  
  
 
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.
 
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.
  
<syntaxhighlight lang="bash">./xbmc-test --gtest_help</syntaxhighlight>
+
<syntaxhighlight lang=bash>./xbmc-test --gtest_help</syntaxhighlight>
  
  
Line 154: Line 154:
 
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.
 
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.
  
<syntaxhighlight lang="bash">./xbmc.bin</syntaxhighlight>
+
<syntaxhighlight lang=bash>./xbmc.bin</syntaxhighlight>
  
  
Line 162: Line 162:
 
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.
 
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.
  
<syntaxhighlight lang="bash">$HOME/xbmc/usr/share/xbmc.bin</syntaxhighlight>
+
<syntaxhighlight lang=bash>$HOME/xbmc/usr/share/xbmc.bin</syntaxhighlight>
  
 
== Uninstalling ==
 
== Uninstalling ==
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang=bash>
 
sudo apt-get remove xbmc*
 
sudo apt-get remove xbmc*
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 12:41, 10 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
make
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:

Notes
  • 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/
./bootstrap
./configure
make
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,

gtest_list_tests
List the names of all tests instead of running them. The name of TEST(Foo, Bar) is "Foo.Bar".
gtest_filter=POSTIVE_PATTERNS[-NEGATIVE_PATTERNS]
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.

./xbmc.bin


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.

$HOME/xbmc/usr/share/xbmc.bin

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