MythTV on Windows

From MythTV Official Wiki
Revision as of 12:38, 3 November 2009 by GBee (Talk | contribs)

Jump to: navigation, search

Time.png Outdated: The information on this page may no longer be relevant to the current release of MythTV, 0.27.3. Please consider helping to update it.

MythTV runs on Windows but for legal reasons an official exe is not provided, here is how to build a windows binary for yourself.

Using MinGW as the build platform, and MS Direct3D as the display layer.

Contents

Unofficial Windows Pre-Builds

A MythTV user has set up a website where you can download pre-built versions of the windows port.

The site is located here: http://members.iinet.net.au/~davco/

Background & Caveats

MinGW/GCC doesn't seem to work well under Vista 64 bit (maybe even 32 bit too). Try compiling on an 2000/XP box instead.

What works?

The frontend, backend (without any tuners), and most utilities compile, and most functionality works.

What doesn't work?

There is currently no support for most tuners in mythbackend. However the network connected Template:HD Homerun ATSC, Cable or DVB-T tuner does work.

Win32 Build Script

The "HOWTO" section below is LONG, painful, and easy to get wrong (and possibly a bit out of date! ). However, follow this section, and you can ignore it!  :-)

Important.png Note: If you are building 0.21-fixes instead of trunk, you must choose to install the "Previous" package when prompted by the MinGW Automated Installer. Failure to do so will result in build failure related to usleep(). This applies regardless of the version of build script or MinGW Automated Installer used.

OR:


