Cross-compiling on Malus Sylvestris

Posted by cwright on 2007.04.06 @ 15:42

Filed under:

After working my way through most of the migration to Mac, I came across a common problem for multi-platform developers like myself. The problem is the creation and use of applications targeted for another platform. For example, using a Linux compiler to develop Windows applications, or using an OS X compiler to develop Linux applications.

This is a fairly common problem, and also fairly simple to solve. The resultant tool kit is referred to as a Cross-Compiler, because is crosses platforms, and it compiles source code into target code. For Linux, my cross-compiler of choice was created and maintained by SDL, and can be found here. This allowed me to write Windows programs without needing to actually run Windows. Since both Linux and Windows were my complete set of frequented platforms, that sufficed. Now, however, one more platform has entered the mix.

Fortunately, ECN/IRCCyN provides a cross-compiler, and it works just like other cross-compilers I’ve used. The only quirk with this one is that it installs to /usr/local/, which is “correct” but not so much for OS X. I mentioned this attribute in Part 1 of Malus Sylvestris Migration.

This tool is basically a port of GCC to OS X, but which generates code for Win32. If you’re familiar with GCC, you’re good to go. Just be sure to look in the right place for the program.

Still waiting for a cross compiler that runs on Linux and targets OSX… That would allow a lot of shops to support OSX with their codebase.

There’s a how-to at that looks promising. However, I’ve not tried it, and I don’t use Linux nearly as much as I did in the past, so your mileage may vary. The take home points there are probably in configuring the compile nodes, which are Linux-based.