Cross-compiling to OS X from i386 Linux

Hi,

I have a build script (SCons-based) that allows me to compile i386 Linux and
win32 versions of my game on my Linux box. For building the win32 files, I
manually switch the compiler commands to those from Debian’s mingw32 package.

Now I’d like to be able to build Mac OS X versions too, for both PPC and Intel
systems. I don’t have a Mac myself, so all I can do is try to figure out how
to build the executables and then have friends test the results. However, I
can’t seem to find much information on cross-compiling for OS X, and even
less for the new Intel systems.

Any hints?

Thx,
Marian.–
http://marianschedenig.no-ip.org/

Hofstadter’s law: “It always takes longer than you think, even when you take
account of Hofstadter’s law”.

Marian Schedenig wrote:

Now I’d like to be able to build Mac OS X versions too, for both PPC and Intel
systems. I don’t have a Mac myself, so all I can do is try to figure out how
to build the executables and then have friends test the results. However, I
can’t seem to find much information on cross-compiling for OS X, and even
less for the new Intel systems.

Any hints?

I do not know, but would it be possible for you to ssh into an OS X
system and use the native compiler?

I don’t know of any place where the OS X system headers are easily
available, outside of the entire OS. The sources for Apple’s GCC are
available, so it’s probably doable, but it’ll also probably be more
effort than it is worth.

I suggest finding someone willing to donate an SSH account on a OS X
system.

RichardOn Apr 7, 2006, at 5:30 PM, Marian Schedenig wrote:

Hi,

I have a build script (SCons-based) that allows me to compile i386
Linux and
win32 versions of my game on my Linux box. For building the win32
files, I
manually switch the compiler commands to those from Debian’s
mingw32 package.

Now I’d like to be able to build Mac OS X versions too, for both
PPC and Intel
systems. I don’t have a Mac myself, so all I can do is try to
figure out how
to build the executables and then have friends test the results.
However, I
can’t seem to find much information on cross-compiling for OS X,
and even
less for the new Intel systems.

Any hints?

Thx,
Marian.

Sourceforge seems to have some OSX machines in their compile farm:

  • ppc-osx1: Apple Mac OS X 10.1 Server with Fink running on an Apple Mac G4
  • ppc-osx2: Apple Mac OS X 10.2 Server with Fink running on an Apple Mac G4

http://sourceforge.net/docman/display_doc.php?docid=762&group_id=1
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060408/64c788a4/attachment.pgpOn Fri, Apr 07, 2006 at 08:48:18PM -0700, Richard Schreyer wrote:

I suggest finding someone willing to donate an SSH account on a OS X
system.

