Installing MythTV SVN on Fedora

From MythTV Official Wiki
Jump to: navigation, search

Time.png Outdated: The information on this page may no longer be relevant to the current release of MythTV, 34.0. Please consider helping to update it. This page was last modified on 2011-01-18.


Important.png Note: See mythtv-rpmbuild.spec, instead.

Credits


Overview

This guide is to help users of Fedora compile MythTV using the subversion (SVN) source code, which allows them to take advantage of the latest (bleeding edge) patches to MythTV. It was originally developed with MythTV 0.19.1 and Fedora Core 4 in mind. It is more or less valid for all versions since then up to and including Fedora 9. Continued additions are welcome by users of future versions of Fedora. This document assumes you already have a working Fedora installation.

Commands shown in this guide use the standard notation for indicating which can be run as the normal user and which must be run as root: commands preceded by "#" are to be run as root, whereas those preceded by "$" are to be run as the normal user.

Install Prerequisites

Remove Old Versions

If you are upgrading to MythTV SVN from an rpm installation from ATrpms, you must first remove all of the MythTV rpms that were installed.

# yum remove \*myth\*

Repositories

In order to be able to easily install all of the dependencies needed for MythTV, you will need to have the livna repository configured and enabled. If you want to have other repositories enabled as well, such as ATrpms or freshrpms, you may, but beware that enabling more than one third-party repositories can cause problems that are very difficult to clear up. The best way to safely configure many common third-party repositories is to use the rpm provided by fedorafaq and install the yum-priorities plugin:

# yum install yum-priorities
# echo 'check_obsoletes = 1' >> /etc/yum/pluginconf.d/priorities.conf
# rpm -Uvh http://www.fedorafaq.org/f9/yum http://rpm.livna.org/livna-release-9.rpm

This will install the configuration files to many popular repositories. The yum-priorities plugin should prevent conflicting packages from being installed at the same time. If you don't trust it, the safest thing to do is to disable all of the repositories except fedora, extras, adobe-linux, and livna by going into each of the other configuration files in /etc/yum.repos.d/ and setting "enabled=0".

Important.png Note: As of 04:48, 26 May 2008 (UTC), fedorafaq still has not released a yum configuration rpm for F9. You can still continue using this guide using only the livna repository without any problems.


Information.png Tip: BEST PRACTICE is to only enable one repo at a time, and NEVER run 'yum update' or 'yum upgrade' without naming a specific package to be updated. (The exception of course, is the one-time, right-after-install 'yum update' when you have NO other repos enabled.)

Video Drivers

Many systems with NVIDIA or ATI graphics cards will require proprietary video drivers to provide smooth playback. Installing the drivers is simple if you have the livna repository enabled. For NVIDIA cards:

# yum install kmod-nvidia

Or if you have an ATI card:

# yum install kmod-fglrx

Important.png Note: The current release of Fedora 9 ships with X Server 1.4.99 which requires NVIDIA driver 173.14 or later.


Install packages

There are a number of development libraries and packages required to compile MythTV. The following commands should obtain them all:

# yum install gcc-c++ freetype-devel lame-devel qt-devel mysql-server mysql-devel lirc lirc-devel
# yum install subversion mesa-libGLU-devel libXv-devel libXxf86vm-devel libdca-devel make
# yum install libXmu-devel qt-MySQL libXvMC-devel kdelibs-devel arts-devel perl-ExtUtils-MakeMaker

(For Fedora 8 I found I wanted the package qt4-mysql rather than qt-MySQL (or in addition to it?))


Run the following commands to get most of the dependencies for MythTV's plugins:

# yum install fftw2 fftw2-devel libid3tag libid3tag-devel libmad-devel flac-devel libdvdcss-devel
# yum install libtiff-devel libcdaudio-devel SDL-devel cdparanoia-devel libexif-devel fftw3 fftw3-devel
# yum install libvorbis-devel faac faac-devel faad2 faad2-devel taglib taglib-devel libvisual-devel

