Difference between revisions of "MythTV on Windows"

From MythTV Official Wiki
Jump to: navigation, search
(Compile and build QT: fixed missing makefile in tools\linguist\tutorial)
m (Compile and build QT: better explanation)
Line 505: Line 505:
 
   process_begin: CreateProcess(NULL, C:\msys\1.0\qt-3.3.x-p8/bin/uic.exe finddialog.ui -o finddialog.h, ...) failed.
 
   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.
 
   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 requiredThe workaround is as follows:
+
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
 
   echo all: > tools\linguist\tutorial\Makefile
 
   cd tools\designer
 
   cd tools\designer

Revision as of 11:58, 28 December 2007

Contents

Summary

A Windows port of MythTV is in-the-works, using MinGW as the build platform, and MS Direct3D as the display layer. The frontend compiles, and most basic functionality works, but it crashes regularly. The patches are currently working their way into SVN, so check the -dev list, and Trac for the current state. Once the frontend is reliable, we can start to see about getting the changes necessary to get MythBackend to run.

Background & Caveats

Cygwin was previously a limiting factor as it introduced a dependency on cygwin1.dll. We have moved to MinGW, which compiles all the necessary functions statically, rather than linked in through a separate dll.

Please start by reading this link: http://mythtv.org/pipermail/mythtv-dev/2007-December/058662.html

the Trac reference is here: http://svn.mythtv.org/trac/ticket/4270

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.

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.

HOWTO

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=529741

 *When installing, be sure to install g++ in addition to the default gcc.   
 *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 will be trying to build 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.5.10425-win32-svn-1.4.5.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 at 20071228 there is one patch that needs to be applied to SVN that hasn't yet been incorporated into the SVN Trunk.

Download the following file: http://svn.mythtv.org/trac/raw-attachment/ticket/4382/mythverbose.patch

 cp mythverbose.patch /c/mythtv/mythtv
 cd /c/mythtv/mythtv
 patch -p0 < mythverbose.patch 

The above patch is now incorporated into SVN trunk (r15245), so is no longer required.

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.
  • 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 /ming/include/mysql.h so that WIN is defined for MINGW32

If you see:

 #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, 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/lib/pthreadGC2.dll
 cp pthreadGC2.dll /c/mingw/lib/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)

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=/usr;make;make install

TIP: if you get "ld.exe -l libmp3lame not found" (or similar) when compiling mythtv, you probably haven't set LD_LIBRARY_PATH as shown in the QT and compiler environment variables setup.

TIP: Alternatively, rebuild lame with

 ./configure --prefix=/mingw

as ld will search for libraries in there by default.

mad

version 0.15.1b from sourceforge http://www.underbit.com/products/mad/

direct download (almost): http://sourceforge.net/project/showfiles.php?group_id=12349&package_id=86999&release_id=217880

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

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. 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

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. Mark Spieth 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

Add the following line to the end of /mingw/include/limits.h (otherwise flac will not compile)

 #define SIZE_T_MAX UINT_MAX 

More information on this patch can be found at http://forum.zdoom.org/viewtopic.php?f=7&t=15452&p=310197

Compile with:

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

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/

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)

Optional libraries

tiff

Optional library (to display TIFF images) for MythGallery. http://www.libtiff.org/

Direct download: ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz

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

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.

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 environment variable

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.

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

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!

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

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 %QTDIR%\bin\sh_.exe %QTDIR%\bin\sh_.exe
   c:\>rename %MINGW%\bin\sh_.exe %MINGW%\bin\sh.exe             # may not exist, but if it does, rename it.


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-mythphone \
 --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

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
 find . -name \*.exe  | xargs -n1 -i__ cp __ ./run/
 find . -name \*.dll  | xargs -n1 -i__ cp __ ./run/
 cd run
 cp /lib/libqt-mt3.dll ./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.

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

now it probably crashes 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

<this is where Buzz is up to - can anyone help?>

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: None yet - contribute here!

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:

See ticket 4382 (http://svn.mythtv.org/trac/ticket/4382)

direct download: http://svn.mythtv.org/trac/raw-attachment/ticket/4382/mythverbose.patch

 apply the patch (similar to how it was done above):
 cp mythverbose.patch /c/mythtv/mythtv
 cd /c/mythtv/mythtv
 patch -p0 < mythverbose.patch 

then try running 'make' again! - it should finally compile now! :-)

Comment: Yes that fixed it. If others can comment on this resolving the issue too, I'll put this step into the main compile process steps above (until the ticket is incorporated into SVN) -- Richard Dale

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).

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

At MythTV runtime

Mythtv dies when starting with a NO SQL drivers message

Solution:

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

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??