tags:

views:

101

answers:

4

Possible Duplicate:
How to cross compile from Mac OS X to Linux x86?

I have an application that I wrote in C++/SDL, using FMOD library. The app is portable and compiles without any code change on Mac and on Linux. But one annoyance is that when I want to ship Linux version, I have to run my Linux box, copy the source code over there (over USB drive, because I have no network there, it's an old laptop) and compile it, then copy it again over USB to my Mac and upload it.

My question is - is there a better way of doing it? Ideally, could I compile the app to run on Linux directly from Xcode, where I compile it for Mac?

+2  A: 

A quick google for cross-compiling for Linux on OSX revealed this page.

Actually, this has been asked before in How to cross compile from Mac OS X to Linux x86?.

Troubadour
Okay, but how do I use it in XCode?
mav
You don't, you compile is as you do now in the vm
David Sykes
A: 

You could statically link the entire code (with all dependencies) into a single binary and have a version for Mac and a version for Linux.

Luca Matteis
+3  A: 

Take a look at http://stackoverflow.com/questions/1775267/how-to-cross-compile-from-mac-os-x-to-linux-x86 and the links therein (it suggests compiling under Linux running in a VM, probably the best idea, since trying to setup cross-compiling usually isn't worth the work and trouble).

Greg S
+1  A: 

The risk of shipping a duff binary is too high to be worth bothering trying to build it on an alien box.

You'll clearly NEED a Linux box knocking around for testing each time you do a new release. Therefore, it will be no hassle to build it on that box. Using a Linux VM though is probably a good idea as you can make sure the VM is in the exact same state (and known state) before each build.

I'm assuming that you are at least going to smoke-test each release.

MarkR