Difference between revisions of "Cross Compiling"

From GNUstepWiki
Jump to navigation Jump to search
Line 7: Line 7:
 
a) Copy source files to OSX  
 
a) Copy source files to OSX  
  
Add a wrapping Xcode project (in addition to the GNUstep makefile) and  
+
Add a wrapping Xcode project (in addition to the GNUstep makefile) and configure it to compile directly on OSX for OSX using the OSX Cocoa frameworks.
configure it to compile directly on OSX for OSX using the OSX Cocoa  
+
You can share the sources e.g. through SVN.
frameworks. You can share the sources e.g. through SVN. There is no  
+
There is no problem having GNUmakefiles and some .xcodeproj in the same source code directory.  
problem having GNUmakefiles and some .xcodeproj in the same source  
 
code directory.  
 
  
Examples: SWK Browser from the GNUstep SWK project, DataBuilder from  
+
Examples:
GSCoreData (look into the sources at www.gna.org)  
+
1. SWK Browser from the GNUstep SWK project, DataBuilder from  
 +
2. GSCoreData (look into the sources at www.gna.org)  
  
Development is done by either working on Linux and using GORM/Project  
+
Development is done by either working on Linux and using GORM/Project Center and compiling for Linux. or on OSX opening the project in Xcode.
Center and compiling for Linux. or on OSX opening the project in  
+
The only thing to keep in mind is that you also update the Xcode project or the GNUmakefile if you add source files or resources.  
Xcode. The only thing to keep in mind is that you also update the  
+
The GNUstep .app bundle is different and runs on Linux only.
Xcode project or the GNUmakefile if you add source files or resources.  
+
The OSX .app bundle runs only on OSX, i.e. there is no single bundle that covers all architectures (unless you do some additional tricks).  
The GNUstep .app bundle is different and runs on Linux only. The  
 
OSX .app bundle runs only on OSX, i.e. there is no single bundle that  
 
covers all architectures (unless you do some additional tricks).  
 
  
 
b) Install GNUstep on OSX using MacPorts.  
 
b) Install GNUstep on OSX using MacPorts.  
  
 
Then, you can set up an identical build environment on both machines.  
 
Then, you can set up an identical build environment on both machines.  
The drawback is that you don't have a "native" OSX application which  
+
The drawback is that you don't have a "native" OSX application which you can easily launch by a double-click on the .app icon.  
you can easily launch by a double-click on the .app icon.  
 
  
 
c) Real cross-compiling  
 
c) Real cross-compiling  
  
This means that you have a gcc version on your Linux machine that  
+
This means that you have a gcc version on your Linux machine that emits executables that run on OSX. Unfortunately, OSX uses MACH-O binaries and building a cross-compiling gcc is very tricky.  
emits executables that run on OSX. Unfortunately, OSX uses MACH-O  
+
So I would not consider this as a reasonable option.
binaries and building a cross-compiling gcc is very tricky.  
 
So I would not consider this as a reasonable option.  
 
  
 
== I have an Xcode project and want to run on Linux ==
 
== I have an Xcode project and want to run on Linux ==

Revision as of 14:51, 9 May 2008

Cross Compiling and GNUstep

I have a GNUstep source running on Linux/GNUstep and want the same application to run on OSX

You have several options - more or less complex.

a) Copy source files to OSX

Add a wrapping Xcode project (in addition to the GNUstep makefile) and configure it to compile directly on OSX for OSX using the OSX Cocoa frameworks. You can share the sources e.g. through SVN. There is no problem having GNUmakefiles and some .xcodeproj in the same source code directory.

Examples: 1. SWK Browser from the GNUstep SWK project, DataBuilder from 2. GSCoreData (look into the sources at www.gna.org)

Development is done by either working on Linux and using GORM/Project Center and compiling for Linux. or on OSX opening the project in Xcode. The only thing to keep in mind is that you also update the Xcode project or the GNUmakefile if you add source files or resources. The GNUstep .app bundle is different and runs on Linux only. The OSX .app bundle runs only on OSX, i.e. there is no single bundle that covers all architectures (unless you do some additional tricks).

b) Install GNUstep on OSX using MacPorts.

Then, you can set up an identical build environment on both machines. The drawback is that you don't have a "native" OSX application which you can easily launch by a double-click on the .app icon.

c) Real cross-compiling

This means that you have a gcc version on your Linux machine that emits executables that run on OSX. Unfortunately, OSX uses MACH-O binaries and building a cross-compiling gcc is very tricky. So I would not consider this as a reasonable option.

I have an Xcode project and want to run on Linux

a) your target machine has a compiler Here, you have to check that you are not using too specific frameworks. Then, add a GNUmakefile. Copy the files to your Linux system and run the GNUstep makefile.

b) your target machine is an embedded system In this case, you need a cross-compiler on the build host. This can be a full Linux machine or a OSX machine (but it is more difficult to get a working cross-compiler running on OSX).