Advertisement

About cross-compiling & gcc

Started by May 12, 2005 09:29 AM
2 comments, last by baldurk 19 years, 4 months ago
Hello, We are the developpers of some non-game related stuff but that's not the point. Our application must work under MS-Windows, Linux (x86 & ppc) & MacOS X. We are using gcc and I must agree : it's a very good compiler. The problem is : gcc (and more generally, any compiler under *nix) does not handle cross-compilation very easily. I spent one full day and a couple of hours trying to find a way to do all our compilations under a single operating system (say Linux). And, sadly, :( I still have to go back to my windows installation each time I need to compile a windows-version. Of course, I successfully compiled two versions of gcc and had a lot of symlinks but, my god, it was horrible to setup ! I will not explain all the pain I had, just two simple lines : - /usr/include contains the headers for the os you are running, not necessarily the os you target. - the 'ldscripts', yep, that's great, but, is there someone who knows how to use this ???? If someone knows how to handle cross-compilation in a user-friendly way, or just want to share is experience with me, i would greatly appreciate :))) philippe
WINE might be useful for building the Windows executables. You could use it to interface with a Cygwin setup.

Building a MacOS X targeting setup would be a bit more tricky. You would want to grab the source code for the Darwin operating system, particularly the cctools and gcc packages. Apple has included Makefiles that are preconfigured to build a compiler targeting Darwin on x86 and PowerPC. Getting them to build on Linux would be the hard part.

It might be easier to use Darwin or MacOS X as your host platform. With Darwin x86, you could still run WINE, and it would be already set up for targetting PowerPC Darwin. You would then need to build a Linux targetting compiler, which seems like it would be easier than setting up a Darwin-targetting compiler.
Free Mac Mini (I know, I'm a tool)
Advertisement
I target Windows using MinGW. The problem with using just gcc is that you still don't have the Windows libraries to create an executable. That's where MinGW comes in. You'd also need to get Windows builds of any 3rd party libraries you're using. I'm not sure which distro you're using, but Debian/Ubuntu both include MinGW in their package repositories.

MacOS X on the other hand, I haven't the slightest clue.
I wrote a guide that's here. It shows how to set up a compiler that compiles .exes on linux. It also shows how you'd compile SDL and wxWidgets. Please note that most of the work is done by a script that I didn't write, so credit where credit's due.

This topic is closed to new replies.

Advertisement