Seriously... this script will automatically download ALL the required downloads (into c:\msys\1.0\sources ) that are mentioned below, do all the compilations, setup your environment, and save you at least 5 hours of click-download-click-save-click boring stuff. (The mysql link in the script is dead. I had to manually update mine to mysql-essential-5.1.38-win32.msi. If the author has time to update that part I'm sure it would help others in the future.)

Occasionally, the build script in SVN may point to outdated packages. You can usually work around this by pointing the script to a newer package. For example, fftw-3.1.2.tar.gz is no longer available. To fix this, you would edit the win32-packager.pl script, replacing fftw-3.1.2 with fftw-3.2.1, then run "c:/perl/bin/perl.exe -w win32-packager.pl" instead of MythInstaller.bat so that the change would not be overwritten. If for some reason, it is unable to extract the downloaded zip files, just unzip them by hand and re-run the script.


STOP! DON'T READ ANY FURTHER!. SERIOUSLY. IF YOUR BUILD DIDN'T WORK, PLEASE EMAIL THE PROBLEM TO THE mythtv-dev list, and the win32 devs will try to help!

You need only continue reading below if you are a masochist, or you want to understand all the steps that the above "win32-packager.pl" script will do for you.! Seriously, it will automatically do everything else listed in this HOWTO section for you, and a few usefull things besides.! PLEASE use it, and don't do it manually unless you absolutely must!

HOWTO

Time.png Outdated: The information on this page may no longer be relevant to the current release of MythTV, 0.27.3. Please consider helping to update it.

Conventions

Because this is a mixed-mode (unix tools on a windows box) installation document, there are times when you will be executing commands in "unix mode" (inside a msys window), and other times in "windows mode" (inside a "DOS Box" aka cmd.exe). This conventions section lays out how we identify when to do what.

  1. Try to do most actions in a msys(unix) window, unless otherwise specified.
  2. Commands that start with c:\xxx> are meant to be executed in a DOS Box, and the 'xxx' typically shows the folder you should be in, if important.
  3. All dependencies/downloads will have at least two links: the first to the "main site/page" will be unlabeled, or labeled 'site:', and the second link will be labeled 'direct download:', to supply an immediate link to the software (or as immediate as possible + click-thru-instructions).
  4. Sentences starting with TIP: or NOTE: are little pieces of positive information that you may find useful to know at this juncture, normally they are NOT about debugging/compiling issues, as these are covered in the "issues/problems" section at the bottom.

Install MinGW - download the "Automated MinGW Installer"

site: http://www.mingw.org/

 More info available here: http://www.mingw.org/download.shtml 

Direct download (almost): http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780&release_id=595197

 *If building MythTV trunk, install the "Current" MinGW package.
 *If building MythTV 0.21-fixes, install the "Previous" MinGW package.
 *When installing, be sure to install g++, g77, and MinGW make in addition to MinGW base.
 *Typical install path is c:\MinGW

Download and extract MINGW additional component/s: into your MINGW instalation

TIP: MINGW is different from MSYS. This difference is important to remember.

Download Mingw32-make (this is required for the QT compilation):

direct download (almost): http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=23918&release_id=531888

 Extract to C:\MinGW

Download mingw-utils

direct download (almost): http://downloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz?modtime=1077321600&big_mirror=1

 Extract it to c:\MinGW

Install "MSYS base system" current release "MSYS-1.0.10.exe"

more info: http://www.mingw.org/

direct download: http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=24963 During the installation leave destination folder as

 C:\Msys\1.0 

When instructed by msys (in a DOS window) enter the path where you installed MinGW in unix-style form:

 c:/mingw

You might find that you get an error in "sync with child / child state waiting for longjump" or "Couldn't reserve space for cygwin's heap" when in the post-instllation (DOS window). This error definitely occurs with Vista 64 bit edition. The solution that I found to solve the problem, is to go to the MSYS Technology Preview download page and select the MSYS-1.0.11-20071204.tar.bz2 file:

 http://downloads.sourceforge.net/mingw/MSYS-1.0.11-20071204.tar.bz2?modtime=1196807934&big_mirror=1
 Then, unpack the files on your existing MSYS directory (default C:\MSys\1.0). It should 
 overwrite these files: 
 bin/msys-1.0.dll 
 bin/mount.exe 
 bin/ps.exe

After doing this you can run C:\msys\1.0\postinstall\pi.bat again and this time there should be no errors.

Download and extract MSYS additional component/s: into your MSYS instalation

bash

direct download: http://downloads.sourceforge.net/mingw/bash-3.1-MSYS-1.0.11-1.tar.bz2?modtime=1195140582&big_mirror=1

 Extract to C:\MSys\1.0 and overwrite any existing files

zlib

direct download: http://downloads.sourceforge.net/mingw/zlib-1.2.3-MSYS-1.0.11.tar.bz2?modtime=1190248364&big_mirror=1

 Extract contents, then copy contents of usr subfolder (ie folders of bin, 
 include, lib and share) to C:\MSys\1.0

NOTE: Not sure what is going on, but I found that when running .configure in taglib it could not find zlib unless I copied it into MinGW -- Simon Kenyon

'pr' command

the coreutils package contains the 'pr' command.

direct download: http://downloads.sourceforge.net/mingw/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2?modtime=1188741011&big_mirror=1

 Extract the file, then copy the contents of the coreutils-5.97 subfolder to C:\MSys\1.0

optionally update the GCC version

Andrei used GCC 4.2.2 from here (and has had success!):

 http://www.tdragon.net/recentgcc/
 It's a drop-in replacement for MinGW gcc, and it comes with pthread library.
 direct downloads:
 http://downloads.sourceforge.net/tdm-gcc/gcc-4.2.2-tdm-1-core-1.7z
 http://downloads.sourceforge.net/tdm-gcc/gcc-4.2.2-tdm-1-g++-1.7z
 (requires 7-zip to extract: see http://www.7-zip.org/download.html)

Note: The notes on the above page indicate that the Technology Preview from the main MinGW page might be better.


Buzz (and the win32-packager.pl script) build mythtv with the default mingw (3.4.5).


It might be necessary the technology preview of 4.2.1 (if the 3.4.5 build is unsuccessful):

 So far, 4.2.1 has NOT been been needed, but he's not finished the build process of 3.4.5 yet. 

Here's the links to it anyway. ( 4.2.1 preview ):

direct download: http://downloads.sourceforge.net/mingw/gcc-core-4.2.1-sjlj-2.tar.gz?modtime=1187065794&big_mirror=1

 After downloading extract to C:\MinGW and overwrite any files there

direct download: http://downloads.sourceforge.net/mingw/gcc-g%2B%2B-4.2.1-sjlj-2.tar.gz?modtime=1187065795&big_mirror=1

 After downloading extract to C:\MinGW and overwrite any files there

To make GCC 4.2.1 the default version, do the following commands in C:\MinGW\bin:

 c:\>cd c:\MingW\bin
 c:\>copy gcc-sjlj.exe gcc.exe
 c:\>copy gccbug-sjlj.exe gccbug.exe
 c:\>copy mingw32-gcc-sjlj.exe mingw32-gcc.exe
 c:\>copy g++-sjlj.exe g++.exe
 c:\>copy mingw32-g++-sjlj.exe mingw-g++.exe

direct download: http://downloads.sourceforge.net/mingw/libgcc_sjlj_1.dll.gz?modtime=1187162717&big_mirror=1

 After downloading extract to ???

install tortoiseSVN for GUI access to subversion

site: http://tortoisesvn.tigris.org/

direct download: http://downloads.sourceforge.net/tortoisesvn/TortoiseSVN-1.4.8.12137-win32-svn-1.4.6.msi?download

Get the latest copy of the mythtv source code

  • Make a folder c:\mythtv\
  • Right-click on the mythtv folder you just created and choose "SVN Checkout..."
  • Enter the follwing string
 http://svn.mythtv.org/svn/trunk/
into the tortoiseSVN window, and click OK.
  • wait for very large download to finish (roughly 127MB)

After checkout, you should see: Completed At revision 15244 (or higher)

Enter the msys environment

Double click on the MSYS shortcut on your Windows desktop. Alternatively, run c:\msys\1.0\msys.bat

MSys looks like unix, doesn't it!.

TIP: type 'mount' to see how msys lays out its folders.

QT and compiler environment variables

   export QTDIR=/--path to qt location--/qt-3.3.x-p8
   export QMAKESPEC=$QTDIR/mkspecs/win32-g++
   export LD_LIBRARY_PATH=$QTDIR/lib:/usr/lib:/mingw/lib
   export PATH=$QTDIR/bin:$PATH


   TIP: if you extracted qt into the folder c:/msys/1.0/qt-3.3.x-p8/ , then the first line above would be:
   export QTDIR=/qt-3.3.x-p8
   (this works because msys mounts the c:/msys/1.0/ as "/")

Apply patches to MythTV

As of 20080418 there are a few patches that will make MythTV 0.21 work better on Windows:

This patch moves lib, share, include to relative folders to installation (executable):

Libraries and dependencies

Download and compile all the libs for all the libraries listed below in both the Binary Dependencies/Libs section and the Source Libs section. This is a lot of work.

Hopefully we'll be able to make all these library dependencies quicker, and just supply pre-built versions to download, for those libraries that are stable.

Binary Dependencies / Libs

MySQL

Download "Windows Essentials (x86)" from here: http://dev.mysql.com/downloads/mysql/5.0.html#win32

Almost direct download: http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-essential-5.0.45-win32.msi/from/pick#mirrors

  • During installation, click the Custom setup type.
  • Ensure that C Include Files / Lib Files are installed onto the local drive. (That is done by choosing a "custom" install, and just selecting that component to install as a minimum, if you plan on testing backend functionality too, you sjhould do a "complete" install, to install the mysql server too).
  • Copy all files from C:\Program Files\Mysql\Mysql Server 5.0\include to C:\MinGW\include
  • Copy libmysql.dll from C:\Program Files\Mysql\Mysql Server 5.0\bin to C:\MinGW\lib
  • Copy libmysql.lib from C:\Program Files\Mysql\Mysql Server 5.0\lib\opt to C:\MinGW\lib

The above three steps as a cut-n-paste for msys:

 cp /c/Program\ Files/MySQL/MySQL\ Server\ 5.0/include/* /c/MinGW/include/
 cp /c/Program\ Files/MySQL/MySQL\ Server\ 5.0/bin/libmySQL.dll /c/MinGW/lib
 cp /c/Program\ Files/MySQL/MySQL\ Server\ 5.0/lib/opt/libmysql.lib /c/MinGW/lib

Ensure you have installed the mingw-utils dependency Start the Msys environment

 cd /mingw/lib
 reimp -d libmysql.lib
 dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a

The steps for rebuilding libmysql.a came from: http://wiki.qtcentre.org/index.php?title=Building_the_QMYSQL_plugin_on_Windows_using_mingw

Now we need to patch /mingw/include/mysql.h so that WIN is defined for MINGW32

If you see (if you don't see code looking exactly like this, go to the next patch/change below):

 #ifdef __MINGW32__     /* MINGW implements a UNIX API */
 #undef WIN
 #undef _WIN
 #undef _WIN32
 #undef _WIN64
 #undef __WIN__
 #endif

Change it to:

 #ifdef 0  //__MINGW32__     /* MINGW implements a UNIX API */
 #undef WIN
 #undef _WIN
 #undef _WIN32
 #undef _WIN64
 #undef __WIN__
 #endif

(Note: Not all versions of mysql.h have the above - you may not need to do anything.)

If you see:

 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)

Change it to this:

 #if (defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__)) && !defined(__WIN__)

Lastly, you need to comment out (insert //) in the two lines (one in front and 1 after) "#include <winsock.h> in /mingw/include/mysql.h so it now reads.

 //#ifdef __LCC__  
 #include <winsock.h> /* For windows */ + #ifdef 0 //__MINGW32__ /* MINGW implements a UNIX API */ 
 //#endif

Note: The important thing is that #define STDCALL __stdcall is defined otherwise bad things will happen (it will compile but you'll fine segfaults happen immediately due to the stack getting well stacked.

libpthread

libpthread (precompiled) Alternative to this step: You can compile libpthread from source

site: http://sourceware.org/pthreads-win32/

direct download: ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/libpthreadGC2.a Save libpthreadGC2.a as libpthread.a into the lib directory (c:\mingw\lib\libpthread.a)

 cp libpthreadGC2.a /c/mingw/lib/libpthread.a

direct download: ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/pthreadGC2.dll

 Save pthreadGC2.dll into the MinGW bin directory (c:\mingw\bin)
 Copying this dll ALSO to pthread.dll may be needed.
 cp pthreadGC2.dll /c/mingw/bin/pthreadGC2.dll
 cp pthreadGC2.dll /c/mingw/bin/pthread.dll

direct download (almost): ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/

 Download all header files from include/ to the include directory (c:\mingw\include) 

(details came from this link: http://www.gnunet.org/hacking_win32_build.php3 - it has a good summary)

directX header files

You will need a copy of the Microsoft DirectX SDK for ddraw.h dinput.h and dsound.h. To get the needed DirectX header files from the Microsoft DirectX SDK:

  • Go to http://msdn.microsoft.com/downloads/
  • Select the DirectX SDK (November 2007)
  • Click on the Download link on the right
  • This is a 427 MB file!
  • Run the downloaded program
  • Untick "When done unzipping open Setup.exe" - there is no need to install the SDK
  • click Unzip to extract it to C:\mssdk\temp
  • Click "OK" and "Close" when the program finishes extracting the files
  • Copy the following three files from SDK's include directory (C:\mssdk\temp\Include) ddraw.h dinput.h and dsound.h to the to the mingw include directory (C:\MinGW\Include)

Source Libs

For all the libs below, except when noted otherwise, use tar xvzf xxxx.tar.gz, cd xxxxx, ./configure --prefix=/usr && make && make install to build and install them, there's nothing special that needs to be done.

TIP: For those unfamiliar with libraries, using the shortname (eg 'ogg') normally refers to a download/library called 'libogg.xxxxx.tar.gz', or similar.

freetype

http://savannah.nongnu.org/projects/freetype

direct download: http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.5.tar.gz

build it with

 ./configure --prefix=/mingw;make;make install

because using "--prefix=/usr" seems to not work (Freetype library is not detected by mythtv configure)

lame

download version 3.97 from sourceforge http://lame.sourceforge.net/index.php direct download (almost): http://sourceforge.net/project/showfiles.php?group_id=290&package_id=309&release_id=450142 build it with

 ./configure --prefix=/mingw;make;make install

NOTE: For some reason, many people get get "ld.exe -lmp3lame not found" (or similar) when compiling mythtv if they install lame into /usr (by configuring with --prefix=/usr), even if the LD_LIBRARY_PATH variable is set correctly. Installing into /mingw seems to workaround this issue.

libpthread

This step details how you can compile libpthread from source (if needed)

NOTE: If you already have the precompiled version of libpthread as shown above then you can SKIP THIS STEP

NOTE: It is more experimental than the precompiled version above, so if you have pthread issues, try the precompiled version.

site: http://sourceware.org/pthreads-win32/

direct download: ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz

  • extract, and build in msys with the command:
 tar -zxvpf pthreads-w32-2-8-0-release.tar.gz
 cd pthreads-w32-2-8-0-release
 make clean GC GC-static
  • copy libraries/includes (same files as per above precompiled version) to the right location:
 cp ./libpthreadGC2.a /mingw/lib/libpthread.a
 cp ./pthreadGC2.dll /mingw/bin/
 cp ./pthread.h /mingw/include
 cp ./sched.h /mingw/include/
 cp ./semaphore.h /mingw/include/


Optional libraries

taglib

version 1.4 from freshmeat: http://freshmeat.net/projects/taglib direct download: http://developer.kde.org/~wheeler/files/src/taglib-1.4.tar.gz

 ./configure --prefix=/usr;make;make install

TIP: Buzz found that 'make install' failed until all the Makefiles were tweaked. After running ./configure, in all the "Makefile" files change any of these:

 INSTALL = C:/msys/1.0/bin/install -c -p
 INSTALL = ../C:/msys/1.0/bin/install -c -p
 INSTALL = ../../C:/msys/1.0/bin/install -c -p

into:

 INSTALL = /bin/install -c -p

Then run make and make install. NOTE: Running ./configure will overwrite any changes you make to the Makefiles, so make sure not to re-run that after changing the files.

ogg and vorbis

ogg version 1.1.3 and vorbis version 1.2.0 from xiph http://xiph.org/downloads/

You must compile and install three components and in the following order:

  1. libao
  2. libogg
  3. libvorbis

direct downloads:

Compile commands:

 tar xvzf libao-0.8.8.tar.gz
 tar xvzf libogg-1.1.3.tar.gz
 tar xvzf libvorbis-1.2.0.tar.gz
 cd libao-0.8.8;./configure --prefix=/usr;make;make install;cd ..
 cd libogg-1.1.3;./configure --prefix=/usr;make;make install;cd ..

For vorbis, use

 cd libvorbis-1.2.0;./configure --prefix=/usr --disable-shared;make;make install;cd ..

(or find how to resolve undefined references to libogg, this shouldn't be too hard).

Alternatively, apply the following patch to lib/Makefile.in to allow shared lib building. Only affects libvorbisfile and libvorbisenc. Then do:

 cd libvorbis-1.2.0;./configure --prefix=/usr;make;make install;cd ..
--- lib/Makefile.in.orig    Fri Dec 28 08:21:48 2007
+++ lib/Makefile.in Fri Dec 28 08:22:52 2007
@@ -264,10 +264,10 @@
 libvorbis_la_LIBADD = @OGG_LIBS@ @VORBIS_LIBS@
 libvorbisfile_la_SOURCES = vorbisfile.c
 libvorbisfile_la_LDFLAGS = -no-undefined -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@
-libvorbisfile_la_LIBADD = libvorbis.la
+libvorbisfile_la_LIBADD = libvorbis.la @OGG_LIBS@
 libvorbisenc_la_SOURCES = vorbisenc.c 
 libvorbisenc_la_LDFLAGS = -no-undefined -version-info @VE_LIB_CURRENT@:@VE_LIB_REVISION@:@VE_LIB_AGE@
-libvorbisenc_la_LIBADD = libvorbis.la
+libvorbisenc_la_LIBADD = libvorbis.la @OGG_LIBS@
 CLEANFILES = $(EXTRA_PROGRAMS)
 barkmel_SOURCES = barkmel.c
 tone_SOURCES = tone.c

flac

version 1.2.1 http://flac.sourceforge.net/

direct download (almost): http://sourceforge.net/project/showfiles.php?group_id=13478&package_id=12677&release_id=539981

Compile with:

 cd flac-1.2.1;./configure --prefix=/usr;make;make install;cd ..

exif

Optional library (to read extra information taken by Canon digital cameras) for MythGallery http://libexif.sourceforge.net/

Direct download: https://sourceforge.net/project/showfiles.php?group_id=12272&package_id=38136&release_id=515385

libvisual

Optional library for MythMusic http://sourceforge.net/projects/libvisual/

Direct download http://downloads.sourceforge.net/libvisual/libvisual-0.4.0.tar.gz?modtime=1142891522&big_mirror=0

SDL

Optional library for MythMusic http://www.libsdl.org/

Direct download: http://www.libsdl.org/release/SDL-1.2.12.tar.gz

fftw

Optional library for MythMusic (for onscreen visualisations): http://www.fftw.org/

Direct download: http://www.fftw.org/fftw-3.1.2.tar.gz

TIP: you might want to configure with

 ./configure --prefix=/usr --with-gcc-arch=k8

or

 ./configure --prefix=/usr --with-our-malloc16 --with-windows-f77-mangling --enable-shared --disable-static --enable-portable-binary --enable-float --enable-sse

TIP: there are also MinGW tips here: http://www.fftw.org/install/windows.html

QT

QT deserves its own section on this page, because it wasn't trivial to make QMake work, and because it had a couple of bugs, one of them critical, leading to deadlocks in MythFrontend.

Start CMD

Open a CMD.exe window (start->run->type 'cmd'->OK) - NOT a msys window! NOTE: building QT is NOT done in the msys environment, it's done in a DOS(cmd.exe) box!

Download QT 3

direct download (almost): http://downloads.sourceforge.net/qtwin/qt-3.3.x-p8.tar.bz2?modtime=1178810003&big_mirror=0

TIP: extract the .tar.bz2 file somewhere handy. Buzz extracted to the folder to

 C:\msys\1.0\qt-3.3.x-p8\

Define DOS environment variables for QT compile

define where you extracted it to! (IMPORTANT - DO NOT SKIP!)

 c:\> set QTDIR=C:\msys\1.0\qt-3.3.x-p8
 c:\> set MINGW=c:\MinGW
 c:\> set PATH=%QTDIR%\bin;%MINGW%\bin;c:\msys\1.0\bin;%PATH%
 c:\> set QMAKESPEC=win32-g++

Apply QT Patch

Apply the qt patch from here: http://svn.mythtv.org/trac/ticket/4270 download it to the qt-3.3.x-p8 sources folder from step 1

direct download: http://svn.mythtv.org/trac/raw-attachment/ticket/4270/qt.patch.gz

(this is easiest to do in a msys window:)

 export QTDIR=/c/msys/1.0/qt-3.3.x-p8
 cp qt.patch.gz $QTDIR
 cd $QTDIR
 gunzip qt.patch.gz
 patch -p1 < qt.patch

NOTE: The patch fixes one critical bug, fixes one issue preventing it from working properly with bash, implements "install" in makefiles, and reduces number of compiler warnings during MythTV compilation. Unfortunately, this breaks QT build scripts, but it still allows to build the qt-mt3.dll properly.

Apply another qt patch from here: http://tanas.ca/qt2.patch (direct download)

 patch -p1 < qt2.patch

NOTE: This patch fixes another critical bug, it's important to apply it.

 For convenience, I combined both patches into one file here: http://tanas.ca/qt.patch (AT)

Rename sh.exe OR check path

QT doesn't like sh.exe: To get the QT build to work temporarily rename the sh.exe which MINGW and MSYS use.

   c:\>rename \MSYS\1.0\bin\sh.exe sh_.exe
   c:\>rename %MINGW%\bin\sh.exe sh_.exe             # may not exist, but if it does, rename it.

Alternatively, some people have just removed msys or cygwin from their path.

TIP: I get errors about not finding cp or rm when I do NOT have c:\msys\bin in my path. -- zack

Compile and build QT

NOTE: Background information on what is happening here:

 The configure.bat first creates link_includes.exe and configure.exe which are needed for 
 bootstrap the build process. link_includes.exe copies all relevant Qt headers into the 
 include-directory. configure.exe is the replacement for the ./configure-script unter 
 Unix/Linux.  After that, qmake.exe is built and the compilation gets started.  

Next we need to configure and build the source - This should build the whole Qt release:

 c:\> cd %QTDIR%
 c:\msys\1.0\qt-3.3.x-p8> configure.bat -thread -plugin-sql-mysql -opengl -no-sql-sqlite 

TIP: configure knows some of the parameters of the x11 release configure script like -fast or -verbose. For a full list see bin\configure.exe -help.

TIP: If the compliation of QT is stopped (Ctrl-C), you can restart compiling with:

 C:\msys\1.0\qt-3.3.x-p8> mingw32-make [target]

For a list of all available [target]s see the toplevel Makefile.

After 40-50 minutes you will see an error during the compilation process:

 mingw32-make[3]: Entering directory `C:/msys/1.0/qt-3.3.x-p8/tools/assistant'
 C:\msys\1.0\qt-3.3.x-p8/bin/uic.exe finddialog.ui -o finddialog.h
 process_begin: CreateProcess(NULL, C:\msys\1.0\qt-3.3.x-p8/bin/uic.exe finddialog.ui -o finddialog.h, ...) failed.
 make (e=2): The system cannot find the file specified.

This is due to a QT dependency (uic.exe) not being compiled and, later, libqassistantclient not being compiled before it is required, and a missing makefile in tools\linguist\tutorial The workaround is as follows:

 echo all: > tools\linguist\tutorial\Makefile
 cd tools\designer
 mingw32-make
 cd ..\assistant\lib
 mingw32-make   
 cd ..\..\..
 echo 
 mingw32-make                                 # this re-starts the compile

NOTE: I've re-done this area of the compile multiple times... would appreciated the above workaround being tested by a third party -- Richard Dale Richard - I was unable to repeat your error, and my QT builds fine so long as I apply the qt.patch.gz file (as per the instructions) immediately after I extract the qt. - Buzz.

I(Buzz) created a batch file for building QT, I called it qtsetup.bat: (this is the contents of the batch file)

 set QTDIR=c:\msys\1.0\qt-3.3.x-p8
 set MINGW=c:\mingw
 set PATH=%QTDIR%\bin;%MINGW%\bin;%PATH%
 set QMAKESPEC=win32-g++
 rename c:\msys\1.0\bin\sh.exe sh_.exe
 cd %QTDIR%
 configure.bat -thread -plugin-sql-mysql -opengl -no-sql-sqlite
 mingw32-make
 rename c:\msys\1.0\bin\sh_.exe sh.exe

create libqt-mt.dll

Copy libqt-mt3.dll to libqt-mt.dll (since this is what Myth is expecting)

 c:\> copy %QTDIR%\lib\libqt-mt3.dll %QTDIR%\lib\libqt-mt.dll

Rename sh.exe back to original

   c:\>rename c:\msys\1.0\bin\sh_.exe sh.exe
   c:\>rename %MINGW%\bin\sh_.exe sh.exe             # may not exist, but if it does, rename it.

QT4

The next major MythTV release, 0.22, will require QT 4.4 as a minimum. Please note this is not necessary with the 0.21 release or 0.21-fixes branch and this is also *untested*.

Download the QT 4 source.

   ftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.3.4.zip

Extract the contents. Jay extracted them to:

   C:\msys\1.0\qt-win-opensource-src-4.3.4

Open a CMD.exe window (start->run->type 'cmd'->OK) - NOT a msys window! NOTE: building QT is NOT done in the msys environment, it's done in a DOS(cmd.exe) box!

Configure QT 4 to use MySQL and then build QT 4. Enter these in the command prompt window.

   set QTDIR=C:\msys\1.0\qt-win-opensource-src-4.3.4
   set MINGW=c:\MinGW
   set PATH=%QTDIR%\bin;%MINGW%\bin;%PATH%
   set QMAKESPEC=win32-g++
   cd %QTDIR%
   configure -plugin-sql-mysql -no-sql-sqlite
   mingw32-make

NOTE: You may get an error "UNICODE_STRING does not name a type" during configure. In that case you'll have to replace your \mingw\include\sspi.h with an updated one from this thread:

http://www.nabble.com/Problem-compile-Qt-4.4.2-with-latest-w32api-td19592075.html

Also, if you get an error like "qatomic_windows.h: error: declaration of C function `long int InterlockedCompareExchange(long int*, long int, long int)' conflicts with winbase.h: error: previous declaration `LONG InterlockedCompareExchange(volatile LONG*, LONG, LONG)' here", then you'll have to fix the QT4 file \src\corelib\arch\qatomic_windows.h as per the above thread. Specifically, you have to change this block:

   #if !(defined Q_CC_BOR) || (__BORLANDC__ < 0x560)
   
   extern "C" {
       __declspec(dllimport) long __stdcall InterlockedCompareExchange(long *, long, long);
       __declspec(dllimport) long __stdcall InterlockedIncrement(long *);
       __declspec(dllimport) long __stdcall InterlockedDecrement(long *);
       __declspec(dllimport) long __stdcall InterlockedExchange(long *, long);
       __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long *, long);
   }
   
   #else
   
   extern "C" {
       __declspec(dllimport) long __stdcall InterlockedCompareExchange(long volatile*, long, long);
       __declspec(dllimport) long __stdcall InterlockedIncrement(long volatile*);
       __declspec(dllimport) long __stdcall InterlockedDecrement(long volatile*);
       __declspec(dllimport) long __stdcall InterlockedExchange(long volatile*, long);
       __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long volatile*, long);
   }
   
   #endif

To this:

   #ifndef __INTERLOCKED_DECLARED
   
   #if !(defined Q_CC_BOR) || (__BORLANDC__ < 0x560)
   
   extern "C" {
       __declspec(dllimport) long __stdcall InterlockedCompareExchange(long *, long, long);
       __declspec(dllimport) long __stdcall InterlockedIncrement(long *);
       __declspec(dllimport) long __stdcall InterlockedDecrement(long *);
       __declspec(dllimport) long __stdcall InterlockedExchange(long *, long);
       __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long *, long);
   }
   
   #else
   
   extern "C" {
       __declspec(dllimport) long __stdcall InterlockedCompareExchange(long volatile*, long, long);
       __declspec(dllimport) long __stdcall InterlockedIncrement(long volatile*);
       __declspec(dllimport) long __stdcall InterlockedDecrement(long volatile*);
       __declspec(dllimport) long __stdcall InterlockedExchange(long volatile*, long);
       __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long volatile*, long);
   }
   
   #endif
   
   #endif

