Archive:Compile Kodi on Fedora/Red Hat/CentOS

From Official Kodi Wiki
Jump to navigation Jump to search
Home icon grey.png   ▶ Development ▶ Compiling ▶ CentOS
Cleanup.png This page or section may require cleanup, updating, spellchecking, reformatting and/or updated images. Please improve this page if you can. The discussion page may contain suggestions.


This is a tutorial on how to install XBMC on Fedora 8 and higher & CentOS 5.2

(RPM Fusion does provide XBMC binaries for Fedora and CentOS 6.)

Tested versions

  • Fedora 20 + Helix (14.2) (by Dajomas)
  • Fedora 20 + Isengard (15a01) (by Dajomas)
  • Fedora 20 + Isengard (15b01) (by Dajomas)
  • Fedora 20 + Jarvis (16.0) (by Dajomas)
  • Fedora 21 (Workstation) + Helix (14.2) (by Dajomas)
  • Fedora 21 (Workstation) + Isengard (15a01) (by Dajomas)
  • Fedora 21 (Workstation) + Isengard (15b01) (by Dajomas)
I ran these test on initial clean installs of the various Fedora version. Each subsequent build was done on the same (unaltered) install -- Dajomas (talk) 15:55, 21 March 2015 (EDT)

Get the latest sources

Via git

git clone git://github.com/xbmc/xbmc.git
XBMC=xbmc

Via download

wget https://github.com/xbmc/xbmc/archive/master.zip
unzip master.zip
XBMC=xbmc-master

This may download a version you did not intend to download. Check the file version.txt to see if the file you downloaded contains the version you want to build. If this is not the case, please visit https://github.com/xbmc/xbmc/releases and download the correct zip file from there. When the downloaded zip file is extracted, assign the newly created directory name to the XBMC variable. For instance, when you download and extract the file

https://github.com/xbmc/xbmc/archive/14.2rc1-Helix.zip

The base directory is xbmc-14.2rc1-Helix so you will assign this directory name to the XBMC variable as follows:

XBMC=xbmc-14.2rc1-Helix

Install Packages

Fedora 8-17

sudo rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
sudo rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

Fedora 18-current

 sudo yum localinstall -y --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

CentOS 5 (32)

sudo rpm -Uvh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

CentOS 5 (64)

sudo rpm -Uvh http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Cut & Paste Fun

