How To Compile Amarok 2 From SVN On K/X/Ubuntu

Author: Stephan Jau Revision: v1.1 Last Change: April 13 2009

Introduction

Amarok is a pretty nifty, versatile and advanced music player for the KDE desktop. However the current version in the *buntu 8.10 repos is hopelessly outdated and (IMHO) totally bugged. There's also the Amarok Neon Project, which aims at providing daily SVN builds for *buntu however lately they have not been updated. So, if you want to be up-to-date with latest Amarok development you either wait until the Neon Project provides binaries again or you compile it on your own. If you want to compile it on your own, you require KDE 4.2. There are also PPA repos for that, use my generator http://repogen.simplylinux.ch to get the according info.

The following howto will feature a few more things than are necessary. I like especially to add the medibuntu repos so that together with kubuntu-restricted-extras I have codecs for just about everyting. The package I install from medibuntu in this howto is the w32codecs (or w64codecs if you are on a 64bit OS).

I tested this howto on a vanilla Kubuntu 8.10 install. Depending on how you modified your system over time you will need to adjust a few things.

Thanks goes to markey and mamarok in the #amarok channel in irc.freenode.org. Also the groundwork for this howto are the following two pages:
http://amarok.kde.org/blog/archives/833-Installing-Amarok-2-from-SVN-in-your-home-directory.html
http://amarok.kde.org/wiki/Development/MySQL_Embedded

 

Jaunty Users

For Jaunty users there are three minor differences that need to be regarded. I have listed them below:

Step 1: The "amarok-engine-xine" packages is not installed by default on Jaunty. So it must not/can't be purged.
Step 13: You don't have to patch the qtscriptgenerator sources (but you can).
Step 16: Before you start amarok, reboot your system otherwiese you'll get an error with regard to the collection.

I tested this on a vanilla Kubuntu Jaunty 9.04 Beta install in VmWare Workstation 6.5 and I did log the whole installation process. You can also download the log from here. The extracted log file is 2.5 MB in size and contains over 30,000 lines.

 

Step 1: Remove current amarok installation

sudo apt-get purge amarok amarok-common amarok-engine-xine

Instead of "purge" you can also use "remove". The difference is that purge will delete config and user data files (e.g. your statistics and stuff) - you may want to make a backup first.

 

Step 2: Update your sources.list

You can use my repo generator: http://repogen.simplylinux.ch. It's important that you select the "main, restricted, universe, multiverse" branches, the "security, updates, proposed, backports" updates and the "KDE 4.2 PPA, Medibuntu" 3rd party repos. Medibuntu isn't required but it's recommended.

That should generate a list like this:

#############################################################
################### OFFICIAL UBUNTU REPOS ###################
#############################################################

###### Ubuntu Main Repos
deb http://ch.archive.ubuntu.com/ubuntu/ intrepid main restricted universe multiverse

###### Ubuntu Update Repos
deb http://ch.archive.ubuntu.com/ubuntu/ intrepid-security main restricted universe multiverse
deb http://ch.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted universe multiverse
deb http://ch.archive.ubuntu.com/ubuntu/ intrepid-proposed main restricted universe multiverse
deb http://ch.archive.ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu intrepid partner

##############################################################
##################### UNOFFICIAL  REPOS ######################
##############################################################

###### 3rd Party Binary Repos

#### KDE 4.2 PPA Repos - http://www.kubuntu.org/news/kde-4.2
## Run this command: gpg --keyserver keyserver.ubuntu.com --recv-keys 493B3065 && gpg --export -a 493B3065 | sudo apt-key add -
deb http://ppa.launchpad.net/kubuntu-experimental/ubuntu intrepid main

#### Medibuntu - http://www.medibuntu.org/
## Run this command: sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
deb http://packages.medibuntu.org/ intrepid free non-free

Replace your /etc/apt/sources.list with this list above (or your own) or add the missing parts to it.

Finally you just need to import that gpg keys to get rid of the error message that would appear otherwise:

gpg --keyserver keyserver.ubuntu.com --recv-keys 493B3065 && gpg --export -a 493B3065 | sudo apt-key add -
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update

 

Step 3: Upgrade

After you added the KDE 4.2 repos you need to upgrade your system:

sudo apt-get dist-upgrade

And then remove the obsolete dependencies (not necessary but recommended):

sudo apt-get autoremove

 

Step 4: Reboot

Reboot your system:

sudo reboot

 

Step 5: Install the required packages

Now install the required packages. If you're on 64-bit then use the w64codecs package instead of the w32codecs one:

sudo apt-get install kubuntu-restricted-extras w32codecs build-essential kde-devel subversion libmysqlclient15-dev libncurses5-dev libtag1-dev libstrigiqtdbusclient-dev

 

Step 6: Extend your .bashrc and myenv.sh

You need to extend your .bashrc and myenv.sh files with a few things. Just run those commands:

KDE Users use this:

echo '' >> ${HOME}/.bashrc
echo 'export PATH=$HOME/kde/bin:$PATH' >> ${HOME}/.bashrc
mkdir -p ${HOME}/.kde/env
echo 'export KDEDIR=$HOME/kde' >> ${HOME}/.kde/env/myenv.sh
echo 'export KDEDIRS=$KDEDIR' >> ${HOME}/.kde/env/myenv.sh

Non-KDE Users use this:

echo '' >> ${HOME}/.bashrc
echo 'export PATH=$HOME/kde/bin:$PATH' >> ${HOME}/.bashrc
echo 'export KDEDIR=$HOME/kde' >> ${HOME}/.bashrc
echo 'export KDEDIRS=$KDEDIR' >> ${HOME}/.bashrc

And verify whether those were really added:

cat ${HOME}/.bashrc
cat ${HOME}/.kde/env/myenv.sh

If you're a non-KDE user, then only issue the first of those two commands

 

Step 7: Reload your .bashrc

Reload your .bashrc:

source ${HOME}/.bashrc

 

Step 8: Created required folders

Create the required folders:

mkdir -p ${HOME}/kde/src
mkdir -p ${HOME}/kde/build/amarok

 

Step 9: Download amarok and taglib-extras by svn

Download Amarok and taglib-extras by issuing these commands:

cd ${HOME}/kde/src
svn co svn://anonsvn.kde.org/home/kde/trunk/extragear/multimedia/amarok amarok
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib-extras/ taglib-extras

At the time I did this I checked out revision 942886.

 

Step 10: Download MySQL

MySQL is now integrated in Amarok 2 directly, this means we require the source for it. You can download MySQL here http://dev.mysql.com/downloads/mysql/5.1.html#source (select the tar.gz version). The current version is 5.1.32 and for the next commands to be correct you need to change the version number accordingly if you use a newer one. If you opt to manually download MySQL then download it to: ${HOME}/kde/src

Or you can just follow those commands below to get the MySQL source into the proper place:

cd ${HOME}/kde/src
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.32.tar.gz/from/http://mirror.switch.ch/ftp/mirror/mysql/

 

Step 11: Extract and compile MySQL

As said before, if you use a different version, you need to alter the version number in the following steps:

tar xzvf mysql-5.1.32.tar.gz
cd mysql-5.1.32
cp -R ${HOME}/kde/src/amarok/supplementary_scripts/mysqle/* .

In case you got a multicore cpu or more cpus then you can change the number of cores to be used to compile. If you have a dual core then set the option below to "-j3". If you have a quadcore set it to "-j5". In rare cases there are problems by using multicore; if that's the case then just set it to "-j1":

export MAKEOPTS=-j2

Now you can compile MySQL:

./build-mysqle.sh --prefix=${HOME}/usr

 

Step 12: compile taglib-extras

This has lately been moved out of the amarok svn and needs to be compiled on its own. Run the following steps:

cd ${HOME}/kde/src/taglib-extras/
mkdir build
cd build
export LD_LIBRARY_PATH=${HOME}/kde/build/taglib-extras/taglib-extras
cmake -DCMAKE_INSTALL_PREFIX=${HOME}/kde ..
make
make install

 

Step 13: Compile QtScriptGenerator

This is another part that was recently moved out of the amarok svn and there are still a few issues with it. Just run the code below or download newer versions at http://code.google.com/p/qtscriptgenerator/downloads/list :

cd ${HOME}/kde/src
wget http://qtscriptgenerator.googlecode.com/files/qtscriptgenerator-src-0.1.0.tar.gz
tar xfvz qtscriptgenerator-src-0.1.0.tar.gz
cd qtscriptgenerator-src-0.1.0

The current version 0.1.0 has a few issues with *buntu. Because of that you need to patch it by running the following from the qtscriptgenerator-0.1.0 directory:

nano include_everything.patch

And add this code to it:

--- b/generator/qtscript_masterinclude.h    2009-03-21 20:37:30.719523909 -0400
+++ a/generator/qtscript_masterinclude.h    2009-03-21 21:00:25.108149339 -0400
@@ -31,17 +31,41 @@
 #include <QtUiTools/QtUiTools>
-#ifndef QT_NO_XMLPATTERNS
-#  include <QtXmlPatterns/QtXmlPatterns>
-#endif
-
-#ifndef QT_NO_WEBKIT
-#  include <QtWebKit/QtWebKit>
-#endif
-
-#ifndef QT_NO_PHONON
-#  include <phonon/phonon>
-#endif
+#include <QtXmlPatterns/QtXmlPatterns>
+
+#include <QtWebKit/QtWebKit>
+
+#include "phonon/abstractaudiooutput.h"
+#include "phonon/abstractmediastream.h"
+#include "phonon/abstractvideooutput.h"
+#include "phonon/addoninterface.h"
+#include "phonon/audiooutput.h"
+#include "phonon/audiooutputinterface.h"
+#include "phonon/backendcapabilities.h"
+#include "phonon/backendinterface.h"
+#include "phonon/effect.h"
+#include "phonon/effectinterface.h"
+#include "phonon/effectparameter.h"
+#include "phonon/effectwidget.h"
+#include "phonon/mediacontroller.h"
+#include "phonon/medianode.h"
+#include "phonon/mediaobject.h"
+#include "phonon/mediaobjectinterface.h"
+#include "phonon/mediasource.h"
+#include "phonon/objectdescription.h"
+#include "phonon/objectdescriptionmodel.h"
+#include "phonon/path.h"
+#include "phonon/phonondefs.h"
+#include "phonon/phononnamespace.h"
+#include "phonon/platformplugin.h"
+#include "phonon/seekslider.h"
+#include "phonon/streaminterface.h"
+#include "phonon/videoplayer.h"
+#include "phonon/videowidget.h"
+#include "phonon/videowidgetinterface.h"
+#include "phonon/volumefadereffect.h"
+#include "phonon/volumefaderinterface.h"
+#include "phonon/volumeslider.h"
 #include "../qtbindings/qtscript_core/qtscriptconcurrent.h"

Now run the following command to patch the source:

patch -p1 < include_everything.patch

Once you've done that, you can compile qtscriptgenerator and the plugings by running the following:

export INCLUDE=/usr/include/qt4
cd generator
qmake
make
./generator
cd ../qtbindings
qmake
make

Once you're done you'll need to copy the plugins to /usr/lib/qt4/plugins/script:

cd ../plugins/script
sudo cp -R * /usr/lib/qt4/plugins/script/

 

Step 14: Compile Amarok 2

Finally we've reached the point where we can compile Amarok 2:

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

After the cmake you will get a few warnings but compiling and installation should go without errors.

 

Step 15: Update KDE config

Now you need to update the KDE config:

kbuildsycoca4 --noincremental

 

Step 16: Run Amarok 2

Finally you can run Amarok 2 by issuing the following command in the terminal (eventually you need to logout of your session and back login to it). I have yet to find a way to start it from the menu.:

amarok

Share this page:

6 Comment(s)

Add comment

Comments

From: Anonymous

In kde 4.3 svn - jaunty beta I've resolved qtscript  dependencies using this command, before compiling amarok from svn:

export QTSCRIPTS=/usr/lib/qt4/plugins/script

From: dimsuz

Solution to fix qtscriptgenerator linking problem when using KDE built from svn on Debian (testing in my case):

If while building a qtbindings from qtscriptgenerator, you have a link error like "ld: can't find -lphonon", try removing a line "QT += phonon" from qtbindings/qtscript_phonon/qtscript_phonon.pro

 That worked for me :)

From: bigfun

worked for me on sidux (debian based)

From: cerr

Hi There,

I have some problems applying the patch, I get this:

 [email protected]:~/kde/src/qtscriptgenerator-src-0.1.0$ patch -p1 < include_everything.patch
patching file generator/qtscript_masterinclude.h
Hunk #1 FAILED at 31.
1 out of 1 hunk FAILED -- saving rejects to file generator/qtscript_masterinclude.h.rej
[email protected]:~/kde/src/qtscriptgenerator-src-0.1.0$

 

Any clue why that is?

Thanks!

Ron

From: raceboyer

I know this may be unorthodox, but I just went into qtbindings.pro and deleted the line for phonon, and bang, after 4 or 5 days of trying patches, and adjustments to code, it finally compiled and I'm using it right now. No ill effects so far. I figured why not, none of the other things worked for me...

From: justen

Run kmenuedit from the command line (you may have to install it first). Find the Amarok entry under Multimedia (or create a new one if none is present). In the options, change Command to: [code]~/kde/bin/amarok %U[/code]

 You will now be able to launch Amarok from Kickoff, use the Open With context menu to play music in Amarok, etc. as usual.