After struggling couple of days in finding the best way to build XBMC on Raspberry PI I have finally got a working solution(haven't discovered how I can cross-compile it, which would be the best choice).
This takes about 15 hours, on my Raspberry PI model B, but the good news is that 'make' takes about 12 hours, so you don't need to watch it, just come from time to time to see if it is working. Besides the build messages displayed on screen you have the whole logs for rbp_depends, configure, make and make install steps. If anything goes wrong you can investigate these files(the last one reached) and search for the first error
log_1_rbp_depends.logThis tutorial is for Linux Host Machine but it can be easily adapted to any other OS.
log_2_configure.log
log_3_make.log
log_4_make_install.log
Let's get this started!
1. Get the latest Raspbian Wheezy image from http://www.raspberrypi.org/downloads and put it on an SD card:
You have couple of possibilities to do this. In Linux you can use:
sudo dd bs=1M if=raspbian_wheezy_image_path of=/dev/sd_card_path2. Get XBMC 12 source code from http://xbmc.org/download/. On the Source Code section, download the zip file from where it says: "Stable release sources are available here".
If you get the code from git it will probably get an unstable version, which is the latest code. When I have build from source I have got XBMC 13 alpha 1 which worked, but no addon was working.
Transfer xbmc folder to your /home/pi/ directory or wherever you like.
Now you can plug the card in Raspberry PI and follow the next steps.
Note. The easiest way to do this is via ssh(first, enable it using sudo raspi-config menu), from a computer. Just connect in Terminal using:
ssh pi@x.x.x.xwhere x.x.x.x is the ip address of your device. You can get the ip address by typing ifconfig. Then you just copy/paste the commands into Terminal.
3. Set minimum amount of video memory and create a swap partition:
sudo raspi-config
Here you should expand_rootfs, disable overscan, configure_keyboard, change_pass, change_timezone and enable ssh. Select memory_split and enter 16 then restart.
Now, to create a swap partition, use the following:
dd if=/dev/zero of=/home/pi/swapfile1 bs=1024 count=204800
sudo mkswap /home/pi/swapfile1
sudo chown root:root /home/pi/swapfile1
sudo chmod 0600 /home/pi/swapfile1
sudo swapon /home/pi/swapfile1
The swap file is needed as extra memory for the compiler. This will prevent you from getting errors like:
gcc: internal compiler error: Killed (program cc1)
sudo apt-get updateThis will take some time depending on your internet speed.
sudo apt-get upgrade
sudo apt-get install autotools-dev comerr-dev dpkg-dev libalsaplayer-dev libapt-pkg-dev:armhf libasound2-dev libass-dev:armhf libatk1.0-dev libavahi-client-dev libavahi-common-dev libavcodec-dev libavformat-dev libavutil-dev libbison-dev:armhf libbluray-dev:armhf libboost1.49-dev \
libbz2-dev:armhf libc-dev-bin libc6-dev:armhf libcaca-dev libcairo2-dev libcdio-dev libclalsadrv-dev libcrypto++-dev libcups2-dev libcurl3-gnutls-dev \
libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev libdrm-dev libegl1-mesa-dev libelf-dev libenca-dev libept-dev libevent-dev libexpat1-dev libflac-dev:armhf \
libfontconfig1-dev libfreetype6-dev libfribidi-dev libgconf2-dev libgcrypt11-dev libgdk-pixbuf2.0-dev libgl1-mesa-dev libgles2-mesa-dev \
libglew-dev:armhf libglewmx-dev:armhf libglib2.0-dev libglu1-mesa-dev libgnome-keyring-dev libgnutls-dev libgpg-error-dev libgtk2.0-dev libhal-dev \
libhunspell-dev:armhf libice-dev:armhf libicu-dev libidn11-dev libiso9660-dev libjasper-dev libjbig-dev:armhf libjconv-dev libjpeg8-dev:armhf libkrb5-dev \
libldap2-dev:armhf libltdl-dev:armhf liblzo2-dev libmad0-dev libmicrohttpd-dev libmodplug-dev libmp3lame-dev:armhf libmpeg2-4-dev libmysqlclient-dev \
libncurses5-dev libnspr4-dev libnss3-dev libogg-dev:armhf libopenal-dev:armhf libp11-kit-dev libpam0g-dev:armhf libpango1.0-dev libpcre++-dev libpcre3-dev \
libpixman-1-dev libpng12-dev libprotobuf-dev libpthread-stubs0-dev:armhf libpulse-dev:armhf librtmp-dev libsamplerate0-dev:armhf \
libsdl-image1.2-dev:armhf libsdl1.2-dev libslang2-dev:armhf libsm-dev:armhf libsmbclient-dev:armhf libspeex-dev:armhf \
libsqlite3-dev libssh-dev libssh2-1-dev libssl-dev libstdc++6-4.6-dev libtagcoll2-dev libtasn1-3-dev libtiff4-dev libtinfo-dev:armhf libtinyxml-dev \
libts-dev:armhf libudev-dev libv8-dev libva-dev:armhf libvdpau-dev:armhf libvorbis-dev:armhf libvpx-dev:armhf libwebp-dev:armhf libwibble-dev \
libx11-dev:armhf libx11-xcb-dev libxapian-dev libxau-dev:armhf libxcb-glx0-dev:armhf libxcb-render0-dev:armhf libxcb-shm0-dev:armhf \
libxcb1-dev:armhf libxcomposite-dev libxcursor-dev:armhf libxdamage-dev libxdmcp-dev:armhf libxext-dev:armhf libxfixes-dev libxft-dev libxi-dev \
libxinerama-dev:armhf libxml2-dev:armhf libxmu-dev:armhf libxrandr-dev libxrender-dev:armhf libxslt1-dev libxss-dev:armhf libxt-dev:armhf \
libxtst-dev:armhf libxxf86vm-dev libyajl-dev libzip-dev linux-libc-dev:armhf lzma-dev mesa-common-dev python-dev python2.7-dev x11proto-composite-dev \
x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev \
x11proto-record-dev x11proto-render-dev x11proto-scrnsaver-dev x11proto-xext-dev x11proto-xf86vidmode-dev x11proto-xinerama-dev xtrans-dev \
libnfs-dev libplist-dev avahi-daemon zlib1g-dev:armhf swig java-package libafpclient-dev liblockdev1-dev autoconf automake libtool gcc udev openjdk-6-jre \
cmake g++ libudev-dev build-essential autoconf ccache gawk gperf mesa-utils zip unzip curl
5. Copy libraries headers and create some symlinks for libraries:
sudo cp -R /opt/vc/include/* /usr/includeThere is a problem when compiling, with the file /usr/include/interface/vmcs_host/vcgencmd.h which includes the wrong vchost_config.h, so I have created a command to put the right inclusion:
sudo cp /opt/vc/include/interface/vcos/pthreads/* /usr/include/interface/vcos
sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/libEGL.so
sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so
sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1
sudo ln -fs /opt/vc/lib/libEGL_static.a /usr/lib/libEGL_static.a
sudo ln -fs /opt/vc/lib/libEGL_static.a /usr/lib/arm-linux-gnueabihf/libEGL_static.a
sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/libGLESv2.so
sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so
sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2
sudo ln -fs /opt/vc/lib/libGLESv2_static.a /usr/lib/libGLESv2_static.a
sudo ln -fs /opt/vc/lib/libGLESv2_static.a /usr/lib/arm-linux-gnueabihf/libGLESv2_static.a
sudo ln -fs /opt/vc/lib/libbcm_host.so /usr/lib/libbcm_host.so
sudo ln -fs /opt/vc/lib/libbcm_host.so /usr/lib/arm-linux-gnueabihf/libbcm_host.so
sudo ln -fs /opt/vc/lib/libvchiq_arm.a /usr/lib/libvchiq_arm.a
sudo ln -fs /opt/vc/lib/libvchiq_arm.a /usr/lib/arm-linux-gnueabihf/libvchiq_arm.a
sudo ln -fs /opt/vc/lib/libvchiq_arm.so /usr/lib/libvchiq_arm.so
sudo ln -fs /opt/vc/lib/libvchiq_arm.so /usr/lib/arm-linux-gnueabihf/libvchiq_arm.so
sudo ln -fs /opt/vc/lib/libvcos.a /usr/lib/libvcos.a
sudo ln -fs /opt/vc/lib/libvcos.a /usr/lib/arm-linux-gnueabihf/libvcos.a
sudo ln -fs /opt/vc/lib/libvcos.so /usr/lib/libvcos.so
sudo ln -fs /opt/vc/lib/libvcos.so /usr/lib/arm-linux-gnueabihf/libvcos.so
sudo sed -i 's/#include "vchost_config.h"/#include "linux\/vchost_config.h"/' /usr/include/interface/vmcs_host/vcgencmd.h6. Install taglib, libcec and libshairport.
cd <pah_to_xbmc_dir>7. Configure and compile XBMC
make -C lib/taglib
sudo make -C lib/taglib install
cd <any_directory>
git clone --depth 5 https://github.com/Pulse-Eight/libcec.git
cd libcec
./bootstrap
./configure --prefix=/usr/local
make
sudo make install
cd <path_to_xbmc_dir>
make -C lib/libshairport
sudo make -C lib/libshairport install
cd <path_to_xbmc_dir>Fix some errors:
export TARGET_SUBARCH="armv6zk"
export TARGET_CPU="arm1176jzf-s"
export TARGET_FLOAT="hard"
export TARGET_FPU="vfp"
export TARGET_FPU_FLAGS="-mfloat-abi=$TARGET_FLOAT -mfpu=$TARGET_FPU"
export TARGET_EXTRA_FLAGS="-Wno-psabi -Wa,-mno-warn-deprecated"
export TARGET_COPT="-Wall -pipe -fomit-frame-pointer -O3 -fexcess-precision=fast -ffast-math -fgnu89-inline"
export TARGET_LOPT="-s -Wl,--as-needed"
export CFLAGS="-march=$TARGET_SUBARCH -mcpu=$TARGET_CPU $TARGET_FPU_FLAGS -mabi=aapcs-linux $TARGET_COPT $TARGET_EXTRA_FLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-march=$TARGET_SUBARCH -mtune=$TARGET_CPU $TARGET_LOPT"
sed -i 's/USE_BUILDROOT=1/USE_BUILDROOT=0/' tools/rbp/setup-sdk.shRun:
sed -i 's/TOOLCHAIN=\/usr\/local\/bcm-gcc/TOOLCHAIN=\/usr/' tools/rbp/setup-sdk.sh
sudo sh tools/rbp/setup-sdk.shFix other errors:
sed -i 's/cd $(SOURCE); $(CONFIGURE)/#cd $(SOURCE); $(CONFIGURE)/' tools/rbp/depends/xbmc/MakefileRun:
make -C tools/rbp/depends/xbmc/ 2>&1 | tee log_1_rbp_depends.logConfigure:
./configure --prefix=/usr/local --build=arm-linux-gnueabihf \After configuration completes, please run he following command:
--host=arm-linux-gnueabihf --localstatedir=/var/lib \
--with-platform=raspberry-pi --disable-gl --enable-gles \
--disable-x11 --disable-sdl --enable-ccache --enable-optimizations \
--disable-external-libraries --disable-goom --disable-hal \
--disable-pulse --disable-vaapi --disable-vdpau --disable-xrandr \
--enable-airplay --disable-alsa --enable-avahi --enable-libbluray \
--enable-dvdcss --disable-debug --disable-joystick --disable-mid \
--enable-nfs --disable-profiling --disable-projectm --enable-rsxs \
--enable-rtmp --disable-vaapi --disable-vdadecoder \
--disable-external-ffmpeg --enable-optical-drive \
--enable-player=omxplayer 2>&1 | tee log_2_configure.log
sed -i 's/ifeq (1,1)/ifeq (0,1)/' tools/TexturePacker/MakefileCompile(this will take about 12 hours):
make 2>&1 | tee log_3_make.log8. Install XBMC 12 in Raspbian.
sudo make install 2>&1 | tee log_4_make_install.logAfter this step you have to run raspi-config again and to set video memory to 128 and then restart. Now you should be able to run XBMC using
/usr/local/lib/xbmc/xbmc.binNote: If you are running via xbmc command, or from XFCE menu->Multimedia->XBMC it will not start. The same command can be used to run XBMC from terminal or from XFCE interface.
In addition you can also install PVR Addons and XVDR addon(but this is not necessary):
cd <any_directory>Note
git clone --depth 5 git://github.com/opdenkamp/xbmc-pvr-addons.git
cd xbmc-pvr-addons/
./bootstrap
./configure --prefix=/usr/local --enable-addons-with-dependencies
sudo make install
cd <any_directory>
git clone git://github.com/pipelka/xbmc-addon-xvdr.git
cd xbmc-addon-xvdr
sh autogen.sh
./configure --prefix=/usr/local
sudo make install
If you want to modify sources after the compilation is completed, you just have to modify them and then run make again, which will build only the affected parts(couple of minutes), but remember to keep the video memory at maximum 32MB when you are building, and also keep the swap partition.
Many thanks to:
- XBIAN forums
- http://www.raspbian.org/RaspbianXBMC (mpthompson)