For Fedora 18 and higher:

 sudo yum -y install \
 afpfs-ng-devel alsa-lib-devel autoconf autogen-libopts \
 automake avahi-devel bluez-libs-devel boost-atomic boost-chrono \
 boost-context boost-devel boost-filesystem boost-graph boost-iostreams \
 boost-locale boost-math boost-program-options boost-python boost-random \
 boost-regex boost-serialization boost-signals boost-test boost-timer \
 boost-wave bzip2-devel cairo-devel cmake cpp dbus-devel enca-devel \
 expat-devel faac-devel faad2-devel faad2-libs flac-devel \
 fontconfig-devel freetype-devel fribidi-devel gcc gcc-c++ \
 gettext-common-devel gettext-devel git glew-devel glib2-devel \
 glibc-devel glibc-headers gl-manpages gnutls-c++ gnutls-devel gperf \
 harfbuzz-devel jasper-devel java kernel-headers keyutils-libs-devel \
 krb5-devel lame-devel lame-libs libass-devel libbluray-devel \
 libcap-devel libcdio-devel libcom_err-devel libcrystalhd-devel libcurl-devel \
 libdca-devel libdrm-devel libgcrypt-devel libGLEW libGLEWmx \
 libgpg-error-devel libICE-devel libicu-devel libjpeg-turbo-devel \
 libmad-devel libmicrohttpd-devel libmikmod libmms-devel \
 libmodplug-devel libmp4v2 libmpc libmpeg2-devel libogg-devel \
 libplist-devel libpng-devel librtmp-devel \
 libsamplerate-devel libselinux-devel libsepol-devel libsmbclient-devel \
 libSM-devel libssh-devel libstdc++-devel libtasn1-devel \
 libtiff-devel libtool libusb-devel libusbx-devel libva-devel \
 libvdpau-devel libverto-devel libvorbis-devel libX11-devel libXau-devel \
 libxcb-devel libXdamage-devel libXext-devel libXfixes-devel libXft-devel \
 libXi-devel libXinerama-devel libxml2-devel libXmu-devel libXrandr-devel \
 libXrender-devel libXScrnSaver-devel libXt-devel libXtst-devel \
 libXxf86vm-devel lzma-sdk457 lzo-devel lzo-minilzo m4 mariadb \
 mariadb-devel mariadb-libs mesa-libEGL-devel mesa-libGL-devel \
 mesa-libGLES-devel mesa-libGLU-devel openssl-devel \
 p11-kit-devel pango-devel patch pcre-devel perl-autodie perl-B-Lint \
 perl-Business-ISBN perl-Business-ISBN-Data perl-CGI perl-Class-ISA \
 perl-Compress-Raw-Bzip2 perl-Compress-Raw-Zlib perl-CPAN perl-Data-Dumper \
 perl-devel perl-Digest perl-Digest-MD5 perl-Digest-SHA perl-Encode-Locale \
 perl-Error perl-ExtUtils-Install perl-ExtUtils-MakeMaker \
 perl-ExtUtils-Manifest perl-ExtUtils-ParseXS perl-FCGI perl-File-CheckTree \
 perl-File-Listing perl-Git perl-HTML-Parser perl-HTML-Tagset \
 perl-HTTP-Cookies perl-HTTP-Daemon perl-HTTP-Date perl-HTTP-Message \
 perl-HTTP-Negotiate perl-HTTP-Tiny perl-IO-Compress perl-IO-HTML \
 perl-IO-Socket-IP perl-IO-Socket-SSL perl-libwww-perl perl-Locale-Codes \
 perl-LWP-MediaTypes perl-Module-Pluggable perl-Net-HTTP perl-Net-LibIDN \
 perl-Net-SSLeay perl-parent perl-Pod-Checker perl-Pod-LaTeX perl-podlators \
 perl-Pod-Parser perl-Pod-Perldoc perl-Pod-Plainer perl-Pod-Usage \
 perl-Sys-Syslog perl-TermReadKey perl-Test-Harness perl-Test-Simple \
 perl-Text-ParseWords perl-Text-Soundex perl-Text-Unidecode perl-Thread-Queue \
 perl-TimeDate perl-URI perl-WWW-RobotRules perl-XML-LibXML \
 perl-XML-NamespaceSupport perl-XML-SAX perl-XML-SAX-Base physfs pixman-devel \
 python-devel redhat-lsb redhat-lsb-core redhat-lsb-cxx redhat-lsb-desktop \
 redhat-lsb-languages redhat-lsb-printing redhat-lsb-submod-multimedia \
 redhat-lsb-submod-security SDL2-devel SDL2_image-devel \
 SDL-devel SDL_gfx-devel SDL_image-devel SDL_mixer-devel SDL_net-devel \
 SDL_Pango-devel SDL_sound-devel SDL-static SDL_ttf-devel \
 spax sqlite-devel swig systemtap-sdt-devel taglib-devel \
 tinyxml-devel tre-devel vala wavpack-devel xorg-x11-proto-devel \
 xz-devel yajl-devel zlib-devel \
 libxslt libxslt-devel yasm yasm-devel trousers trousers-devel doxygen

I have noticed that the dependecy checking might give some problems so another way of installing all these RPM's (not as neat but effective) is:

 for RPM in <PUT THE LIST OF RPM's TO INSTALL HERE>
 do
    sudo yum install -y ${RPM}
 done

For previous Fedora releases:

sudo yum -y install SDL* glew glew-devel libmad-devel tre tre-devel libogg libogg-devel libvorbis libvorbis-devel boost \
boost-devel bzip2-devel bzip2-libs fribidi* lzo lzo-devel mysql-libs mysql-devel jasper jasper-devel faac faac-devel \
enca enca-devel hal hal-devel hal-libs cmake gperf nasm libXmu-devel fontconfig-devel freetype-devel libXinerama-devel \
pcre-devel gcc-c++ sqlite-devel curl-devel mysql-devel libcdio-devel libmms-devel faad2-devel flac-devel libsmbclient-devel \
libXtst-devel libsamplerate-devel libtiff-devel pulseaudio-libs-devel avahi-devel wavpack-devel libmpeg2-devel libtool \
libmicrohttpd-devel libmodplug-devel redhat-lsb expat-devel gettext-devel python-devel libass-devel bluez-libs-devel \
libssh-devel yajl-devel tinyxml-devel libcap-devel afpfs-ng-devel taglib-devel libplist-devel
  • Added the "libass-devel" package. This package is needed for subtitles.
  • Added the "python-devel taglib-devel libplist-devel" package. This package is essential.
  • Added the "bluez-libs-devel" package to supply libbluetooth
  • Added the "gettext-devel" package. This package is needed for autopoint.