Compile MythTV

try to compile mythv and if successful the plugins too!

 cd /c/mythtv
 cd mythtv
 ./configure --prefix=/usr --disable-dbox2 --disable-hdhomerun \
 --disable-dvb --disable-ivtv --disable-iptv --disable-joystick-menu \
 --disable-xvmc-vld --disable-x11 --disable-xvmc --enable-directx \
 --enable-memalign-hack --cpu=k8 --compile-type=debug
 make 
 make install
 cd ..
 cd mythplugins
 ./configure --prefix=/usr --disable-mythgallery --disable-mythmusic \
 --disable-mytharchive --disable-mythbrowser --disable-mythflix \
 --disable-mythgame --disable-mythnews \
 --disable-mythzoneminder --disable-mythweb --enable-aac --enable-libvisual \
 --enable-fftw --compile-type=debug --disable-x11 --disable-v4l --disable-audio-oss \
 --disable-audio-alsa --disable-ivtv --enable-directx
 make
 make install
 cd ..

Test Running Mythtv

script to assemble it all together

After successfully running 'make' you might want to try/test running mythtv and/or your 'make install' may not work. I made a quick shell script to copy all the (aparently) needed .exe and .dll files into the same folder, so that mythfrontend will at least start (even if it does still crash before starting any sort of GUI):

 #!/bin/bash
 cd /c/mythtv/mythtv
 # keep around just one earlier verion in run_old:
 rm -rf run_old
 mv run run_old
 mkdir run
 # copy exe's and dll's to the run folder:
 find . -name \*.exe | grep -v run | xargs -n1 -i__ cp __ ./run/
 find . -name \*.dll | grep -v run | xargs -n1 -i__ cp __ ./run/  
 # mythtv expects the dll to NOT have the '3' in it.
 cp /qt-3.3.x-p8/lib/libqt-mt3.dll /qt-3.3.x-p8/lib/libqt-mt.dll
 # mythtv needs the qt dll's at runtime:
  cp /qt-3.3.x-p8/lib/*.dll /c/mythtv/mythtv/run
 # qt mysql connection dll has to exist in a subfolder called 'sqldrivers':
 mkdir /c/mythtv/mythtv/run/sqldrivers
 cp /qt-3.3.x-p8/plugins/sqldrivers/libqsqlmysql.dll /c/mythtv/mythtv/run
 cp /qt-3.3.x-p8/plugins/sqldrivers/libqsqlmysql.dll /c/mythtv/mythtv/run/sqldrivers 

You can now run the mythfrontend.exe from /c/mythtv/mythtv/run/mythfrontend.exe

I note that this copies the dlls from the filters subdirectory into run/ Should they go in a filters/ subdirectory? You also copy the linqsqlmysql.dll into the run/ directory as well as sqldrivers/ This did not work for me. -- Simon

first test run

Run ./run/mythfrontend.exe now (from msys, or DOS, or windows is fine), and it will probably complain "Unable to connect to database!" among other errors/debug.

mysql.txt

Create/copy a mysql.txt file that specifies the connection parameters for a mythtv mysql database, and copy it into the ./run/ folder, and try again!

Create these contents of file: C:\mythtv\mythtv\run\mysql.txt

 DBHostName=localhost
 DBUserName=mythtv
 DBPassword=mythtv
 DBName=mythconverg

good crash (is that possible?)

now it probably crashes (which is OK at this point) with :

 C:\mythtv\mythtv\run>mythfrontend.exe
 2007-12-28 15:33:38.968 Using runtime prefix = C:/msys/1.0
 2007-12-28 15:33:39.000 QMulticastSocket: setsockopt - IP_ADD_MEMBERSHIP Error
 2007-12-28 15:33:39.000 QMulticastSocket: setsockopt - IP_ADD_MEMBERSHIP Error
 2007-12-28 15:33:39.015 Empty LocalHostName.
 2007-12-28 15:33:39.015 Using localhost value of SILVER
 QSqlDatabase: QMYSQL3 driver not loaded
 QSqlDatabase: available drivers:
 2007-12-28 15:33:39.015 New DB connection, total: 1
 2007-12-28 15:33:39.015 Unable to connect to database!
 2007-12-28 15:33:39.015 No error type from QSqlError?  Strange...
 QSqlQuery::exec: database not open
 QSqlQuery::exec: database not open
 2007-12-28 15:33:39.093 DB Error (KickDatabase):
 Query was:
 SELECT NULL;
 No error type from QSqlError?  Strange...
 2007-12-28 15:33:39.109 QMulticastSocket: setsockopt - IP_ADD_MEMBERSHIP Error

Installing MySQL Server

Next, you need to actually need to have a mysql server running, and configured to accept the username,password, and database that you specified in the mysql.txt!

You can configure your database on a different (eg existing) mysql server/box (like a linux box), but I STRONGLY urge you to NOT to point it to any existing mythty database without taking a backup first, and realising that you will quote probably break any other mythtv install connected to that database (due to the schema differences in different versions )!

MySQL Community Edition Server - optional (but you need a mysql server of some sort!)

site: http://dev.mysql.com/

direct download (almost): http://dev.mysql.com/downloads/mysql/5.0.html#win32 (then click "Windows ZIP/Setup.EXE")

 Download the installer
 Run it.
 Follow the prompts
 Configure the instance (if it doesn't start at the end of the install, go to Start->All Programs->MySQL->MySQL Server 5.0->MySQL Server Instance Config Wizard. ) 
 Be sure to have mysql "Start/Run as a service"
 Remember the "root password" that you choose.

configuring mysql connection settings in mysql server

Create your new database, username, and password (to match the mysql.txt): (enter a DOS Box)

 c:\>cd c:\mysql\bin
 c:\mysql\bin>mysql -u root -p
 Enter password: <enter your root mysql password>
 mysql>create database mythconverg;  
 mysql>GRANT ALL PRIVILEGES ON *.* TO 'mythtv'@'localhost'  IDENTIFIED BY 'mythtv' WITH GRANT OPTION;
 mysql>GRANT ALL PRIVILEGES ON *.* TO 'mythtv'@'%'  IDENTIFIED BY 'mythtv' WITH GRANT OPTION;
 mysql>quit;


database schema auto-upgrades

Next time you run mythfrontend.exe (once it connects to the database correctly) you will get a long list kinda like this (which is great!) :

 2007-12-28 22:29:59.343 New DB connection, total: 5
 2007-12-28 22:29:59.343 Connected to database 'mythconverg' at host: localhost
 2007-12-28 22:29:59.437 Upgrading to schema version 1113
 2007-12-28 22:29:59.500 Upgrading to schema version 1114
 2007-12-28 22:29:59.609 Upgrading to schema version 1115
 2007-12-28 22:30:00.031 Upgrading to schema version 1116
 .... etc ...

theme issues/locations

At the end of the database connection/upgrade process you may see the error/message below, which simply means your default mythtv theme's are NOT installed where it expected them to be Problem:

 2007-12-28 22:30:34.015 Connected to database 'mythconverg' at host: localhost
 2007-12-28 22:30:35.156 Could not find theme: G.A.N.T
 Couldn't find theme G.A.N.T
 Error in my_thread_global_end(): 1 threads didn't exit

Solution(workaround really):

Copy the entire themes folder form the source location to the destination location:

 mkdir /usr/share/mythtv
 mkdir /usr/share/mythtv/themes
 cp -r /c/mythtv/mythtv/themes/* /usr/share/mythtv/themes/

Copy all the XML menus etc to the share folder:

 cd /c/mythtv/mythtv
 find programs/ -name \*.xml | xargs -n1 -i__ cp __ /usr/share/mythtv

mythtv-setup.exe

Try running mythtv-setup.exe,mythbackend.exe,mythfrontend.exe and see what you can get to go, and what crashes!

 Congratulations on getting this far!

TIP: If you don't want Myth to take up your full screen you can specify --gemoetry WxH

Here are some typical 4:3 window sizes:

 mythfrontend --geometry 800x600
 mythfrontend --geometry 1024x768
 mythfrontend --geometry 1200x900
 mythfrontend --geometry 1600x1200

Typical 16:9 window sizes:

 mythfrontend --geometry 800x450
 mythfrontend --geometry 1024x576
 mythfrontend --geometry 1200x675
 mythfrontend --geometry 1280x720

Problems others have encountered

During dependencies compile processes

SDL - libtool cannot build libtool library libSDL.la

SDL - Buzz is currently unable to build SDL because of this error:

 /bin/sh ./libtool --mode=link gcc -o build/libSDL.la build/SDL.lo build/SDL_error.lo build/SDL_fatal.lo 
 build/SDL_audio.lo build/SDL_audiocvt.lo build/SDL_audiodev.lo build/SDL_mixer.lo build/SDL_mixer_MMX.lo 
 build/SDL_mixer_MMX_VC.lo build/SDL_mixer_m68k.lo build/SDL_wave.lo build/SDL_cdrom.lo build/SDL_cpuinfo.lo 
 build/SDL_active.lo build/SDL_events.lo build/SDL_expose.lo build/SDL_keyboard.lo build/SDL_mouse.lo 
 build/SDL_quit.lo build/SDL_resize.lo build/SDL_rwops.lo build/SDL_getenv.lo build/SDL_iconv.lo   
 build/SDL_malloc.lo build/SDL_qsort.lo build/SDL_stdlib.lo build/SDL_string.lo build/SDL_thread.lo 
 build/SDL_timer.lo build/SDL_RLEaccel.lo build/SDL_blit.lo build/SDL_blit_0.lo build/SDL_blit_1.lo 
 build/SDL_blit_A.lo build/SDL_blit_N.lo build/SDL_bmp.lo build/SDL_cursor.lo build/SDL_gamma.lo 
 build/SDL_pixels.lo build/SDL_stretch.lo build/SDL_surface.lo build/SDL_video.lo build/SDL_yuv.lo   
 build/SDL_yuv_mmx.lo build/SDL_yuv_sw.lo build/SDL_joystick.lo build/SDL_nullevents.lo build/SDL_nullmouse.lo 
 build/SDL_nullvideo.lo build/SDL_diskaudio.lo build/SDL_dummyaudio.lo build/SDL_sysevents.lo 
 build/SDL_sysmouse.lo build/SDL_syswm.lo build/SDL_wingl.lo build/SDL_dibevents.lo build/SDL_dibvideo.lo 
 build/SDL_dibaudio.lo build/SDL_mmjoystick.lo build/SDL_syscdrom.lo build/SDL_sysmutex.lo build/SDL_syssem.lo 
 build/SDL_systhread.lo build/SDL_syscond.lo build/SDL_systimer.lo build/SDL_sysloadso.lo build/version.o  -lm 
 -luser32 -lgdi32 -lwinmm -no-undefined -rpath /usr/lib -release 1.2 -version-info 11:1:11
 libtool: link: cannot build libtool library `build/libSDL.la' from non-libtool objects on this host: 
 build/version.o
 make: *** [build/libSDL.la] Error 1

Solution: In bash, cd to "/sources/SDL-1.2.13", enter the command:

 ./libtool --tag=RC --mode=compile windres src/main/win32/version.rc -o build/version.o 

then edit Makefile and change "$(objects)/version.o" to "$(objects)/version.lo"


libvisual - too many arguments to function 'sched_setscheduler'

libvisual - Jay is currently unable to build libvisual due to this error:

 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../libvisual -I.. -I../libvisual -DPLUG
 PATH=\"/usr/lib/libvisual-0.4\" -g -O2 -mwindows -MT lv_os.lo -MD -MP -MF .deps/
 lv_os.Tpo -c lv_os.c  -DDLL_EXPORT -DPIC -o .libs/lv_os.o
 lv_os.c: In function 'visual_os_scheduler_realtime_start':
 lv_os.c:62: error: too many arguments to function 'sched_setscheduler'
 lv_os.c: In function 'visual_os_scheduler_realtime_stop':
 lv_os.c:80: error: too many arguments to function 'sched_setscheduler'
 make[2]: *** [lv_os.lo] Error 1
 make[2]: Leaving directory `/home/Jay/libvisual-0.4.0/libvisual'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/home/Jay/libvisual-0.4.0'
 make: *** [all] Error 2

Solution: The first of what may be several changes before it works:

At line 62 and 80 in libvisual-0.4.0/libvisual/lv_os.c remove the third parameter, ", &attr"

They should read thus:

62: ret = sched_setscheduler (getpid (), SCHED_FIFO);

80: ret = sched_setscheduler (getpid (), SCHED_OTHER);


There are still other problems:

 Creating library file: .libs/libvisual-0.4.dll.a
 .libs/lv_os.o: In function `visual_os_scheduler_realtime_start':
 C:/msys/1.0/sources/libvisual-0.4.0/libvisual/lv_os.c:63: undefined reference to
 `_imp__sched_setscheduler'
 .libs/lv_os.o: In function `visual_os_scheduler_realtime_stop':
 C:/msys/1.0/sources/libvisual-0.4.0/libvisual/lv_os.c:82: undefined reference to
 `_imp__sched_setscheduler'
 .libs/lv_os.o: In function `visual_os_scheduler_yield':
 C:/msys/1.0/sources/libvisual-0.4.0/libvisual/lv_os.c:96: undefined reference to
 `_imp__sched_yield'
 collect2: ld returned 1 exit status
 make[2]: *** [libvisual-0.4.la] Error 1
 make[2]: Leaving directory `/sources/libvisual-0.4.0/libvisual'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/sources/libvisual-0.4.0'
 make: *** [all] Error 2

Solution: Add "-lpthread" to the LIBS line in "libvisual-0.4.0/libvisual/Makefile"


freetype - syntax error in stdlib.h

Should you get the following error while compiling freetype

 In file included from C:/MSys/1.0/sources/freetype-2.3.5/include/freetype/config/ftstdlib.h:123,
                from ./builds/unix/ftconfig.h:43,
                from C:/MSys/1.0/sources/freetype-2.3.5/src/base/ftsystem.c:29:
 c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:317: error: syntax error before "double"
 make: *** [/sources/freetype-2.3.5/objs/ftsystem.lo] Error 1

make the following changes in line 317 of the file C:\MinGW\include\stdlib.h (change inline to __inline__):

 __inline__ double __cdecl __MINGW_NOTHROW strtod (const char* __restrict__ __nptr, char** __restrict__ __endptr)

After the changes just start the MythInstaller.bat script again and compilation should work.

During QT compile process

QT compile failed it could not find mysql.h

Solution: In mysql.h, there are lines that start with something like "MinGW supports unix API" - make sure you comment or remove them or you will be getting segfaults because the functions will be declared as stdcall when they are cdecl (or something close to it) - Andrei

Andrei - I can't find this information - could you please dig out your mysql.h and provide further details -- Richard Dale

There is no supplied libmysql.a

There are some issues with the mysql package in that there is no supplied libmysql.a

Comments/Solution: You don't need libmysql.a, gcc can link directly against libmysql.dll - Simon Kenyon (Actually, I asked the question; Andre provided the answer)

Alternate solution: In the steps above libmysql.a is created.

QT issue: Are you saying that i don't need to do any of this reimp/dlltool nonsense?

Comments/Solution: Yes, that's what I'm saying. I had more problems with the import libraries than without them. One of the changes I made to qmake's mkspec is to stop generating them. - Andrei ( I think Andrei was refering to the QT patch on Ticket #4270 ?? - Buzz)

uic.exe cannot be found

During QT compilation uic.exe cannot be found, with the following error message:

 mingw32-make[3]: Entering directory `C:/mythfiles/qt-3.3/tools/assistant'
 c:\mythfiles\qt-3.3/bin/uic.exe finddialog.ui -o finddialog.h
 process_begin: CreateProcess(NULL, c:\mythfiles\qt-3.3/bin/uic.exe finddialog.ui -o finddialog.h, ...) failed.
 make (e=2): The system cannot find the file specified.
 mingw32-make[3]: *** [finddialog.h] Error 2

Solution: This might have been caused by the original configure.bat being interrupted. Compile the uic.exe with:

 cd tools\designer\uic
 qmake uic.pro
 mingw32-make

then resume your original compilation of QT:

 cd ..\..\..
 mingw32-make

Linguist/Tutorial Makefile not found

During QT compilation, the process is halted due to a Makefile not existing with the following error:

 mingw32-make[4]: Entering directory `C:/mythfiles/qt-3.3/tools/linguist/tutorial'
 mingw32-make[4]: Makefile: No such file or directory
 mingw32-make[4]: *** No rule to make target `Makefile'.  Stop.

Solution: Create a dummy Makefile in the folder than doesn't have one with the following commands.

 cd tools\linguist\tutorial
 notepad Makefile.

Inside notepad add a single line that reads:

   all:

Save the Makefile

 cd ..\..\..
 mingw32-make

qsound_win.moc not found

I'm getting the following error

 g++ -c -mthreads -w -O2 -fexceptions -frtti -DQT_SHARED -DQT_THREAD_SUPPORT -DQT
 _ACCESSIBILITY_SUPPORT -DQT_TABLET_SUPPORT -DQT_NO_DEBUG -DUNICODE -DQT_MAKEDLL
 -DQT_THREAD_SUPPORT -DQT_NO_CUPS -DQT_NO_NIS -DQT_NO_STYLE_MAC -DQT_NO_STYLE_AQU
 A -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_POCKETPC -DQT_DLL -DQT_MAKEDLL -I"tmp" -
 I"3rdparty/libmng" -I"3rdparty/libjpeg" -I"3rdparty/libpng" -I"3rdparty/zlib" -I
 "C:\msys\1.0\qt/include" -I"tmp/moc/release-shared-mt/" -I"C:/msys/1.0/qt/mkspec
 s/win32-g++" -o tmp/obj/release-shared-mt/qsound_win.o kernel/qsound_win.cpp
 kernel/qsound_win.cpp:194:26: error: qsound_win.moc: No such file or directory
 mingw32-make[2]: *** [tmp/obj/release-shared-mt/qsound_win.o] Error 1
 mingw32-make[2]: Leaving directory `C:/msys/1.0/qt/src'
 mingw32-make[1]: *** [sub-src] Error 2
 mingw32-make[1]: Leaving directory `C:/msys/1.0/qt'
 mingw32-make: *** [init] Error 2
 C:\msys\1.0\qt>

Anyone know what to do to fix this? -- Simon Kenyon

Comments/Solution: I'm not sure why this happens as I had one install of msys work fine and then same error as you. In the end I had to cd into /msys/qt-3/src and edit the Makefile and add -I"c:/msys/qt-3/src/tmp/moc/release-shared-mt" on the INCPATH line (I have the qt-3 src at c:/msys).

This isn't working because during compiling process script writes new Makefile over the last one. I managed to get rid of this error by editing file C:\MSys\1.0\qt-3.3.x-p8\qmake\generators\win32\mingw_make.cpp: Replace section:


inc.replace(QRegExp("\\\\$"), "");
inc.replace(QRegExp("\""), "");
t << " -I" << "\"" << inc << "\"";


with


inc.replace(QRegExp("\\\\$"), "");
inc.replace(QRegExp("\""), "");
inc.replace( QRegExp("/$"), "" );
t << " -I" << "\"" << inc << "\"";


and then trailing slashes of the all include switces are removed and compiling gets forward again. -- Termant

mysql.h: required patch

QT compilation dies when getting to mysql.h / mysql_com.h include files with errors like:

 ...mysql_com.h:183: error: `SOCKET' does not name a type

and the worst part, if mysql.h is not patched, stdcall functions will be compiled as cdecl, which will lead to stack corruption and almost immediate segfaults.


Solution option 1 (Andrei): Disable the section in /mingw/include/mysql.h which undefs WIN defines under MinGW so it now reads:

 #ifdef 0  //__MINGW32__     /* MINGW implements a UNIX API */
 #undef WIN
 #undef _WIN
 #undef _WIN32
 #undef _WIN64
 #undef __WIN__
 #endif

