Software Systems

Links
  • Home
  • Products
  • Downloads
  • Tools
  • About us
  • SwsSock
  • SwsMtc
  • ScUtil
  • SimUtil
  • SwsVpkt
  • SoundFX
  • NetCenturion
  • MythTV

MythTV

MythTV is a Free Open Source software digital video recorder (DVR) project distributed under the terms of the GNU GPL.

Step by step guide to building MythTV

This guide will explain the steps involved in building MythTV and its dependant libraries on Linux and Windows. These steps are automated in our build script which is recommended for normal use.

Build script problems

If the build script encounters an error then the first step is to identify the package and file causing the error. Run the script again as follows:

./mythbuild.sh -l -j1

This will record the actions in mythbuild.log and force make to run just one job at a time, making the source of the error more obvious.

The most frequent package to break is the most complex - Qt. Often this is due to incompatible packages having been installed on the system. Most problems can be worked around by supplying extra parameters to the package's configure script. To find out what can be changed:

cd mythbuild/<package> && ./configure --help

Additional configure parameters can then be passed to the package thus:

QT_CFG="-no-iconv" ./mythbuild.sh

See mythbuild.sh -h for a list of shell variables that can be used to control the build process.

If this doesn't help then see below for specific information on configuring and building the problematic package.

Build Tools

You will need to install the following tools:

  • make
  • gcc
  • patch
  • wget
  • git
  • unzip

And these if you are cross compiling to Windows:

  • mingw
  • zip

On a Linux system this can be achieved using a package manager like apt-get, yum, rpm etc. If you are building on Windows with the MSys environment then these tools will have already been installed.

It is highly recommended that you download this build script to automate the build process. If you want to do the build manually then open a terminal and type:

mkdir myth && cd myth
export DIR=$PWD

Fixing Mingw

Mingw is only needed to cross compile to Windows. If you are not cross compiling then skip to the next section.

The current mingw32 distribution (4.2.1) has an error in the float.h system header which results in some missing FPU control calls while compiling the Qt library. This bug was reported in January 2010 to Nokia here and in June 2010 to the Mingw bug tracker here. Unfortunately the issue is still unresolved so pragmatically it needs a patch:

sudo patch -p0 < mingw-4.2.1.diff

This needs to be done as root since the files are read only for other users.

NB different Linux distros ship subtly different mingw packages:

  • Ubuntu names the C compiler i586-mingw32msvc-gcc and puts <float.h> in /usr/i586-mingw32msvc/include
  • Mandriva names the C compiler i586-pc-mingw32-gcc and puts <float.h> in /usr/i586-pc-mingw32/sys-root/mingw/include
  • Fedora names the C compiler i686-pc-mingw32-gcc and puts <float.h> in /usr/i686-pc-mingw32/sys-root/mingw/include

So you may need to edit the patch to suit and use a different prefix for the following cross-compilations.

Install pthread

Only needed for Windows builds.

cd $DIR
wget ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz
tar -zxf pthreads-w32-2-8-0-release.tar.gz && cd pthreads-w32-2-8-0-release

Pthread needs a small patch to compile with MythTV:

patch -p1 < ../pthreads-w32-2-8-0-release.diff

This problem was first reported in 2008 and there's a fix in the cvs repo apparently.

make -f GNUmakefile CROSS=i586-mingw32msvc- clean GC
cp -p libpthreadGC2.a $DIR/lib/
cp -p pthreadGC2.dll $DIR/bin/
cp -p pthread.h sched.h semaphore.h $DIR/include/

Install zlib

Only needed for Windows builds.

cd $DIR
wget http://mesh.dl.sourceforge.net/project/libpng/zlib/1.2.5/zlib-1.2.5.tar.gz
tar -zxf zlib-1.2.5.tar.gz && cd zlib-1.2.5
make -f win32/Makefile.gcc PREFIX=i586-mingw32msvc- SHARED_MODE=1 IMPLIB=libz.dll.a
make -f win32/Makefile.gcc BINARY_PATH=$DIR/bin INCLUDE_PATH=$DIR/include LIBRARY_PATH=$DIR/lib\
 SHARED_MODE=1 IMPLIB=libz.dll.a install