Otherwise you get this error:

Can't exec "autopoint": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 345.
autoreconf: failed to run autopoint: No such file or directory
autoreconf: autopoint is needed because this package uses Gettext

If you are wanting to include support for VDPAU or VDAAP you must install the devel packages for these to be included in the compilation process, same goes for bluray support: Packages include

sudo yum -y install libvdpau-devel libva-devel libbluray-devel

other development packages that are useful are

sudo yum -y install libdca-devel   # for DTS support
sudo yum -y install librtmp-devel  # for rtmp streaming support
sudo yum -y install lame-devel     # for mp3 encoding support using lame

Not sure if it is required but I also install the libraries for good measure.

Build instructions for libnfs to add NFS support:

wget https://github.com/downloads/sahlberg/libnfs/libnfs-1.3.0.tar.gz
tar -xzf libnfs-1.3.0.tar.gz
cd libnfs-1.3.0
./bootstrap
./configure
make
sudo make install
su -c 'echo /usr/local/lib > /etc/ld.so.conf.d/local-libs.conf'
sudo ldconfig
cd ..

If you're running CentOS, you need to remove the version of taglib that's available in your repositories and compile the latest version. Follow the steps here.

Build JsonSchemaBuilder

To prevent errors with regards to JsonSchemaBuilder during the building of Kodi, run the following commands from the XBMC/Kodi base directory:

$ make -C tools/depends/native/JsonSchemaBuilder/
$ sudo cp tools/depends/native/JsonSchemaBuilder/bin/JsonSchemaBuilder /usr/local/bin
$ sudo chmod 775 /usr/local/bin/JsonSchemaBuilder

Additional steps for 16.0 Jarvis

These steps need to be taken before the config command is executed. Make sure the PREFIX used in these steps is the same as used in the configure command.

$ sudo yum install -y libuuid-devel
$ PREFIX="/usr/local" # You could also make this /opt/kodi for instance. Whatever you like
$ sudo make -C ./tools/depends/target/libdcadec PREFIX=${PREFIX}
$ sudo make -C ./tools/depends/target/crossguid PREFIX=${PREFIX}
$ export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
$ export CFLAGS="$CFLAGS -I${PREFIX}/include"
$ export CXXFLAGS="$CFLAGS -I${PREFIX}/include" # Not sure if this is correct or if the CFLAGS should be CXXFLAGS but this seems to work...
$ export LDFLAGS="-L${PREFIX}/lib -lcrossguid -luuid -ldcadec"

Configure

Since there may be a bug in the afp.h file of the afpfs-ng package, you need to fix this before you build the executable. In the bug pages for this, there is a lot of finger pointing going on without a solution appearing so make sure you run the following command before you move on. The command can be run multiple times but will only make the change the first time so if there is no update, the command will not hurt. (The command will create a backup file before changing anything with the extension .BAK)

sudo sed --in-place=.BAK 's#<\(afp_protocol\|libafpclient\).h>#<afpfs-ng/\1.h>#' /usr/include/afpfs-ng/afp.h

Just to appease the configure application, you may have to show it where libmysqlclient is.

sudo ln -s /usr/lib/mysql/libmysqlclient.so.??.0.0 /usr/lib/libmysqlclient.so

Now we are ready for to build Kodi. First, run the bootstrap command:

cd ${XBMC} # XBMC=xbmc when you used git and XBMC=xbmc-master when you downloaded the ZIP file
./bootstrap

Are you going to use LIRC and a remote control? Starting with Fedora 12 the default LIRC socket file name has changed to /var/run/lirc/lircd (from /dev/lircd). You might need to provide the configure script with this parameter before compiling XBMC:

./configure --with-lirc-device=/var/run/lirc/lircd

If not, simply do

./configure

Or if you want to have XBMC/Kodi installed in an alternative directory (e.g. /opt/kodi) use

./configure --prefix=/opt/kodi

There are a lot more options available for the configure script. To see all of them use

./configure --help

With the above installed packages this should go smoothly :)

Build

make


If you recieve a compile error on Fedora 16 and higher or CentOS related to afp.h, please see the related bug ticket for a fix. On CentOS 6, afp.h is located at /usr/include/afpfs-ng/afp.h.