If you don't have a __MINGW32__ section in your mysql.h file, only a __CYGWIN__ section that looks otherwise similar, then Andrei says:

In your mysql.h file, I think you should change this:

 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)

To this:

 #if (defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__)) && !defined(__WIN__)

The important thing is that

 #define STDCALL __stdcall

Should be there, otherwise everything seems to compile properly, but doesn’t work (stdcall functions are called as cdecl, stack pointer does not get restored, you get almost immediate segfaults after a couple of mysql function calls, but not immediately in the mysql call itself). I spent hours trying to figure this out. I think this was also a problem of earlier Cygwin build attempts.

We also need to disable the section in /mingw/include/mysql.h that disables winsock.h so it's always included.

ie Comment out (insert //) in the two lines (one in front and 1 after) "#include <winsock.h> in /mingw/include/mysql.h so it now reads:

 //#ifdef __LCC__  
 #include <winsock.h> /* For windows */ + #ifdef 0 //__MINGW32__ /* MINGW implements a UNIX API */ 
 //#endif

uic.exe unable to find libqt-mt3.dll

For whatever reason, during the build of qt I had a problem with uic.exe not being able to find libqt-mt3.dll.

Solution: Nasty hack:

 copy %QTDIR%\lib to C:\WINDOWS\system32

My QT build (or I might have done it) seems to copy it into %QTDIR\bin --zack

Undefined references to mysql_errno

I get undefined references when trying to compile QT:

 obj/qsql_mysql.o:qsql_mysql.cpp:(.text+0x45): undefined reference to `mysql_errno@4'
 obj/qsql_mysql.o:qsql_mysql.cpp:(.text+0x58): undefined reference to `mysql_error@4'
 obj/qsql_mysql.o:qsql_mysql.cpp:(.text+0x33a): undefined reference to `mysql_free_result@4'
 obj/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3b9): undefined reference to `mysql_data_seek@12'

Solution: This should be fixed by the mysql.h patch above and the proposed solution should not be needed! Looks like it can't find the mysql library (libmysql.a). Follow the steps precisely in the MySQL section above (particularly the reimp section) to create libmysql.a

ld.exe cannot find library -lmysql.lib

Solution: Looks like the qt patch (I used the combined patch) is missing a change to the qt-3.3.x-p8/plugins/src/sqldrivers/mysql/mysql.pro file for removing the .lib from the library links. I just edited the Makefile manually and changed -lmysql.lib to -lmysql --zack


During MythTV compile process

pr command not found

 ./configure: line 245: pr: command not found

Solution: The 'pr' command is missing from your mingw install, installing "additional components" into your MSYS install will fix this (see earlier steps above for hints). The additional component is "coreutils".

ERROR! You must have FreeType installed to compile MythTV

I have compiled all of the dependencies and such but when I go to run the configure script for myth I get:

 "ERROR! You must have FreeType installed to compile MythTV."

Solution:

 Have you installed freetype with "make install"? Do you have  libfreetype-6.dll in your mingw bin 
 directory and freetype2/freetype in your include directory?
 I installed the libraries directly to the mingw installation: "./configure --prefix=/mingw && make && make install" - zack

Comment: I have confirmed the problem named above occurs when you use "--prefix=/usr", and Zacks solution fixes it. no idea why though, as my LD_LIBRARY_PATH specify both. - Buzz.

Linker complains about not finding libs=

When compiling mythtv the linker complains about not finding libs.

Solution: You either haven't installed the prerequisite libraries or you haven't set the LD_LIBRARY_PATH environment variable

dsound.h not found

 In file included from audiooutput.cpp:13:
 audiooutputdx.h:9:39: dsound.h: No such file or directory
 audiooutputdx.h:34:2: warning: #warning Several methods in AudioOutputDX need to be implemented...
 In file included from audiooutput.cpp:13:
 audiooutputdx.h:60: error: `LPDIRECTSOUND' does not name a type
 audiooutputdx.h:61: error: `LPDIRECTSOUNDBUFFER' does not name a type
 audiooutputdx.h:64: error: `LPDIRECTSOUNDNOTIFY' does not name a type
 audiooutputdx.h:65: error: `DSBPOSITIONNOTIFY' does not name a type
 make[2]: *** [audiooutput.o] Error 1
 make[2]: Leaving directory `/c/mythtv/mythtv/libs/libmyth'
 make[1]: *** [sub-libmyth] Error 2
 make[1]: Leaving directory `/c/mythtv/mythtv/libs'
 make: *** [sub-libs] Error 2

Solution: You don't have the "directX header files" - please install these as per the above!

Mythtv installation errors on cp command

Problem: Mythtv installation errors on the cp command.

Solution: Alter the Makefiles (at least mythtv/themes/Makefile) at COPY_DIR to:

 COPY_DIR        =       cp -rf

Mythtv cannot find libqt-mt

Mythtv compilation fails with something like can't find libqt-mt.

Solution: you missed the step about copying the dll to a different name above:

 cd $QTDIR/lib
 copy libqt-mt3.dll libqt-mt.dll

Compile warnings on redclared with dllimport attribute

During mythtv make, various warnings about:

 c:/qt/3.3.x-p8/include/qpixmap.h:249: warning: 'void bitBlt(QPaintDevice*, int, int, 
 const    QPaintDevice*, int, int, int, int, Qt::RasterOp, bool)' 
 redeclared without dllimport attribute after being referenced with dllimport linkage