NB Zlib doesn't generate a libtool description of the libz.dll so the build script creates one. This is needed by taglib.

Install freetype

cd $DIR
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.3.tar.gz
tar -zxf freetype-2.4.3.tar.gz && cd freetype-2.4.3
./configure --prefix=$DIR --host=i586-mingw32msvc --build=i686-pc-linux-gnu
make && make install

Install lame

cd $DIR
wget http://garr.dl.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
tar -zxf lame-3.98.4.tar.gz && cd lame-3.98.4
./configure --prefix=$DIR --host=i586-mingw32msvc --build=i686-pc-linux-gnu
make && make install

DirectX

MythTV needs the DirectX 9 dsound.h header which is missing from mingw32. A useful alternative can be found in the Wine project.

cd $DIR
wget http://switch.dl.sourceforge.net/project/wine/Source/wine-1.3.6.tar.bz2
tar -jxf wine-1.3.6.tar.bz2
cp -p wine-1.3.6/include/dsound.h include/

The file dsound.h needs a small patch because it depends upon some Wine macros:

patch -p0 < wine-1.3.6.diff

Aside: The old DirectX 8 SDK for MinGW can be downloaded from here. dsound.h can then be used as-is by:

unzip -d dx80 dx80_mgw.zip
cp -p dx80/include/dsound.h include/

However, I recommend using the Wine version because it's DirectX 9 compatible and that's what MythTV expects.

Install libexif

This is only needed by the mythgallery plugin.

cd $DIR
wget http://mesh.dl.sourceforge.net/project/libexif/libexif/0.6.19/libexif-0.6.19.tar.bz2
tar -jxf libexif-0.6.19.tar.bz2 && cd libexif-0.6.19
./configure --prefix=$DIR --host=i586-mingw32msvc --build=i686-pc-linux-gnu
make && make install

Install libogg

This is only needed by the mythmusic plugin.

cd $DIR
wget http://downloads.xiph.org/releases/ogg/libogg-1.2.1.tar.bz2
tar -jxf libogg-1.2.1.tar.bz2 && cd libogg-1.2.1
./configure --prefix=$DIR --host=i586-mingw32msvc --build=i686-pc-linux-gnu
make && make install

Install libvorbis

This is only needed by the mythmusic plugin.

cd $DIR
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
tar -jxf libvorbis-1.3.2.tar.bz2 && cd libvorbis-1.3.2
PKG_CONFIG_PATH=$DIR/lib/pkgconfig ./configure --prefix=$DIR \
 --host=i586-mingw32msvc --build=i686-pc-linux-gnu
make && make install

Install flac

This is only needed by the mythmusic plugin.

cd $DIR
wget http://mesh.dl.sourceforge.net/project/flac/flac-src/flac-1.2.1-src/flac-1.2.1.tar.gz
tar -zxf flac-1.2.1.tar.gz && cd flac-1.2.1

A small patch needs to be applied to include/share/alloc.h to allow it to build with mingw32 gcc 4.2.1-sjlj:

patch -p1 < ../flac-1.2.1.diff

This bug was reported to the flac bug-tracker in January 2010 but still remains unresolved.

PKG_CONFIG_PATH=$DIR/lib/pkgconfig \
 ./configure --prefix=$DIR --host=i586-mingw32msvc --build=i686-pc-linux-gnu --disable-cpplib
make && make install

Install libcdio

This is only needed by the mythmusic plugin.

cd $DIR
wget ftp://mirror.cict.fr/gnu/libcdio/libcdio-0.82.tar.gz
tar -jxf libcdio-0.82.tar.bz2 && cd libcdio-0.82-1.3.2
./configure --prefix=$DIR --host=i586-mingw32msvc --build=i686-pc-linux-gnu --disable-joliet
make && make install

Install taglib

This is only needed by the mythmusic plugin.

cd $DIR
wget http://developer.kde.org/~wheeler/files/src/taglib-1.5.tar.gz
tar -zxf taglib-1.5.tar.gz && cd taglib-1.5
CPPFLAGS="-I$DIR/include" LDFLAGS="-L$DIR/lib" PKG_CONFIG_PATH=$DIR/lib/pkgconfig\
 ./configure --prefix=$DIR --host=i586-mingw32msvc --build=i686-pc-linux-gnu
