Compiling Amarok from git locally – full summary updated

/* */ As we have more and more questions for support on how to install Amarok 2.2 from GIT, I thought I might make another synopsis on how to install a local build. Apparently linking to previous posts is not very useful because people tend not to read the links…

Warning: please do not try this if you are not comfortable with compiling from sources, and be aware that compiling from a development branch can break a few things!

Note: as I use Kubuntu, this is heavily biased, but there are a few indications for other distributions, as far as those have been provided by the previous bloggers. Thanks go to Mark Kretschmann who started that adventure and wrote the first instructions, to Stephan Jau who wrote an excellent How-to for the SVN version for Kubuntu users and to David Faure who corrected some of our settings. And, of course, all the Amarok Team who do a tremendous job every single day :)

This document explains how to install Amarok 2 from GIT in your home directory – in an easy way :-)

Update 1:October 12th 2009 I updated a few things since the first edition, in particular the README content in section 5 and adapted it to the upcoming Karmic Koala aka Kubuntu 9.10 (remember, I am biased)

Update 2:April 4th 2010 Updated the library path settings in section 3, added information for OpenSuSE users, additional information for code contributors, now building on Lucid Lynx aka Kubuntu 10.04 beta, still biased :)

Important Update 3: June 19th 2010 The git repository has changed in section 7! it should be enough to replace the “gitorious.org” part of the line with “git.kde.org” in your .git/config file. Alternatively just make a new checkout (don’t forget to erase the previous build folder, too).

Update 4: July 3th 2010 Changes in section 5.1: added a new devel package which is a MySQL dependency. It only showed up after a few changes made in the code. Make sure to install this and run a clean build (erasing the build folder and run cmake again).

Update 5: October 3rd 2010 Changes in section 5: New optional dependency for Musicbrainz and AmpliFIND support as well as the ffmpeg libraries. Don’t forget to run a clean build, as always when new dependencies are added.

Update 6: October 6th 2010 Final move of the git repository, please see section 7. You can simply change the URL in the config file located in $HOME/kde/src/amarok/.git/

Update 7: October 23rd 2010 Updating section 5: Amarok now depends on KDE 4.4 and Qt 4.6 as well as libmtp 1.0.0

Update 8: November 30th 2010 Updating section 1: Sadly, Debian Sid and Kubuntu Maverick do not ship the kde-devel metapackage anymore, so I added a list of the packages needed.

Update 9: February 5th 2011 Updating section 7: Please use only anongit to pull. It’s enough to change the URL in the git config dialog, see also update 6.

Update 10: March 20th 2011 Updating section 5: Added new optional dependencies for the Playdar and Gpodder dependencies.

Update 11: December 6th 2011 Updated requiements for libmygpo-qt-dev to version 1.0.5 If you already have an Amarok 2.x version installed from your distro, un-install it to prevent setting conflicts and similar. You will need the kdelibs and kdebase-runtime from KDE 4.4 or higher. Please see also the minimal requirements and mandatory dependencies in section 5.

Update 12, January 26th 2012 Updated requirements in section 5.

1.Install git, the compiler and KDE 4 development packages:

  • In Kubuntu, Debian, and all their derivatives:
    • sudo aptitude install git-core build-essential kde-devel

    Since Kubuntu 10.10, the kde-devel metapackage does not exist anymore. You will need to add these packages to the above installation line now: * kdesdk * kdelibs5-dev * libkonq5-dev * kdebase-workspace-dev As well as a basic KDE installation, formerly provided by the now defunct kde-minimal metapackage: * kdebase-runtime * kdebase-workspace * kdebase-apps * plasma-desktop I also highly recommend to install the oxygen-icon-theme and oxygen-icon-theme-complete, so you don’t have missing icons if you do not run KDE.

  • In Archlinux:
    • sudo pacman -Sy git base-devel kdelibs kdebase-runtime
  • In Gentoo:
    • sudo emerge -av dev-util/git kdelibs plasma-workspace
  • In OpenSuSE:
    • sudo zypper install git