Anyone know what to do to fix this? -- Arnon

Solution: ??none known??

Comment: I get these also but the build completes okay. --zack

Kerneldeint storage size of tv isn't known

Problem - during compile of filter_kerneldeint.c the following error appears (as of SVN 15244):

 filter_kerneldeint.c: In function `KernelDeint':
 filter_kerneldeint.c:265: error: storage size of 'tv' isn't known

Solution:

This problem has been resolved in SVN as of 15245. Perform an SVN Update to bring your source code up-to-date.


no such file or directory config/config.pro

Problem:

 build and/or 'make install' cant find config.pro

Solution:

Create it as an empty file:

 touch /c/mythtv/mythtv/config/config.pro

during compile of libmyth error about WSAEventSelect not found

Solution: Added -lWs2_32 to the LIBS variable in the libmyth/Makefile --zack

usleep causing compile of 0.21-fixes to fail

Problem:

 c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/unistd.h:35:
     error: syntax error before '(' token

Solution:

Wrong version of MinGW runtime is installed: 0.21-fixes needs MinGW 3.14, trunk needs 3.15+. Reinstall MinGW, making sure to choose "Previous" package when prompted by the MinGW Automated Installer.

Installation of plugins failed

Problem:

COMMENTS:------------------------------
COMMENTS:PLUGINS! make install
COMMENTS:------------------------------

shell:C:\MSys\1.0\bin\bash.exe -c "( export PATH=/bin:/mingw/bin:$PATH;source /C
/mythtv/qt3_env.sh;cd /C/mythtv/mythplugins;make install) 2>&1 "
cd mythvideo && \
qmake mythvideo.pro -o Makefile  "QMAKE=C:/MSys/1.0/qt-3.3.x-p8/bin/qmake"
cd mythweather && \
qmake mythweather.pro -o Makefile  "QMAKE=C:/MSys/1.0/qt-3.3.x-p8/bin/qmake"
cd mythmovies && \
qmake mythmovies.pro -o Makefile  "QMAKE=C:/MSys/1.0/qt-3.3.x-p8/bin/qmake"
cd cleanup && \
qmake cleanup.pro -o Makefile  "QMAKE=C:/MSys/1.0/qt-3.3.x-p8/bin/qmake"
Error processing project file: C:/mythtv/mythplugins/cleanup/cleanup.pro
make: *** [qmake_all] Error 2
EFFECT FAILED (newer -> shell): mtime of file (C:/mythtv/build/bin/mythtv/plugin
s/libmythmovies.dll) should be greater than file (C:/mythtv/mythplugins/mythmovi
es/mythmovies/libmythmovies.dll).
[0]  [1243764913]

At MythTV runtime

Mythtv dies when starting with a NO SQL drivers message

Solution:

 cd $QTDIR/lib && cp ../plugins/sqldrivers/libqsqlmysql.dll .

If you don't have a dll called plugins/sqldrivers/libqsqlmysql.dll in the plugins/sqldrivers folder of your qt build, then it's possible that your c:\MingW\include\mysql.h file is incorrect (which sometimes allows qt to build, but prevents this specific dll from appearing as it should).

QSocketNotifier never generates signals

During debugging, I found one more bug in QT: QSocketNotifier never generates "signals" for listening sockets, which effectively prevents anything that listens incoming connections (mythbackend and possibly UPNP code in mythfrontend too) from accepting them. - Andrei (was this you?)

Solution:

 ??none known??

Mythtv crashes with Unable to connect to database!

 2007-12-29 12:17:35.921 Unable to connect to database!
 2007-12-29 12:17:35.921 No error type from QSqlError?  Strange...
 2007-12-29 12:17:35.984 DB Error (KickDatabase):
 Query was:
 SELECT NULL;
 No error type from QSqlError?  Strange...

Hack solution: It can't find one or more dlls... One or more of the following might help:

 mkdir /c/mingw/bin/sqldrivers
 cp /c/mingw/lib/libmySQL.dll /c/mingw/bin
 cp $QTDIR/plugins/sqldrivers/libqsqlmysql.dll /c/mingw/bin/sqldrivers  
 cp $QTDIR/plugins/sqldrivers/libqsqlmysql.dll /c/mingw/bin

Alternate solution for those running from /c/mythtv/mythtv/run/ folder (as per testing section):

 mkdir /c/mythtv/mythtv/run/sqldrivers
 cp $QTDIR/plugins/sqldrivers/libqsqlmysql.dll /c/mythtv/mythtv/run/sqldrivers

Alternate solution. I encountered a problem that my qt make was not creating the appropriate MYSQL drivers.

 To test the the QT MYSQL driver, I used the examples/sql/blob program. 
 Change line 16 in main.cpp to read #define DRIVER       "QMYSQL3"
 Run make and blob.exe (from mingw or DOS window)
 If you get an error about no Drivers found, QT has not built the plugin correctly.
 To build the drivers manually:
  Make sure you have MySQL installation files with the Libs & Include Files
  Build the plugin as follows (here it is assumed that MySQL is installed in C:\MYSQL):
  cd %QTDIR%\plugins\src\sqldrivers\mysql
  qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pro
  mingw32-make
  Then copy libqsqlmysql.dll to the run directory

Mythfrontend reports could not blit surface

Starts OK but when you try to display video you see:

 2007-12-29 12:29:15.828 could not blit surface (error 80004005)

I see this in vmware/windows 2000 when trying to run mythfrontend in there... perhaps it's the virtual video driver not having enough real video features to display -- Richard Dale

Solution: You need a 'real' (as in not VMWare/Virtual PC) hardware videocard with full DirectX 9 support to use Direct3D video output.

Possible solution: DirectX 9.0c Runtime might not be installed (correctly)... download it from http://www.microsoft.com/downloads/details.aspx?familyid=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&displaylang=en

Workaround: Use "DirectX" video output - it uses overlays and is much less demanding (though still won't work in a virtual machine), but it's not compatible with Vista Aero.

Mythfrontend video is wrong ratio due to portrait screens

Richard Dale reports that video image being display appears to be the wrong ratio. Richard runs two screens in portrait mode side-by-side (for a combined desktop size of 2400x1920, with each screen being 1200x1920 in portrait mode). Platform details: Windows Vista 64, nvidia 7800GTX, nvidia driver pretty recent (don't have this information to hand)

When mythfrontend displays a video, in a 16:9 ratio window (1200x675) or with no window geometry set, it is scaled in a strange way: http://www.premiumdata.net/temp/mythfrontend-strange-scaling.jpg

It's really is quite wonky (off to the right, and bottom chopped off image).

Relevant output from mythfrontend:

 2007-12-29 15:06:38.415 Total desktop dim: 2400x1920, with 2 screen[s].
 2007-12-29 15:06:38.433 Connected to database 'mythconverg' at host: 192.168.12.222
 2007-12-29 15:06:38.434 Using screen 0, 1200x1920 at 0,0
 Unable to ignore SIGPIPE
 2007-12-29 15:06:38.554 Overriding GUI, width=1200, height=675 at 0,0

Help appreciated (and it's clear the Indian cricketers need help too!!)

Compile error in libs/libmythsoundtouch/FIRFilter.cpp

Maybe I did something wrong in rebuilding qt, but now I get the following error:

g++ -c -march=i586 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -D__STDC_CONSTANT_MACROS -fPIC -DPIC -mthreads -w -fno-exceptions -fno-rtti -DUSING_MINGW -DUSING_WINAUDIO -DUSING_D3D -DUSING_DIRECTX -DUSING_DIRECTX -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DPREFIX=\"/usr\" -DLIBDIR=\"/usr/lib\" -DQT_THREAD_SUPPORT -I"/usr/include" -I"../../libs/libavcodec" -I"../.." -I"/qt/include" -I"C:/msys/1.0/qt/mkspecs/win32-g++" -o FIRFilter.o FIRFilter.cpp FIRFilter.cpp: In member function 'virtual void FIRFilter::setCoefficients(const soundtouch::SAMPLETYPE*, uint, uint)': FIRFilter.cpp:173: error: exception handling disabled, use -fexceptions to enable

The line in question is:

if (newLength % 8) throw std::runtime_error("FIR filter length not divisible by 8");

Vista 64 compatibility during compile

There seems to be some serious GCC/MSYS/MinGW Vista 64 bit edition compatibility issues with respect to most of the initial steps failing under Vista 64. Could anyone trying out this environment please post how they were able to workaround each step to achieve compile?

Further info regarding MinGW-64: https://sourceforge.net/project/showfiles.php?group_id=202880

0.21-fixes crashes at startup

If mysql.txt cannot be found, 0.21-fixes frontend may crash due to a bug in UPnP. Create a mysql.txt and place it in your appdata directory. -- On WinXP: "%APPDATA%\.mythtv" -- On Vista: "%LOCALAPPDATA%\.mythtv"

0.21-fixes and pulseaudio

When running the latest 0.21-fixes, I was getting an error along the lines of 'pulseaudio is running but mythtv was not compiled with pulseaudio support. Exiting' when trying to start mythfrontend even though there is no way I was running pulseaudio on my windows machine. To fix this I edited the file "mythtv/libs/libmyth/util.cpp", then found the function:

 bool IsPulseAudioRunning(void)

and added a return 0; to the start of the function, so it always thought pulseaudio wasn't running:

 bool IsPulseAudioRunning(void)
 {
 	return 0;
 #if defined(CONFIG_DARWIN) || (__FreeBSD__) || defined(__OpenBSD__)
 ...

then I recompiled and mythfrontend started fine.