MythTV on Mac x86

From MythTV Official Wiki
Revision as of 14:52, 12 March 2006 by 24.3.244.218 (Adding faster bswap stuff.)

Jump to: navigation, search

MythTV currently does not build on the new Intel based Apple Macintosh platforms. This page is intended to share information among the people attempting to get this working.

In the 'contrib' directory of the MythTV source code, there is a perl script which automates the build process for MythTV on MacOS systems. The script is called osx-packager.pl. My descriptions of changes needed assume that script as a starting point.


Changes Needed

Here's a brief summary of chages I made to get further into the build process (updated with Brendan White's config info):

  • Enable backend, 'osx-packager.pl -enable-backend'. Otherwise, the frontend fails when necessary components aren't available.
  • libdvdnav: Endian byte swapping missing from bswap.h. Probably due to not recognizing the arch. Added the generic example macro in the 'else' case & it compiled.
  • libexif: compile failed. comment out the 'static' in exif-utils.c line 83.
  • libdvdread: Endian byte swapping missing from bswap.h. Probably due to not recognizing the arch. Added the generic example macro in the 'else' case & it compiled.

Instead of the generic else case for bswap, you can use the Apple-supplied routines:

#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define B2N_16(x) x = OSSwapBigToHostConstInt16(x) 
#define B2N_32(x) x = OSSwapBigToHostConstInt32(x)
#define B2N_64(x) x = OSSwapBigToHostConstInt64(x)

MythTV changes:

  • Update osx-packager.pl to add configure parameters used in building MythTV. In the section "configure mythplugins, and mythtv, etc", the 'mythtv' portion should look something like this:
 'mythtv'
 =>  [
       '--disable-distcc',
       '--disable-mmx',
       '--arch=i686', 
       '--extra-cxxflags=-msse -msse2 -msse3', 
       '--prefix=' . $PREFIX,
     ],
  • Fix mythtv/libs/libavcodec/liba52/resample.c -- Even though mmx has been disabled, there are some silly assumptions in this file. remove the ifdef that includes resample_mmx.c. Also remove the ifdef ARCH_X86 stanzas.
  • 3rd bswap.h patch, this time in mythlibdvd
  • Fix BaseClasses.h (called from Actions.cpp), #include <malloc.h> to #include <sys/malloc.h>

Current Status

The binary is compiling now. But, when it is executed, a bus error is generated, apparently in QT:

Date/Time: 2006-03-11 18:10:55.430 -0800
OS Version: 10.4.5 (Build 8H1619)
Report Version: 4

Command: mythfrontend
Path: /Users/tji/Build/try3/MythFrontend.app/Contents/MacOS/mythfrontend
Parent: WindowServer [379]

Version: 0.19.0.svn20060312 (0.19.0.svn20060312)

PID: 8742
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x0000000c

Thread 0 Crashed:
0 qt-mt 0xb20504dd qt_macFamilyName(QString const&) + 141
1 qt-mt 0xb202b42b QFontPrivate::load(QFont::Script) + 1027
2 qt-mt 0xb202b870 QFontMetrics::width(QChar) const + 58
3 qt-mt 0xb234b729 QFontMetrics::width(char) const + 33
4 qt-mt 0xb210610e QLabel::sizeForWidth(int) const + 118
5 qt-mt 0xb21067ac QLabel::minimumSizeHint() const + 92
6 qt-mt 0xb2106890 QLabel::sizeHint() const + 36
7 qt-mt 0xb21052c2 QLabel::setText(QString const&) + 60

Thread 1:
0 libSystem.B.dylib 0x900251e7 semaphore_wait_signal_trap + 7
1 qt-mt 0xb22a87e6 QWaitCondition::wait(unsigned long) + 226
2 myth 0xc600b9c1 MythContext::waitPrivRequest() const + 33

Thread 0 crashed with i386 Thread State:
eax: 0xffff02a0 ebx: 0xb205045e ecx:0x01800038 edx: 0x01175210
edi: 0xbffff09c esi: 0x00000000 ebp:0xbffff0b8 esp: 0xbffff080
ss: 0x0000002f efl: 0x00010286 eip:0xb20504dd cs: 0x00000027
ds: 0x0000002f es: 0x0000002f fs:0x00000000 gs: 0x00000037

Useful Links

ffmpeg updates for mmx assembly code

Other Notes

'/proc/cpuinfo/' is used to determine CPU type in linux builds. In MacOS, "/usr/sbin/system_profiler SPHardwareDataType" could be used to determine the architecture and CPU type.