Writing portable apps under Gentoo

Sun, 12 October, 2008

For a previous C project for work, I developed a Windows app on Linux. The clunky workflow:

  • Write the entire app in Linux, being careful to use only the C Standard Library.
  • Move the source onto a Windows box.
  • Using Eclipse,CDT, and MinGW, coerce a working build.
  • If cross-platform changes were needed, make the edits twice.

You can imagine this workflow is unsustainable for projects larger than my little console app. Fortunately, I'm now set up to do the whole shebang on my Gentoo box, using MinGW and Wine. Tonight, I've compiled and run a Windows-specific app completely from Linux.

Gentoo makes this setup easy, although it's probably a bigger production than it needs to be. I simply followed Gentoo's MinGW HOWTO to the letter, and had no issues.

By big production, I mean that instead of providing a quick-and-dirty Windows-specific solution, they've gone after the entire problem of cross-compiling for any architecture, with a single, enormous "CrossDev platform". One day, I'm sure I'll see the benefit of this framework. Among other things, it's meant to simplify the cross-compilation of dependencies (say, a UI library).

I haven't yet accomplished a full Autotools build that can compile a Linux or Windows app based on a configure script flag. It's high on my list, to be sure.

I'm completely stoked at the idea of compiling native apps for all major platforms. I don't want to be religious about portability. I just know that some programming problems aren't that hard if you plan the solution from the start.

Any cross-compiling devs out there? What experiences have you had?

About Me

Erik Mackdanz is a software developer in Austin, Texas, along with everybody else.

Links