If you are going to use firewire support, you need to install the following Firewire development packages:

# yum install libavc1394 libavc1394-devel libiec61883 libiec61883-devel libraw1394 libraw1394-devel

After installing the driver rpms and all of the dependent packages, you will have to reboot so that the kernel modules and paths load correctly. In fact, it appears you may need to reboot twice to get the kernel modules fully installed.

Troubleshooting

  • If your connection requires you to use a proxy server you will need to export your http_proxy value before you can use yum. This will direct yum to use the proxy to connect to outside repositories.
 # export http_proxy=http://your_proxy:8080 (or whatever your proxy port happens to be)
  • The list of packages to install may not be complete as the requirements will change as new plugins are added. To check on the dependencies, after you have downloaded the source code (see below) cd to the mythtv or mythplugins directory, and run:
  $ grep has_library configure
This will output the test code in each configure file for the required libraries for all dependencies.
  • If you get the following error message during the MythPlugins dependency installation:
Error: Missing Dependency: libid3tag = 0.15.0b is needed by package libid3tag-devel
You have a library installed that is greater than the development library available (in this case libid3tag-devel is v0.15.0b but libid3tag 0.15.1-3.b is installed). To resolve this do:
# yum remove libid3tag
then run the above yum install and it should resolve the dependencies correctly.

Install MythTV Source Code

If you haven't done so already, it may be a good idea to change the ownership on /usr/local so your main user can download source here:

# chown `whoami`.`whoami` /usr/local

Here we use subversion to obtain the latest source code:

$ cd /usr/local
$ svn co http://svn.mythtv.org/svn/trunk mythtv

Important.png Note: If you prefer to install the 0.21 fixes branch instead of trunk, point svn to http://svn.mythtv.org/svn/branches/release-0-21-fixes instead.

or, if you prefer to setup the primary components of MythTV separately:

$ cd /usr/local
$ svn co http://svn.mythtv.org/svn/trunk/mythtv
$ svn co http://svn.mythtv.org/svn/trunk/mythplugins
$ svn co http://svn.mythtv.org/svn/trunk/myththemes

The former method gives you the advantage of being able to cd to the mythtv directory and running svn update, which will update all of the subdirectories at once. It also will pull in more components including extra themes. The rest of this guide will assume that this method has been used.


Compile MythTV

The first step is to point MythTV to install at /usr/local instead of /usr just in case we already have various MythTV packages installed.

$ cd /usr/local/mythtv/mythtv
$ ./configure --prefix=/usr/local

Note: x86_64 users will have to add --libdir-name=lib64

The recommended way to enable processor optimizations is with the flag --enable-proc-opt.

Though not recommended the following flags will enable custom processor optimizations for various versions of GCC:

  • For GCC 4.1:
    • --arch=prescott for Intel Core Solo/Duo
    • --arch=nocona for Core 2 Solo/Duo
  • For GCC 4.2:
    • --arch=prescott --mtune=generic for Core Solo/Duo
    • --arch=nocona --mtune=generic for Core 2 Solo/Duo
  • GCC trunk adds support for the SSSE3 instruction set:
    • --arch=core2

Note: For GCC 4.2, try --arch=native, which will autodetect the host processor(s) and set --march and --mtune accordingly.

There are a lot of additional command line options for the configure script. A useful command line might be:

$ ./configure --prefix=/usr/local --enable-xvmc --arch=native --enable-dvb 

Use

$./configure --help 

to view all options on this command. A more complete command line script is given below in Automating the Entire Process.

To continue with the compilation, run:

$ make

Now install mythtv (you should be logged in as root to do this):

# make install

Before continuing be sure that the directory contaning the installed libraries in known by ld.so:

# echo "/usr/local/lib" >> /etc/ld.so.conf
# /sbin/ldconfig

Important.png Note: x86_64 users should echo "/usr/local/lib64" instead.

Compile MythPlugins

