3

I'm writing a command line tool in Objective-C (within xCode) that uses the Foundation Framework. I have to use Objective-C because I need to unarchive objects previously archived by NSKeyedArchiver.

My question is, I'm wondering if I can now use this compiled application on my Linux web server.

I'm not sure if there would be a runtime issue or if the executable could be its own standalone program that could actually run on my Linux server.

I'd appreciate any feedback.

Dan
  • 119
  • 8

3 Answers3

3

You can use The Cocotron to build your app targeted to Linux. It is an actual Cocoa implementation meant to fully interoperate (although it's not 100% complete of course), as opposed to GNUstep which is not meant to work that way. I use this and it is awesome.

Nektarios
  • 10,173
  • 8
  • 63
  • 93
  • Is Cocotron active? There seems to have been no blog activity for over 2 years which doesn't fill me with confidence. I've looked at GNUstep in the past too and they both seem like interesting projects in need of some extra love and TLC. – Roger Apr 18 '11 at 13:31
  • 1
    @Roger: there are still active commits going in in the Cocotron source tree, so I guess it's still active. – JeremyP Apr 18 '11 at 13:39
  • 2
    It's very active, and very capable - if you check the google code page you can see that. It's got a learning curve but it's great once you get going. A lot of people see the webpage and think it's out of date and have trouble finding up to date info - I've started to put together a user's guide but it's not even at a draft yet.. eventually it will exist! – Nektarios Apr 18 '11 at 14:33
  • @nektarios, @JeremyP thanks both for the info, looks like it's worth another look after all. It's a very interesting idea and just the sort of thing we might be interested in for a couple of projects ... – Roger Apr 18 '11 at 17:48
  • @Roger I agree - it's worth the time to investigate, I am using it for cross-platform development and have changed my project framework to use it for everything I plan to do for quite some time. Many other people are very invested as well so it's not going anywhere – Nektarios Apr 18 '11 at 17:58
  • 1
    @Roger Feel free to contact the project founder (and other developers) on [the Cocotron Developers Google group](http://groups.google.com/group/cocotron-dev/). –  Apr 18 '11 at 22:04
  • Cocotron looks very promising. Does it work with XCode4? Is there any sort of decent tutorial out there you know of? I've been looking around but can't find anything worthwhile. – Dan Apr 18 '11 at 23:44
  • @Dan - It does work with Xcode 4 and you can see my notes here -> http://groups.google.com/group/cocotron-dev/browse_thread/thread/432df56ac3e62fe8?pli=1 where I get a crosscompiler built under Xcode 4 for FreeBSD (similar for Linux, Windows, Solaris..) Xcode 4 w/Cocotron is my environment and working great – Nektarios Apr 19 '11 at 01:39
  • @Dan and past that, there's no tutorial really, other than go here: http://cocotron.org/Tools/InstallCDT and install your CDT then grab the source of Cocotron: http://cocotron.org/Code and compile it as I describe in that mailing list. The CDT builds crosscompilers which is step 1, step 2 is getting the Cocotron source and actually building its libraries (Foundation for example). Step 3 is including those built cocotron frameowrks in your project and compiling with the crosscompilers, resulting in a binary for your target platform. – Nektarios Apr 19 '11 at 01:43
  • Thank you Nektarios. I'll give it a go. – Dan Apr 20 '11 at 09:22
  • I believe that it only targets for 100% compatibility with 10.4/10.5. – SevenBits May 27 '13 at 01:40
2

No, you cannot run a program that was compiled on and for a Mac on a Linux system. So you will have to compile it for (and on) Linux. Apple's Foundation framework is not available for Linux, but have a look at GNUstep, a free and open Cocoa implementation.

I don't know if GNUstep can read archives that have been archived with Cocoa's NSKeyedArchiver, though.

Ole Begemann
  • 135,006
  • 31
  • 278
  • 256
2

I have provided a wrap-up on how to compile a command line tool based on the Cocotron Foundation framework on my blog.

This does also include a step by step guide on how to cross compile the Foundation framework for Ubuntu Linux.

Hope this is helpful!

starbugs
  • 992
  • 1
  • 9
  • 14