MythTV on Windows using Visual Studio

From MythTV Official Wiki
Revision as of 14:33, 25 October 2013 by Stevegoodey (Talk | contribs)

Jump to: navigation, search


As of MythTV version 0.28, you can use Microsoft Visual Studio 2010 (or Visual Studio Express) to build a native Win32 version of all main components (plugins are still not available as of writing this).

This guide will provide you with the steps needed to install all required tools and to perform a full compile of the MythTV source code.


Information.png Tip: The version of Visual Studio referenced in this guide is 2010. Due to Qt incompatibilities, newer versions are currently unsupported


Requirements

The following tools must be installed in order to build the source. Some of the tools require specific settings or post install steps to be successfully used. Please follow each link to see detailed instructions for that component.


Information.png Tip: If a link isn't provided, it is assumed the default install will work as expected

Get the Source

You will need to clone the git source tree.

Open a "Visual Studio Command Prompt (2010)" and navigate to where you want the source located. This guide will assume it's located in c:\source.

To clone the source from github execute the following:

git clone git://github.com/MythTV/mythtv.git

This should place the source code in c:\source\mythtv

Information about Configure

There is a PowerShell script (configure.ps1) that is used to make sure your build environment is setup correctly. It also compiles third party dependencies that are needed for MythTV.

Configure can produce two types of output

  • Makefiles
  • Visual Studio Solution/Project files (mostly used for debugging with Visual Studio)

Makefiles

This is the best choice if you are looking for a simple way to quickly compile all code. It is completely command line driven and when finished, you will have all needed dll's & exe's.

Visual Studio Solution/Projects

Best used if you want to debug or develop code. It creates a set of solution and project files. You can then open the solution file in Visual Studio and use the full features of the tool.


Information.png Tip: You can run configure multiple times to produce both the makefiles and the Visual Studio Solution. You can then run the build on the command line at any time and switch to the IDE if you need to debug something.

Command Line Options

-BuildType

  • debug
  • release
  • clean

-OutputType

  • nmake
  • sln

Running Configure

To prepare to run configure, perform the following steps:

  1. Open a Visual Studio Command Prompt (2010)
  2. Change to the MythTV source directory which contains configure.ps1 (c:\source\mythtv\mythtv)
  3. execute: Powershell (this will allow you to run the script directly)

The above should leave you in a powershell command prompt in the source directory. Now you want to run configure.

Makefiles

.\configure -BuildType debug -OutputType nmake

Visual Studio Solution

.\configure -BuildType debug -OutputType sln

Warning.png Warning: First time running configure will cause dependencies to be compiled, including FFmpeg. This will take some time.

If all is going well the output should look something like the following the fist time running configure:

Win32-Configure-FirstTime.png

When Completed you should see:

Win32-Configure-Completed.png

Building MythTV

At this point, if you generated a Visual Studio Solution file, it is located in the same directory as the configure script. Just open it in Visual Studio.

C:\Source\mythtv\mythtv\mythtv.sln

If you choose to generate makefiles, all you need to do is execute:

PS C:\source\mythtv\mythtv> nmake

When Completed, the Executables and DLL's will be located in

C:\source\mythtv\mythtv\bin\debug\
              - or -
C:\source\mythtv\mythtv\bin\release\

Running MythTV

  1. If you are running the MythTV database on this system, you need to initialize the database. Follow these steps:
    1. Create the mythconverg database by directing the mc.sql file into mysql.exe. For the installation in this guide, enter the following lines:
      • cd c:\Program Files (x86)\MySQL\MySQL Server 5.6\bin
      • mysql -u root -p < c:\source\mythtv\mythtv\database\mc.sql
    2. Load time zone data for MySQL on Windows
  2. For now, you will need to copy the themes directory to a location under the myth bin directory:
    • mkdir c:\source\mythtv\mythtv\bin\debug\share\mythtv
    • xcopy c:\source\mythtv\mythtv\themes c:\source\mythtv\mythtv\bin\debug\share\mythtv\themes\ /e


Incomplete.png Incomplete, needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page

Problems You May Encounter

Incomplete.png Incomplete, needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page

Some potential topics:

  • Permission issues in Powershell (Set-ExecutionPolicy)
as Admin: Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
  • libmysql.dll not in path
  • Timezone tables in database
  • mythconverg not created
  • FFmpeg can't find inttypes.h. See this link for the solution: inttypes.h missing
  • If for some reason MSYS isn't found, delete everything between the brackets of "Function FindMSys()" and change the configure.ps1 file for MSYS as follows (changing your install path as needed):
   $MSysPath = "C:\MinGW\"
   $MSysPath += "msys\1.0\"
   if ( Which( $MSysPath + "msys.bat" ))
   {
       return $MSysPath
   }