$ cd ../mythplugins

There is a long list of switches in the mythplugins configure file. Run ./configure --help, and determine what you wish to enable or disable. You may wish to save your command line in another file. The options change from time to time, so check whenever you update. As a minimum you need the following:

$ ./configure --prefix=/usr/local
$ make

Note: x84_64 users will have to pass --libdir-name=lib64 as well.

Then install the plugins as root:

# make install

Install MythThemes

The stock MythThemes can be installed by:

$ cd ../myththemes
$ ./configure --prefix=/usr/local
$ make

Then install the themes as root:

# make install

Similarly, the extended themes are installed by:

$ cd ../themes
$ ./configure --prefix=/usr/local
$ make

Then, as root:

# make install

Troubleshooting

  • If you get errors regarding qt-mt missing and you have qt and qt-devel installed you must 'export QTDIR=/usr/lib/qt-3.3/' (For qt 3.3 that is) or 'export QTDIR=/usr/lib64/qt-3.3' for x86_64 version. Alternatively, check for a symlink to /usr/lib/qt-3.x
# ln -s /usr/lib/qt3 /usr/lib/qt-3.x
The location on newer installs may be /usr/lib/qt-3.3
# ln -s /usr/lib/qt-3.3 /usr/lib/qt-3.x
  • If you receive an error message of something like -lrfftw not found during the MythPlugins compile, you may need to do the following:
# cd /usr/lib
# ln -s librfftw.so.2.0.7 librfftw.so
# ln -s libfftw.so.2.0.7 libfftw.so

Post-Install Configuration

Initialize Database

To start the MySQL server for this session and at every boot, issue the following commands:

# /sbin/service mysqld start
# /sbin/chkconfig --level 345 mysqld on

If this is the first time MySQL has been started, you should run the MySQL secure installation script to disable anonymous usage and to set the root password.

$ mysql_secure_installation

Finally, run MythTV's MySQL setup script to initialize the mythconverg database:

$ mysql -u root -p < /usr/local/mythtv/mythtv/database/mc.sql

Setup MythWeb

Install packages needed by MythWeb

# yum install httpd php php-mysql

The MythWeb files must be copied to Apache's http directory:

# cd /usr/local/mythtv/mythplugins/mythweb
# cp -r * /var/www/html 

Next move the configuration file to the Apache configuration directory:

#  mv /var/www/html/mythweb.conf.apache /etc/httpd/conf.d/mythweb.conf

You'll then need to make sure your web server can write to the 'data' directory in MythWeb

# chgrp -R apache /var/www/html/data
# chmod g+rw /var/www/html/data

Important.png Note: If you have SELinux enabled, you'll need to run:

# /usr/sbin/setsebool -P httpd_can_network_connect=1
# chcon -R -t httpd_sys_content_t '/var/www/html/data'

Finally start the httpd daemon for this session configure Apache to start at every boot:

# /sbin/service httpd restart
# /sbin/chkconfig --level 345 httpd on

If the backend is running you should be now able to access MythWeb.

Auto-start Mythbackend

Now we'll ensure that the mythbackend will start automatically when the PC reboots:

# cd /usr/local/mythtv/mythtv/Linux/contrib/init_scripts
# cp fedora.init.mythbackend /etc/rc.d/init.d/mythbackend
# cp fedora.sysconfig.mythbackend /etc/sysconfig/mythbackend
# /sbin/chkconfig --level 345 mythbackend on

Important.png Note: Make sure your MythTV log directory exists (/var/log/mythtv).

MythTV Configuration

You are now ready to configure your MythTV system

$ mythtv-setup

Then, as root:

# service mythbackend start

Maintaining an SVN Installation

Updating the Source Code

One of the advantages of running SVN is that you can quickly and easily download the latest revision of MythTV. There are usually 5 or more updates a day to the MythTV source code. To update your your copy of MythTV go to the directory that holds the SVN code and run

$ svn update

Then continue compiling the code with

