Tags

, , ,

/* */ Last update: May 23, 2012

As we have more and more questions for support on how to install Amarok 2.x 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 15: May 23rd 2012 Added information for Gentoo builds.

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
    • alternatively: layman -a kde && emerge -avt --autounmask=y --autounmask-write=y =amrok-9999

  • In OpenSuSE:

    • sudo zypper install git

  • In Fedora:

    • sudo yum install git kdelibs-devel

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 (or create the file if you don’t have one)

  • 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

For Fedora users, it is

  • yum-builddep amarok

Note: you must of course install the devel versions of these packages!
Important:if you previously had Amarok 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)

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

5.2. Changes for mysqld in Kubuntu Oneiric and Debian Sid:

Mysqlclient was moved in these distros with the arrival of mysql 5.5, so mysql_config no longer reports mysql_pic. To correct this you need to patch a few files. Find below the patch by Jonathan Riddell:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4241e69..41b3412 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -957,7 +957,7 @@ if(KDE4_BUILD_TESTS)
endif()

if( NOT BUILD_MYSQLE_COLLECTION )
– target_link_libraries(amaroklib ${MYSQL_LIBRARIES} ${ZLIB_LIBRARIES})
+ target_link_libraries(amaroklib ${MYSQL_LIBRARIES} -L/usr/lib/mysql ${ZLIB_LIBRARIES})
endif( NOT BUILD_MYSQLE_COLLECTION )

if(WIN32)
diff –git a/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt b/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt
index 7218d54..07c5b6e 100644
— a/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt
+++ b/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt
@@ -36,6 +36,7 @@ target_link_libraries(amarok_collection-mysqlecollection
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${MYSQL_EMBEDDED_LIBRARIES}
+ -L/usr/lib/mysql
${CMAKE_DL_LIBS}
${ZLIB_LIBRARIES}
)
diff –git a/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt b/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt
index 3312e14..72196ae 100644
— a/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt
+++ b/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt
@@ -36,6 +36,7 @@ target_link_libraries(amarok_collection-mysqlservercollection
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${MYSQL_LIBRARIES}
+ -L/usr/lib/mysql
${CMAKE_DL_LIBS}
${ZLIB_LIBRARIES}
)

To apply the patch, save it as a kubuntu_mysqld_pic.diff, go tho the amarok/ directory in your git checkout (see section 7 below) and type the following:

patch -p1 < kubuntu_mysqld_pic.diff

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.x 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 --rebase option. 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 eventually 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

=-=-=-=-=
Powered by Blogilo

Advertisements