2. Install ccache to speed up compilation

ccache is a very nice tool that can speed up your compilation. It speeds up re-compilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again. Install the package from your distribution and set the size of the cache to 2 GB with the command

ccache -M 2G

This will take 2Gb of space in your local directory, but the gain of time is really impressive. Enable the use of ccache by adding it to your local .bashrc, described in step 3 below:

3. Define the PATH and local environment

  • Append the following to $HOME/.bashrc:
  • export PATH=$HOME/kde/bin:$PATH
  • export PATH=/usr/lib/ccache:$PATH
  • export LD_LIBRARY_PATH=$HOME/kde/lib:$LD_LIBRARY_PATH
  • Reload your edited .bashrc:
  • source $HOME/.bashrc

NOTE: if you are not using the bash shell, edit your proper shell config file (~/.zshrc or ~/.tcshrc or whatever it may be).

4. Make KDE aware of Amarok’s plugin location:

  • echo 'export KDEDIR=$HOME/kde' >> $HOME/.kde/env/myenv.sh
  • echo 'export KDEDIRS=$KDEDIR' >> $HOME/.kde/env/myenv.sh

Beware, some distributions call the above folder $HOME/.kde4/… (OpenSuSE in particular).

5. Make sure you have all the necessary dependencies

The README file in the source states the required and optional dependencies, but I might as well write it down here, so there is no other document to be read for the lazy ones. Of course, before diving into compiling from source, check if those dependencies are available in the package repository of your distro :)
For the lazy, there is a quite easy way to get all the necessary dependencies for amarok by using the build-dep command. Activate the source repositories in your /etc/apt/sources.list, then type sudo apt-get build-dep amarok For OpenSuSE users this would be sudo zypper si -d amarok
Note: you must of course install the devel versions of these packages!
Important:if you previously had Amarok 2.2.x installed from your distribution, you already have all the dependencies, you only need the corresponding devel versions. Those are all provided by your distribution as well.

Required

  • MySQL 5.0 (or newer) Embedded: libmysqld compiled with fPIC (In-process database support)
    Note:If you have installed MySQL Embedded in non-default location (i.e. $HOME/usr), Amarok may fail to start with error regarding libmysqlclient library. In this case, add the following string to your ~/.bashrc:
    export LD_LIBRARY_PATH=$HOME/usr/lib/mysql:$LD_LIBRARY_PATH where $HOME/usr is the path you will use in the --prefix option when compiling (see step 7. below)
  • LibQCA 2.0.2 or newer (Qt Cryptographic Architecture)

Optional

  • MySQL 5.0 (or newer) Server (external database support)
  • ffmpeg 0.6.0 or higher (Libraries and tools for handling multimedia data and transcoding)
    • http://www.ffmpeg.orgFor all supported encoders to be available in Amarok, FFmpeg needs to support the following codecs:
      • libfaac (NOT just “aac”)
      • alac
      • flac
      • libmp3lame (NOT just “mp3″)
      • libvorbis (NOT just “vorbis”)
      • wmav2

    Note: Since there is no ffmpeg-dev or libffmpeg-dev package in Debian/Kubuntu, you need to install libavcodec-dev and libavformat-dev, those are the ffmpeg libraries needed.

5.1.Various dependencies that might cause compile errors and have to be installed:

(these are rather specific to Kubuntu, might have other names in other distributions and/or are already installed)

  • libstrigiqtdbusclient-dev
  • libsearchclient-dev
  • libmysqlclient
  • libmysqlclient-dev
  • libmysqld-dev
  • libmysqld-pic
  • libwrap0-dev, needed as a dependency for MySQL. For OpenSuSE users, the package to install is tcpd-devel

6. Create folders:

  • mkdir $HOME/kde
  • mkdir $HOME/kde/src
  • mkdir $HOME/kde/build
  • mkdir $HOME/kde/build/amarok

7. Checking out and Building:

Now you need a source checkout from git.kde.org. In the folder ~/kde/src/, type the following command:

git clone git://anongit.kde.org/amarok.git