$ ./configure ...
$ make

and

# make install

If you plan to update SVN regularly, you should subscribe to the mythtv-commits mailing list to stay abreast to all of the latest changes in MythTV. Subscribe to the list or browse a web interface.

make clean vs. make distclean

Sometimes when there is an update, there will be a comment in there which says "make clean" or "make distclean". If you need to perform a make distclean, you will lose all of your previous ./configure parameters. It is recommended you keep your own compile parameters in a separate .sh file so you can easily rebuild if you need to perform a make distclean.

Here's a couple of scripts I use to make life easier: --- doconfig.sh ---

cd mythtv
make distclean
./configure --prefix=/usr/local --enable-xvmc --arch=i686 --enable-proc-opt --enable-dvb
cd ../mythplugins
make distclean
./configure

--- domake.sh ---

cd mythtv
make -j 2
cd ../mythplugins
make -j 2

'make clean' is only needed if you are re-'making' code which you have 'made' before. It cleans out any already-compiled '.o' files. It does not affect the configuration. 'make distclean' removes the configuration. If you upgrade often, then you do not need to do a 'distclean' often.

Automating the Entire Process: Download, Compile, and Install

I have mentioned these on the list and received requests for copies so I am posting them here. (R. Geoffrey Newbury). See also the Dependencies page which downloads and install the required libraries for myth and most of the plugins. I use the following scripts to automate the entire process. I have a PVR500 tuner, an HD3000 tuner and an HDHomeRun on order. I use lirc and my BE/FE is a Via Sp13000 motherboard, thus the particular config choices for xvmc etc. (The download is done to the 'usb' folder and copied to a usb key for transfer from the office to my home for use on the mythbox, thus the folder names. My 'high-speed' times out on downloading svn).

The entire process is done calling two scripts 'call-svn.sh' and 'all-build.sh' and using three 'config.sh' files for the configurations.

Get a complete svn code set:

--- call-svn.sh ---

Clears old svn code base and downloads complete new set.
cd /backup/usb
rm -rf myththemes
rm -rf mythplugins
rm -rf mythtv
svn co http://svn.mythtv.org/svn/trunk/mythtv
svn co http://svn.mythtv.org/svn/trunk/myththemes
svn co http://svn.mythtv.org/svn/trunk/mythplugins

The 'all-build' script calls the config scripts to configure the three myth subsystems and builds them all. All of my configure scripts are saved in /usr/local/sbin. For curiosity, I write the date/time to a log file and display it at the end of the run. Running 'all-build' as root will configure, make and make install a complete Mythtv setup without further interaction. Since the build process takes about an hour and a half, this is often the last thing I start before going to bed! If I am recording something at bedtime, I comment out the 'make install' calls, and do those by hand in the morning.

Important.png Note: mythbackend should not be running if the script will do 'make install'. Remember to 'service mythbackend stop'.

To build everything in one script, run as root:

--- all-build.sh ---

cd /backup/usb
echo "Commence build" > /backup/usb/log.out
date >> /backup/usb/log.out
#  Clean out old config scripts and replace with good ones, equals 'make distclean'
   rm -f /backup/usb/myththemes/configt.sh
   rm -f /backup/usb/mythplugins/configp.sh
   rm -f /backup/usb/mythtv/config.sh
# Copy scripts
   cp /usr/local/sbin/configt.sh /backup/usb/myththemes
   cp /usr/local/sbin/configp.sh /backup/usb/mythplugins
   cp /usr/local/sbin/config.sh /backup/usb/mythtv
   echo "End cleanup and copy of configuration" >> /backup/usb/log.out
date >> /backup/usb/log.out
# Commence actual build process
   echo "Commence Mythtv build" >> /backup/usb/log.out
   cd /backup/usb/mythtv
   make clean   # not actually needed for a new download