make && make install

Install MySQL

A pre-built MySQL for Win32 can be downloaded directly:

cd $DIR
wget ftp://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-5.0/mysql-noinstall-5.0.89-win32.zip
unzip -a mysql-noinstall-5.0.89-win32.zip
MYSQL=$DIR/mysql-5.0.89-win32

Fix include/mysql.h to compile with mingw32

cd $MYSQL
patch -p1 < ../mysql-5.0.89-win32.diff

Install Qt

Qt is a BIG package and will take some time to configure and build.

cd $DIR
wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.0.tar.gz
tar -zxf qt-everywhere-opensource-src-4.7.0.tar.gz && \
  cd qt-everywhere-opensource-src-4.7.0

Apply a patch to:

  • Fix qmake building plugins with mingw and to 'distclean' linker scripts
  • Fix configure to detect the mysql library
  • Add mkspecs for cross compilation
  • Fix unresolved symbols in textcodecs for win32
patch -p1 < ../qt-4.7.0.diff

This patch has been submitted to Nokia for consideration. Next, configure Qt:

./configure -opensource \
  -prefix $DIR -xplatform win32-g++linux -fast -make "libs" -no-phonon \
  -no-sql-sqlite -no-sql-odbc -plugin-sql-mysql -I $MYSQL/include -L \
  $MYSQL/lib/opt -mysql_config true -no-reduce-exports

Build Qt. This can take some time:

make && make install && cp -p bin/qmake $DIR/bin/

NB qmake is copied to the bin directory to use in the mythtv build.

Install MythTV

cd $DIR
wget ftp://ftp.osuosl.org/pub/mythtv/mythtv-0.24.tar.bz2
tar -jxf mythtv-0.24.tar.bz2 && cd mythtv-0.24

Apply a patch to fix DirectX3d9 and OpenGL video playback:

patch -p1 < ../mythtv-0.24.diff

Configure MythTV:

PKG_CONFIG_PATH=$DIR/lib/pkgconfig PATH=$DIR/bin:$PATH ./configure \
  --prefix=$DIR --enable-cross-compile --cross-prefix=i586-mingw32msvc- \
  --target_os=mingw32 --arch=x86 --cpu=pentium3 --sysinclude=$DIR/include \
  --extra-cflags=-I$DIR/include --extra-ldflags=-L$DIR/lib \
  --qmake=$DIR/bin/qmake --disable-lirc --disable-hdhomerun \
  --disable-firewire --disable-iptv

Carefully note from the configure output that qmake is set to $DIR/bin/qmake. Now do the build:

make && make install

Install MythPlugins

cd $DIR
wget ftp://ftp.osuosl.org/pub/mythtv/mythplugins-0.24.tar.bz2
tar -jxf mythplugins-0.24.tar.bz2 && cd mythplugins-0.24

Apply a patch to the configure script to fix cross compilation and to fix mythmusic and mythgallery operation on Windows.

patch -p1 < ../mythplugins-0.24.diff

Configure the plugins:

PKG_CONFIG_PATH=$DIR/lib/pkgconfig PATH=$DIR/bin:$PATH ./configure \
  --prefix=$DIR --sysroot=$DIR --cross-prefix=i586-mingw32msvc- \
  --targetos=MINGW32 --qmake=$DIR/bin/qmake --enable-all \
  --disable-mytharchive --disable-mythnews --disable-mythweather \
  --disable-mythzoneminder --disable-mythnetvision --disable-sdl --disable-dcraw

NB some plugins are disabled because:

  • mythnews, mythweather & mythnetvision require a debug build of Qt.
  • mythzoneminder needs the Linux header sys/shm.h
  • mytharchive requires the POSIX kill() function

NB It is suggested that dcraw support is disabled unless it is actually installed on the system as the runtime overhead can slowdown the display of thumbnails.

Now do the build:

make && make install
PayPal sucks


Get Ubuntu
 Copyright © 2010-2011 Software Systems - All rights reserved.