this will drag approx. 55-60Mb of data, depending on the moment you actually make this checkout. Everything is now ready to build:

  • cd $HOME/kde/build/amarok
  • cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/amarok
  • make install

8. Updating KDE Config:

  • kbuildsycoca4 --noincremental

Note: this might not be necessary for most of the cases Now you are ready to run Amarok 2, by typing “amarok” in the shell. We strongly recommend you run amarok with the -d and –nofork option, so you will have debugging enabled and can get a valid backtrace if Amarok crashes.

9. Updating your Amarok build:

Since the development is quite fast with git, you should update your Amarok build regularly, and a daily checkout is not too much. This is made easy with the following command:

  • cd $HOME/kde/src/amarok
  • git pull

This will update your local git branch. If you have done modifications to your local branch you would like to keep, make sure you update with the --rebaseoption. See also the git tutorial for KDE in section 10. You can now simply build again with

  • cd $HOME/kde/build/amarok
  • make install

Since you have installed ccache, a full build will speed up over time. To have an idea about the build time, just type time make install when building. If you have several CPU cores, you can speed up even more with the -j[n] option, where [n] is the number of CPU cores +1. Of course, the more CPU you use for building, the less you will have available for other tasks :)

10. More information and useful links

Don’t forget: running a development version also means that it is not stable and can break anytime ! This is especially true after a feature freeze, when the developers merge their personal git branches to the master branch. Note: To be notified about major changes you definitely should subscribe to our mailing list amarok@kde.org at https://mail.kde.org/mailman/listinfo/amarok. Of course you will also find help in our #amarok channel on irc.freenode.net, but reading the mailing list is mandatory and spares us a lot of time. Since you don’t want to repeat all this completely when you upgrade to a newer version of your preferred distribution, you should consider installing your /home directory on a separate partition from the start, it will spare you quite some time and hassle in the future.

Edit: Casper van Donderen just pointed me to the possibility to have the latest Amarok from git on Windows, too: if you build KDE using the emerge system, just type emerge amarok at the kdeenv command prompt. Thanks for the hint, Casper!

11. Important information for code contributors

Amarok uses a unit test infrastructure that allows us to test the builds. If you consider contributing code to Amarok, you need to install Google Mock and you should build Amarok with the following cmake flag: KDE4_BUILD_TESTS=ON For more information about the test infrastructure, read the Qtestlib Manual Please also see the instructions for the git configuration if you have push rights in this link

This entry was posted in Amarok, Free Software, Freedom, FSFE, Git, KDE, Kubuntu and tagged , , , . Bookmark the permalink.

8 Responses to Compiling Amarok from git locally – full summary updated

  1. ban1 says:

    Nice to have this guide. I think that’s it’s pretty easy to follow it. Anyway I’m on kubuntu and a great way to follow amarok development are the amarok-nightly builds from project neon. Using it is really newbie-proof but right now the build is failing from some days. Being in the amarok team and using kubuntu maybe you know how to fix those builds or who to contact about them.

    • myriam says:

      You should ask on the Neon mailing list then, I am not really familiar with it. I would guess it is because the new taglib and taglib-extras packages are not yet in the Neon KDE packages. This is a very new dependency, but it solves a lot of taglib related problems.

  2. Cyrille Berger says:

    Hi,
    I think there is a typo “Install ccmake to speed up compilation” shouldn’t it be ccache ?

    • myriam says:

      Thanks for spotting this, Cyrille, I must have done an automatic replace when spell checking. Of course this makes more sense :)

  3. Milian Wolff says:

    Afaik prepending /usr/lib/ccache is not enough to use it. You also need to set some symlinks, at least that’s what I get from the manual:

    See “Installation” section on:
    http://ccache.samba.org/ccache-man.html

  4. Pingback: Tweets that mention Compiling Amarok from git locally - full summary « Myriam’s blog -- Topsy.com

  5. Pingback: Norbert Evenich (evenorbert) 's status on Saturday, 26-Sep-09 20:15:56 UTC - Identi.ca