# Work starts here: this can take some time to run
   ./config.sh  # run configure
   make && make install
   echo "End mythtv make" >> /backup/usb/log.out
   date >> /backup/usb/log.out
 # Build themes
   echo "Commence myththeme build"
   cd /backup/usb/myththemes
   make clean
   ./configt.sh  # run configure
   make && make install
   echo "End myththemes" >> /backup/usb/log.out
   date >> /backup/usb/log.out
# Build plugins: this can take some time to run 
   echo "Commence mythplugin build" >> /backup/usb/log.out
   cd /backup/usb/mythplugins
   make clean
   ./configp.sh  #run configure
   make && make install
   echo "End mythplugins" >> /backup/usb/log.out
   date >> /backup/usb/log.out
 # And you are done 
  cd /backup/usb
  cat log.out


These are the configure script files;


--- config.sh ---

# configure for mythtv
# For Via Nehemiah cpu and unichrome-pro (xvmc capable) video chipset 
./configure --prefix=/usr/local   \
--arch=i686           \
--enable-proc-opt     \
--enable-audio-alsa   \
--disable-audio-arts  \
--disable-audio-jack  \
--disable-directfb    \
--enable-lirc         \
--enable-v4l          \
--enable-ivtv         \
--disable-firewire    \
--enable-dvb          \
--dvb-path=/usr/include \
--enable-xvmc         \
--enable-hdhomerun    \
--enable-xvmc-vld     \
--enable-xvmc-pro     \
--enable-xvmc-opengl  \
--enable-opengl-vsync \
--disable-dbox2       \
--disable-iptv        \
 --- config-sh --- 
 # for Nvidia (added December 4, 2008)
 # config shell script for mythtv configure
 # For NVidia chipset and driver w/wo vdpau

 ./configure --prefix=/usr/local   \
 --compile-type=release \
 --enable-proc-opt      \
 --qmake=/usr/lib/qt4/bin/qmake-qt4 \
 --disable-directfb    \
 --enable-lirc         \
 --enable-v4l          \
 --enable-ivtv         \
 --disable-joystick-menu \
 --disable-firewire    \
 --disable-dbox2       \
 --enable-hdhomerun    \
 --enable-dvb          \
 --dvb-path=/usr/include \
 --enable-x11          \
 --enable-xrandr       \
 --enable-xv           \
 --enable-xvmc         \
 --xvmc-lib=/usr/lib/libXvMCNVIDIA \
 --disable-xvmcw       \
 --enable-xvmc-vld     \
 --disable-xvmc-pro    \
 --enable-xvmc-opengl  \
 --enable-opengl-vsync \
 --disable-vdpau       \
 --with-bindings=perl,python

# xvmc-lib is needed or configure looks for xvmcw
# /etc/X11/XvMCConfig must not point to libXvMCW
# xvmc-lib line must preceed the 'opengl' references
# obviously --enable-vdpau only with the correct driver and hardware
--- configp.sh ---
 # configure for mythplugins
 ./configure             \
 --prefix=/usr/local     \
 --enable-opengl         \
 --enable-transcode      \
 --enable-vcd            \
 --enable-mytharchive    \
 --enable-create-dvd     \
 --enable-create-archive \
 --disable-mythbrowser   \
 --enable-mythcontrols   \
 --enable-mythdvd        \
 --disable-mythflix      \
 --enable-mythgallery    \
 --enable-exif           \
 --enable-new-exif       \
 --disable-mythgame      \
 --enable-mythmusic      \
 --enable-fftw           \
 --enable-sdl            \
 --enable-aac            \
 --disable-mythnews      \
 --disable-mythphone     \
 --disable-festival      \
 --enable-mythvideo      \
 --enable-mythweather    \
 --disable-mythzoneminder

Troubleshooting

  • After an update of SVN I get an error message of shared library xxx.so not found. Sometimes there will be a brand new library added to mythtv. On 26 March 2006, there was an issue with libfreemheg.so.19 not found when trying to start mythbackend. Running:
# /sbin/ldconfig
will ensure the new library is linked up.