If XBMC fails to build for some other reason, don't worry! It may just be a temporary problem. Because people are adding new code to XBMC's master branch all the time, an update may have broken something. Read the information under "How do I obtain useful compiler output?" in this XBMC forum post to learn more about what to do in this situation.

Install

sudo make install

When this completes you are done!

For Fedora 10-12, SELinux will prevent loading of some .so files due to potential security problems. To allow the loading of these files (thats what you probably want), simply open a terminal and as sudo (or as root) execute the following commands:

sudo chcon -t textrel_shlib_t '/usr/local/share/xbmc/system/players/dvdplayer/avutil-50-i486-linux.so'
sudo chcon -t textrel_shlib_t '/usr/local/share/xbmc/system/players/dvdplayer/avcodec-52-i486-linux.so'
sudo chcon -t textrel_shlib_t '/usr/local/share/xbmc/system/players/dvdplayer/avformat-52-i486-linux.so'
sudo chcon -t textrel_shlib_t '/usr/local/share/xbmc/system/players/dvdplayer/swscale-0.6.1-i486-linux.so'

In Fedora 14 i found after compilation that xbmc was failing to run. The logs suggested that xbmc could not find libmicrohttpd.so.5 this was true as there had been a recent update to this library. XBMC should really link to libmicrohttpd.so rather than so.5 but until then a symlink does the trick

sudo ln -s /usr/lib64/libmicrohttpd.so /usr/lib64/libmicrohttpd.so.5

or replace lib64 with lib for 32 bit systems

Simply log into Gnome (or KDE) and open up a terminal and type 'kodi' (if you used a different PREFIX value you might need to type the full path) and it will load.





Fedora Kickstart File

!!! WARNING !!! This section is outdated and will try to install XBMC 9.11 from SVN on Fedora 12

Here is the kickstart file created by Cookieboy that was used to create the Fedora 12 buildslave. You can use this to do a full install with all the required packages to build XBMC from Source. This kickstart file will grab the packages from the Internet. You can modify the kickstart file to grab all the packages it can from the CDROM install and then the Net for the other packages if you would like. Cookieboy created the file with a local fedora repo rsynced down on a local network. This file has been modified to download from the public Internet.

After this kickstart file is used, in the /source folder you will find two scripts. One will download the latest CrystalHD header files to compile against, as well as a simple script to download xbmc trunk to the /source folder. Run those if you wish, and you can edit them to suit your needs. The other thing this file does, is turn on yum-updatesd and has it run every 24 hours to download any system updates so that they can be installed quickly.

To learn more about Kickstart files, visit the link here.


###########################################
### Kickstart file created by Cookieboy ###
### Created Jan 25th 2010               ###
###########################################

install
url --url http://mirrors.xmission.com/fedora/releases/12/Fedora/i386/os/
lang en_US.UTF-8
keyboard us

### Network - DHCP
network --device eth0 --bootproto dhcp

### Network - Static
#network --bootproto=static --ip=10.0.5.25 --netmask=255.255.255.0 --gateway=10.0.5.1 --nameserver=10.0.5.1 --hostname=myxbmc.mylocal.net

#rootpw rootpasshere

firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone America/Denver
bootloader --location=mbr

#################################################
### REQUIRED REPOS FOR THE YUM PACKAGES BELOW ###
#################################################

repo --name=Fedora-Everything --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-12&arch=i386
repo --name=Fedora-Updates --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f12&arch=i386
repo --name=RPMFusion-Free --mirrorlist=http://mirrors.rpmfusion.org/free/fedora/12/i386
repo --name=RPMFusion-Free-Updates --mirrorlist=http://mirrors.rpmfusion.org/free/fedora/updates/12/i386
repo --name=RPMFusion-NonFree --mirrorlist=http://mirrors.rpmfusion.org/nonfree/fedora/12/i386
repo --name=RPMFusion-NonFree-Updates --mirrorlist=http://mirrors.rpmfusion.org/nonfree/fedora/updates/12/i386


#########################
### ADD THE XBMC USER ###
#########################

user --name=xbmcuser --password=xbmcuserpass

services --disabled=acpid,anacron,atd,bluetooth,cups,firstboot,ip6tables,iptables,mdmonitor,sendmail --enable=yum-updatesd


############################
### HARDDRIVE PARTITIONS ###
############################

