From MythTV Official Wiki
Revision as of 13:11, 3 November 2009 by GBee (talk | contribs) (moved Myth On NSLU2 to MythTV On NSLU2)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here is a explanation about compiling and running mythtv on a slug (aka nslu2) and howto setup a crosscompiler to reduce compile time whith distcc.

Setup cross compiling environment

Building GCC for ARM

First, on a powerfull computer running linux we need to setup a crosscompiler to speed up further compilations : download crosstool from

# tar zxf crosstool-0.43.tar.gz
# cd crosstool-0.43
# edit arm.dat to change : TARGET=arm-linux-gnu

On the slug, the version of gcc is : 4.1.2. This version (0.43) allow you to try build any version of gcc, but not all works. By default, the version built for arm is 4.1.0, so we are going to tell it to build the same version as we have on our slug : 4.1.2 Create a file called : gcc-4.1.2-glibc-2.3.2-tls.dat and put in :

Script.png gcc-4.1.2-glibc-2.3.2-tls.dat

GLIBC_EXTRA_CONFIG="$GLIBC_EXTRA_CONFIG --with-tls --with-__thread  --enable-kernel=2.4.18"

edit and changed the following variables to :



add the following line juste before the last out and comment out the other line beginning by "eval"


#eval `cat arm.dat gcc-4.1.0-glibc-2.3.2-tls.dat` sh --notest
eval `cat arm.dat gcc-4.1.2-glibc-2.3.2-tls.dat` sh --notest

next run :

# ./

It takes about 1 hour on a Athlon XP 2200+.

The crosscompiler has been generated in $HOME/crosstool/arm/gcc-4.1.2-glibc-2.3.2/arm-linux-gnu

Errors during crosstool build

IF you happen to get errors during your build of crosstool...

Error: configure complains that gcc is too old or missing:

glibc is VERY picky about which compiler compiles it. You may have gcc-4.2 and glibc won't allow that, just because.

To fix:

  • We also need to modify a patch to allow 4.2+ gcc compilers.
 edit patches/glibc-2.3.2/glibc-2.3.3-allow-gcc-4.0-configure.patch
 # Change the line
 '+    3.[2-9]*|4.[01]*)' to
 '+    3.[2-9]*|4.[012]*)'

With thanks to: [1]

Error: Missing Terminating " character

Somewhere in the configure process, the Makefile generated with errors and when that file (version-info.h) is used, this error is caught during the make process:

 version-info.h:3: error: missing terminating " character

To fix:

  • create a patch file (versioninfo.patch) in crosstool-0.43/patches/glibc-2.3.2 with contents:

Script.png versioninfo.patch

--- glib-2.3.2/csu/Makefile.orig        2008-12-05 16:34:43.000000000 +0100
+++ glib-2.3.2/csu/Makefile     2008-12-05 16:38:20.000000000 +0100
@@ -223,12 +223,12 @@
                     os=Linux; \
                   fi; \
                   echo "\"Compiled on a $$os $$version system" \
-                       "on `date +%Y-%m-%d`.\\n\"" ;; \
+                       "on `date +%Y-%m-%d`.\"\\n" ;; \
           *) ;; \
         esac; \
         files="$(all-Banner-files)";                           \
         if test -n "$$files"; then                             \
-          echo "\"Available extensions:\\n\"";                 \
+          echo "\"Available extensions:\"\\n";                 \
           sed -e '/^#/d' -e 's/^[[:space:]]*/  /'              \
               -e 's/\(^.*$$\)/\"\1\\n\"/' $$files;             \
         fi) > $@T

With thanks to: [2]

Finding and solving these 2 problems took me almost a day. Hopefully, this information has helped you save some time and frustration! Andrew 17:57, 5 December 2008 (UTC)

Install and setup DISTCC

As root :

# apt-get install distcc

edit /etc/default/distcc and adjust the settings

Script.png /etc/default/distcc


edit /etc/init.d/distcc in order to add the crosscompiler to the path :

Script.png /etc/init.d/distcc


restart distcc daemon :

# /etc/init.d/distcc stop
# /etc/init.d/distcc start

Compilation on the slug

Prerequisitory : building and installing some libs and programs

The following assume that you have :

  1. debian etch
  2. a swap already configured

As root : add the following in /etc/apt/sources.list :

Script.png /etc/apt/sources.list

deb-src etch main

install some libs and programs

# apt-get update
# apt-get install make qt3-dev-tools libqt3-mt-dev libqt3-mt libqt3-mt-mysql mysql-server distcc gcc-4.1 g++-4.1 dpkg-dev build-essential

take a break, it is long

we need to disable distccd at boot as we don't need it

# update-rc.d -f distcc remove

as a regular user, setup some environnements variables :

# export CC="distcc arm-linux-gnu-gcc"
# export CXX="distcc arm-linux-gnu-g++"

setup the host we want to do the crosscompilation, I just add my powerfull computer on which crosstool has been ran :

# export DISTCC_HOSTS="tux"

now building lame as mythtv refuse to compile whithout it :

# cd /usr/src
# mkdir lame
# cd lame

as root :

# apt-get build-dep lame

as a normal user :

# apt-get -b source lame

as root :

# dpkg -i liblame-dev_3.97-0.0_arm.deb liblame0_3.97-0.0_arm.deb

Compiling Mythtv

as a regular user, setup some environnements variables :

# export CC="distcc arm-linux-gnu-gcc"
# export CXX="distcc arm-linux-gnu-g++"

setup the host we want to do the crosscompilation, I just add my powerfull computer on which crosstool has been ran :

# export DISTCC_HOSTS="tux"

get the latest version of mythtv 0.20-fixes

# cd mythtv-0.20-fixes

apply the patch as explained in next compile mythtv :

# ./configure --prefix=/usr
# make -j4

It takes about 2 hours. Sometimes, gcc may segfault. I didn't find where it comes from. Just run again

# make -j4

when the compilation is finished, as root :

# make install

Setup the database

Setup the root password

# /usr/bin/mysqladmin -u root password 'enter-your-good-new-password-here'
# mysql -p
# mysql> CREATE DATABASE mythconverg;
# mysql> CREATE USER mythtv IDENTIFIED BY 'mythtv';
# mysql> GRANT ALL ON mythconverg.* TO mythtv@localhost;

Setup password for mythtv

# su mythtv
# mysql
# mysql> set password = password("mythtv");

next, we need to run mythtv-setup. The little difficultie is that our slug don't have any X running. As we are connected throug ssh, we can export the display of the slug to another computer. On the powerfull computer is X : open a terminal ant type :

# xhost +

on the slug as a normal user :

# export DISPLAY=<ip of the powerfull computer>:0.0
# mythtv-setup

Et voila ! Now you can setup yout slug as a master backend.