Compiling Common Binaries For Multiple Frontends

From MythTV Official Wiki
Jump to: navigation, search

Using the details from this page you will be able to perform one compile/installation and run the same binaries across all or many of your mythfrontends. This saves lots of time and cpu cycles so you won't have to compile myth on every frontend you wish to run it on. This article is for users who compile myth from source.


Define shared binaries location

Decide where you want to store and share all your binaries. You will need to set up a samba network share or NFS share so that all your frontend machines can see the same location. On my network I use a samba share direcotry /mythtv to store all the files on my backend server including recordings, videos, music, and most importantly for this article the binaries. All my frontend machines have a /mythtv directory which is mapped to the backend server's /mythtv directory.

Important.png Note: All my frontend machines are 32-bit so I stored the binaries for all my frontends in /mythtv/local32; and because my backend server is running AMD64 version of Debian I store the binaries for the backend server in /mythtv/local64. It is beyond the scope of this article, but running AMD64 linux causes me to have to do two compiles because I haven't yet figured out how to generate the 32-bit and 64-bit binaries simultaneously. I compile the 64-bit binary from the native installation, then compile the 32-bit version from a chroot.


On my backend server:

Script.png /etc/smb.conf

 [mythtv_share]
   comment = HTPC Share
   writable = yes
   path = /mythtv
   public = yes

On my frontend machines:

Script.png /etc/fstab

 # <file system>         <mount point>   <type>  <options>                 <dump>  <pass>
 //mythbox/mythtv_share  /mythtv         smbfs   username=mythtv,password=    0       0


Compile and install mythtv binaries with --prefix switch

Once you have a common location where you want to share the binaries; you need to compile mythtv using the --prefix switch. This switch tells the compiler to install the binaries and libraries into a specified location instead of the usual /usr/local location that it defaults to. This is the command line I use when compiling my 32-bit binaries:

./configure --prefix=/mythtv/local32

then of course you need to install the binaries:

sudo make install


Important.png Note: If you are compiling mythplugins don't forget to specify the --prefix switch for it's configure as well!


Set up your frontends to use the shared binaries

Now that you've shared the directory with your frontend(s) and compiled and installed the binaries into the shared location you need to set up the frontend to take advantage of them. First there are many libraries installed as well that the frontend machine needs to know about so you must add the new location to /etc/ld.so.conf.

On my frontend machines:

Script.png /etc/ld.so.conf

 # Shared MythTV Libs!
 /mythtv/local32/lib

Use the following command to configure the dynamic linker run-time bindings:

sudo ldconfig

this will read the directory you just added so that all executables will have knowledge of the new libraries.

now you need to set up the MYTHTVDIR environment variable so that mythtv knows where it is supposed to be running from, and it is a good idea to add the binaries directory to your path. I did these two things by adding the following lines to /etc/profile.

On my frontend machines:

Script.png /etc/profile

 PATH=$PATH:/mythtv/local32/bin
 MYTHTVDIR=/mythtv/local32

 export PATH
 export MYTHTVDIR


Now you should be able to run mythfrontend using the binaries from the shared location.


Appendix: Extra Notes

MythWeb

If you are using mythweb, you'll need to update your apache.conf file to set the include_path location. I was getting these errors whenever I tried to open the url.

On my backend server:

Warning.png Errors from /var/log/apache/error.log

[Sat Mar 12 11:05:19 2011] [error] [client 127.0.0.1] PHP Fatal error:  Class 'MythBase' not found in /var/www/mythweb/classes/Translate.php on line 16

To fix these errors I asked Mr. Petersen, the mythweb pro. He suggested I check my include_path line, it worked.

On my backend server:

Script.png /etc/apache2/sites-available/mythweb.conf

setenv include_path      "/mythtv/local64/share/mythtv/bindings/php/"

MyhtPython

I noticed a script I use to gather metadata for my movies and shows wasn't working, it was because mythpython was broken:

> mythpython
Traceback (most recent call last):
  File "/mythtv/local64/bin/mythpython", line 3, in <module>
    from MythTV import *
ImportError: No module named MythTV

I had to add the following export statement to include my relocated python libraries:

Script.png ~/.bashrc

export PYTHONPATH=/mythtv/local64/lib/python2.7/site-packages/