[mythtv] noob to MythTV development

Roger James roger at beardandsandals.co.uk
Wed Mar 15 12:35:46 UTC 2017


Ok some typos corrected in this version.

I agree that the learning curve for eclipse is steep. However if you follow 
some simple rules you can bypass most of the curve and get a fully 
integrated IDE with compiling, source debugging, and much more. The steps 
below work on Ubuntu but should work on any linux distro.


1. Download the Eclipse CDT Neon (or later) installer from eclipse.org. You 
need Neon or later for debugging to work properly.


2. Do not set up your eclipse workspace directory anywhere where above your 
Mythtv source code directory. i.e. Do not have the myth source in any 
subdirectory of the eclipse workspace directory. This is important!


3. Configure and build the Mythtv code in the normal way from the command 
line. i.e. ./configure --compile-type=debug; make. This is also an 
important step and must be done before you try to create an eclipse project.


4. Launch eclipse. Select File - New - Makefile Project with Existing Code. 
For Existing code location choose the directory where you have just run 
configure and created a Makefile.


5. When the process finishes and the c++ indexer has run, then try a build. 
At this point I suggest you change the default make command to suit your 
system. For my quad core system I use "make -j8". To do this select Project 
- Properties. On the property dialogue​ select C/C++ Build and uncheck the 
Use default build command box, type your new build command into the box 
below. Remember to OK all the way out. Then select Project - Build All. 
Check the console tab to see if the build runs OK.


To avoid problems with debugging and running from within the ide. Go to the 
run menu and create a new debug launch configuration for each myth program 
you want to debug. Select C/C++ application as the launch template and 
press the new launch configuration button just above. In the main tab 
browse to the project name just just created and select that. For the C/C++ 
application box, select browse project and browse to the executable you 
want to run. For example for mythbackend you should end up with 
programs/mythbackend/mythbackend in the box. After you have done this go to 
the environment variables tab and create a new LD_PRELOAD environment 
variable and set it to this.


${resource_loc:/master/libs/libmyth/libmyth-29.so.29.0.0} 
${resource_loc:/master/libs/libmythbase/libmythbase-29.so.29.0.0} 
${resource_loc:/master/libs/libmythfreemheg/libmythfreemheg-29.so.29.0.0} 
${resource_loc:/master/libs/libmythmetadata/libmythmetadata-29.so.29.0.0} 
${resource_loc:/master/libs/libmythprotoserver/libmythprotoserver-29.so.29.0.0} 
${resource_loc:/master/libs/libmythservicecontracts/libmythservicecontracts-29.so.29.0.0} 
${resource_loc:/master/libs/libmythtv/libmythtv-29.so.29.0.0} 
${resource_loc:/master/libs/libmythui/libmythui-29.so.29.0.0} 
${resource_loc:/master/libs/libmythupnp/libmythupnp-29.so.29.0.0}


These are all on a single line separated by single spaces (you can use 
colons if you prefer).


Finally go to the source code tab and check that it looks like this.


Default

    Absolute File Path

    Program Relative File Path

    name_of_your_project

        name_of_a_directory_in_mythtv_source_top - /name_of_your_project

        ... more directories in the top of your source tree.


If it does not look like this then something has gone wrong and you should 
clean out the .settings directory and the .project and .cproject files from 
the project top directory (should be where you ran configure), and clean 
out your project and launch related stuff from the eclipse workspace 
directory (the easiest way to do this is delete everything including hidden 
files and directories from this directory). After that the first thing to 
check is that you really followed step 2. of the above. I have wasted many 
hours trying to replicate what eclipse puts under that default entry 
without success. If you end up with an empty default source path container, 
you really need to start over. Once you get into a situation where restore 
default on the sources tab gives you an empty container there is no way back.


Enjoy.


Roger







More information about the mythtv-dev mailing list