Cross-compiling on Malus Sylvestris

Posted by cwright on 2007.04.06 @ 14: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 http://ranger.befunk.com/fink/darwin-cross/ 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.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <pre> <div> <span> <b> <i> <br> <table> <tr> <td> <th> <small> <sub> <tex> <equation> <equations> <s>
  • You can enable syntax highlighting of source code with the following tags: [code], [blockcode], [applescript], [bash], [c], [cpp], [css], [diff], [drupal5], [drupal6], [html4], [java], [javascript], [latex], [lisp], [lua], [m68k], [make], [mysql], [objc], [pascal], [perl], [php], [python], [ruby], [sql], [xml].
  • You may insert videos with [video:URL]
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Adds typographic refinements.
  • LaTex commands embedded in text will be interpreted and rendered. Additional information can be found at DruTex Documentation Pages
    • Allowed commands include: \atop \binom \cdot \cfrac \choose \frac \int \ln \over \sum \to
      Allowed environments include: align array equation equations gather matrix split
    • Provides different environments to create rendered images (especially maths).
    • Assists automatic numbering of tex, equation, and equations environments.

    More information about formatting options