[mythtv] Linux to MacOSX cross compilation

Lawrence Rust lvr at softsystem.co.uk
Thu Mar 3 11:23:54 UTC 2011

On Wed, 2011-03-02 at 18:15 -0800, Emlyn Bolton wrote:
> Thanks for the script Lawrence, I have found a small bug.  Once you
> build xar, it needs to change back to the main working directory or
> else it will fail to find the xcode dmg.

Thanks for the feedback - fixed.

> I also discovered that you need to have both bison and flex installed
> to get compilation to happen.

OK, I've added bison & flex to the installation tests.

> Once those issues were resolved, I ran into some problems compiling
> gcc.  It looks like a combination between some code generation and the
> compiler not behaving properly.  The gcc on my gentoo box and unbuntu
> 10.10 don't like the comments inserted by the gcc code generation
> tools, causing the build to fail.  What is your build machine's gcc
> version?

I'm running Ubuntu 10.10 with latest updates.

gcc --version
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
> make[2]: Entering directory
> `/home/mythtv/mythbuilder/build-gcc-5247.i686-apple-darwin*/gcc'
> gcc -c   -g -O2 -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings
> -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long
> -Wno-variadic-macros -Wold-style-definition  -Wno-error
> -I../../gcc-5247.i686-apple-darwin*/gcc
> -I../../gcc-5247.i686-apple-darwin*/gcc/build
> -I../../gcc-5247.i686-apple-darwin*/gcc/../include
> -I../../gcc-5247.i686-apple-darwin*/gcc/../libcpp/include  \
> -o build/insn-conditions.o insn-conditions.c
> In file included from tm_p.h:6,
>                  from insn-conditions.c:22:
> tm-preds.h:2: error: expected '=', ',', ';', 'asm' or '__attribute__'
> before '/' token
> In file included from tm_p.h:6,
>                  from insn-conditions.c:22:
> tm-preds.h:2:96: warning: missing terminating ' character
> tm-preds.h:2: error: missing terminating ' character
> insn-conditions.c:1706: warning: string length '597' is greater than
> the length '509' ISO C90 compilers are required to support

After a successful build, the file tm-preds.h looks like this:

/* Generated automatically by the program 'build/genpreds'
   from the machine description file '../../gcc-5247.i686-apple-darwin8/gcc/config/i386/i386.md'.  */

#ifndef GCC_TM_PREDS_H
#define GCC_TM_PREDS_H

So it must be gcc that's taken exception to the comment spanning lines 1
to 2, particularly the quoted string on line 2; strange.  The file is
generated by gcc/genpreds.c, which if you look at it seems quite
innocuous.  Perhaps you could confirm what the first few lines of
build-gcc-5247.i686-apple-darwin8/gcc/tm-preds.h contain?  Maybe this is
a file system problem or a race condition.  Perhaps try mkodcctools

I have updated the cross compiler build script with your suggestions and
added support for more versions of XCode, SDK and gcc.  It's available
as a direct download from here:
or with git from here:
git clone http://www.softsystem.co.uk/git/mythbuilder.git

-- Lawrence

More information about the mythtv-dev mailing list