[mythtv] noob to MythTV development

Roger James roger at beardandsandals.co.uk
Wed Mar 15 11:35:13 UTC 2017


On 15 March 2017 8:07:20 am Jean-Yves Avenard <jyavenard at gmail.com> wrote:

> Hi.
>
>
>
> On 11 March 2017 at 15:49, Dave Mansfield <muddysteel at gmail.com> wrote:
>>
>> With regards to development:  I've been looking at the web pages and have
>> not seen info on coding templates for Eclipse.  Has anyone who uses Eclipse
>> setup code templates?  If so, can I get an exported copy of the templates?
>> (Spaces vs. tabs is an ironclad rule with me, too!)
>
> Forget Eclipse, it's crap really.. Slow, super complicated to set up
> properly. Pages taking forever to load...
>
> I found Visual Studio Code awesome to work with and I now use use it
> everywhere, even with very big project.
>
> It's also super easy to set up. Simply open the source directory and that's it.
>
> Compiling from it requires to write some small scripts, but it's fairly easy.
>
> Debugging using either lldb or gdb is then trivial.

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 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 had run. Then try a 
build. At this point I suggect you change the default make command to 
suti your system. For my quad core system I use "make -j8". To do this 
select Project - Properties. On the propert dialog 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. The issues 
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 poress the new launch configuration just above. In the main 
tab browse to the project name just just created and select that. For 
the C/C++ application 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 application field. 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
     ...

If it does not 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 wy 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.

Enjoy.

Roger



More information about the mythtv-dev mailing list