#  Uncomment the lines below to auto format your HD...
#clearpart --all --drives=sda
#part /boot --fstype ext4 --size=200
#part swap --size=1024
#part / --fstype ext4 --size=100 --grow


####################
### Yum Packages ###
####################

%packages

@base
@base-x
@development-tools
@xfce-desktop
kernel-devel
kernel-headers
yum-updatesd
subversion
git
gcc-c++
boost-devel
mesa-libGL-devel
glew-devel
libmad-devel
libjpeg-devel
libsamplerate-devel
libogg-devel
libvorbis-devel
freetype-devel
fontconfig-devel
bzip2-devel
fribidi-devel
sqlite-devel
mysql-devel
libpng-devel
pcre-devel
lzo-devel
libcdio-devel
libsmbclient-devel
SDL-devel
SDL_image-devel
SDL_mixer-devel
enca-devel
jasper-devel
libmms-devel
libXt-devel
libXtst-devel
libXmu-devel
libXinerama-devel
libcurl-devel
dbus-devel
hal-devel
pulseaudio-libs-devel
pulseaudio-libs-zeroconf
faac-devel
avahi-devel
ffmpeg-devel
a52dec-devel
libdca-devel
faad2-devel
mpeg2dec-devel
libass-devel
libmpcdec-devel
flac-devel
wavpack-devel
python-devel
cmake
gperf
unzip
make
libtool
flex
bison
libtiff-devel
libvdpau
nasm
libvdpau-devel
lirc
lirc-devel
e2fsprogs-devel
libdvdread-devel
tre-devel
libdvdread
tre
# Added Feb 16 2010
libmodplug-devel
libmodplug
# Added Feb 21 2010
libmicrohttpd
libmicrohttpd-devel

%end

reboot

%post

#####################################################################
### XFCE: create /etc/sysconfig/desktop (needed for installation) ###
#####################################################################

cat > /etc/sysconfig/desktop <<EOF
PREFERRED=/usr/bin/startxfce4
EOF

########################################
### Create Nesessary Changes / Setup ###
########################################

mkdir /source

################################################################
### HERE IS WHERE WE SET UP THE AUTO-LOGIN FOR THE XBMC USER ###
################################################################

cat >> /etc/gdm/custom.conf <<EOF
[daemon]
TimedLoginEnable=true
TimedLogin=xbmcuser
TimedLoginDelay=2
EOF

###############################
### make XBMC user use Xfce ###
###############################

echo "startxfce4" > /home/xbmcuser/.Xclients
chmod a+x /home/xbmcuser/.Xclients
chown xbmcuser:xbmcuser /home/xbmcuser/.Xclients

#############################
### make XBMC dep scripts ###
#############################

#########################
OUTFILE=/source/setup-xbmc-crystalhd.sh
(
cat <<'EOF'
#!/bin/sh
# This script will SVN Export the needed libraries to compile crystalHD in XBMC

### Create folders and export CrystalHD Headers
mkdir -p /usr/local/include/libcrystalhd
svn export --force https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/lib/libcrystalhd/ /usr/local/include/libcrystalhd/
EOF
) > $OUTFILE

if [ -f "$OUTFILE" ]
then
  chmod +x $OUTFILE
  # Make the generated file executable.
else
  echo "Problem in creating file: \"$OUTFILE\""
fi

###########################
OUTFILE=/source/setup-xbmc-trunk.sh
(
cat <<'EOF'
#!/bin/sh
### Check out SVN Trunk to /source/xbmc

svn co https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/ /source/xbmc/
EOF
) > $OUTFILE

if [ -f "$OUTFILE" ]
then
  chmod +x $OUTFILE
  # Make the generated file executable.
else
  echo "Problem in creating file: \"$OUTFILE\""
fi
############################


OUTFILE=

######################################################################
### Modify yum-updated to auto download any updates every 24 hours ###
######################################################################

sed -i -e 's/run_interval \= 3600/run_interval \= 86400/' /etc/yum/yum-updatesd.conf
sed -i -e 's/emit_via \= dbus/emit_via \= syslog/' /etc/yum/yum-updatesd.conf
sed -i -e 's/do_update \= no/do_update \= no/' /etc/yum/yum-updatesd.conf
sed -i -e 's/do_download \= no/do_download \= yes/' /etc/yum/yum-updatesd.conf
sed -i -e 's/do_download_deps \= no/do_download_deps \= yes/' /etc/yum/yum-updatesd.conf


%end