Too bad they’ve been down since October or something :(On 4/8/06, Mikael Eriksson <mikael_miffe_eriksson at yahoo.se> wrote:

On Fri, Apr 07, 2006 at 08:48:18PM -0700, Richard Schreyer wrote:

I suggest finding someone willing to donate an SSH account on a OS X
system.

Sourceforge seems to have some OSX machines in their compile farm:

  • ppc-osx1: Apple Mac OS X 10.1 Server with Fink running on an Apple Mac
    G4
  • ppc-osx2: Apple Mac OS X 10.2 Server with Fink running on an Apple Mac
    G4

http://sourceforge.net/docman/display_doc.php?docid=762&group_id=1

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEN0A/vx/Vpt9bMQIRAvVWAJ0cYiCUGqAq3EhT0RlDteZCbO7IxwCgj1pJ
yO7IMiyVhxk+10bRaDcEgwQ=
=C3VJ
-----END PGP SIGNATURE-----


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Cheers,
Josh

PGP: http://revvy.box43.net/Josh_Matthews.asc

I don’t know of any place where the OS X system headers are easily
available, outside of the entire OS. The sources for Apple’s GCC are
available, so it’s probably doable, but it’ll also probably be more
effort than it is worth.

The latest XCode ships with various OS “SDKs”, which are the libraries
and headers for a given version of Mac OS X all seperated out, so you
can build for legacy versions no matter what your Mac’s actual system
headers and libraries look like. That part is easy.

Also, Apple maintains a public CVS that has their versions of GCC and
binutils source code, and they have the CVS tagged to match the releases
they ship. That part is easy, too.

Putting it all together? That part’s a little harder. :slight_smile:

–ryan.

Thanks. Sounds trickier than expected, but I’ll give it a try. If I get it to
work, I’ll post the necessary steps. Otherwise, I’ll go back to the other
suggestions and find someone who lets me run the build process on his system,
but I’d really rather do it all here on my own computer (and after all, it
works like a charm for the win32 binary and installer).

Marian.On Saturday 08 April 2006 11:41, Ryan C. Gordon wrote:

The latest XCode ships with various OS “SDKs”, which are the libraries
and headers for a given version of Mac OS X all seperated out, so you
can build for legacy versions no matter what your Mac’s actual system
headers and libraries look like. That part is easy.

Also, Apple maintains a public CVS that has their versions of GCC and
binutils source code, and they have the CVS tagged to match the releases
they ship. That part is easy, too.

Putting it all together? That part’s a little harder. :slight_smile:


http://marianschedenig.no-ip.org/

Hofstadter’s law: “It always takes longer than you think, even when you take
account of Hofstadter’s law”.

The latest XCode ships with various OS “SDKs”, which are the
libraries
and headers for a given version of Mac OS X all seperated out, so you
can build for legacy versions no matter what your Mac’s actual system
headers and libraries look like. That part is easy.

Also, Apple maintains a public CVS that has their versions of GCC and
binutils source code, and they have the CVS tagged to match the
releases
they ship. That part is easy, too.

Putting it all together? That part’s a little harder. :slight_smile:

Thanks. Sounds trickier than expected, but I’ll give it a try. If I
get it to
work, I’ll post the necessary steps. Otherwise, I’ll go back to the
other
suggestions and find someone who lets me run the build process on
his system,
but I’d really rather do it all here on my own computer (and after
all, it
works like a charm for the win32 binary and installer).

You’ll have quite a time trying to get even the files out of an Xcode
distribution, since it’s distributed as a dmg disk image (I think
you’d have to read xnu kernel source to figure out how to read one,
plus the contents is probably HFS+), and in that you have .pkg
bundles (which contain pax archives and some metadata).

If you were using some high-level language binding like pygame
without any additional C code, it wouldn’t be too hard to put
together the files required… but it’s probably a lost cause to try
and get a development environment up from scratch on i386.

If I were to even try, I would start with installing Darwin/x86 under
some VM, because that should at least get you dev tools that do Mach-
O and maybe the capability to mount dmg files.

Good luck.

-bobOn Apr 9, 2006, at 2:57 PM, Marian Schedenig wrote:

On Saturday 08 April 2006 11:41, Ryan C. Gordon wrote:

If I were to even try, I would start with installing Darwin/x86 under
some VM, because that should at least get you dev tools that do Mach-
O and maybe the capability to mount dmg files.

This is super interesting. Do you have any good references on how to
setup OS X on a PC? I could use VMware, wine or others… would you
have any urls for this installation?

Thanks,
Simon

If I were to even try, I would start with installing Darwin/x86 under
some VM, because that should at least get you dev tools that do Mach-
O and maybe the capability to mount dmg files.

This is super interesting. Do you have any good references on how to
setup OS X on a PC? I could use VMware, wine or others… would you
have any urls for this installation?

It’s not legal to set up OS X on a PC (unless that PC happens to be
manufactured by Apple). You could however install Darwin/x86 on a
generic PC (if Darwin supports your hardware, anyway), which MAY get
you part of the way there but certainly not the whole way.

http://www.opensource.apple.com/darwinsource/

Use google to find anything else relevant, setting up Darwin or OS X
is not on topic here.

-bobOn Apr 12, 2006, at 3:02 PM, Simon wrote:

Ryan C. Gordon wrote:

Also, Apple maintains a public CVS that has their versions of GCC and
binutils source code, and they have the CVS tagged to match the releases
they ship. That part is easy, too.

Putting it all together? That part’s a little harder. :slight_smile:

I’ve not found the link that I used when I’ve done it, but I think it
was somewhere in gentoo forums, it’s doable to build a PPC gcc that
target osx, you may need to copy a few files (header and link libraries
mostly) from a real OSX machine, the other stuff (binutils and gcc) are
available on apple site.

[gabry at nevada ggmud]$ ls -lrt /usr/local/crossmac/
total 28
drwxr-xr-x 2 root root 4096 Sep 3 2004 share
drwxr-xr-x 4 root root 4096 Sep 3 2004
powerpc-apple-darwin7.3.0
drwxr-xr-x 4 root root 4096 Sep 3 2004 man
drwxr-xr-x 2 root root 4096 Sep 3 2004 include
drwxr-xr-x 3 root root 4096 Sep 3 2004 lib
drwxr-xr-x 2 root root 4096 Sep 3 2004 info
drwxr-xr-x 2 root root 4096 Sep 3 2004 bin

Bye,
Gabry