views:

147

answers:

3

Hi. I have a plan to build a web-site which running CGI made with Cocoa. My final goal is develop on Mac OS X, and run on FreeBSD. Is this possible?

As I know, there is a free implementation of some NextStep classes, the GNUStep. The web-site is almost built with only strings. I read GNUStep documents, classes are enough. DB connection will be made with C interfaces.

Most biggest problem which I'm concerning is linking and binary compatibility. I'm currently configuring FreeBSD on VirtualBox, but I wanna know any possibility informations about this from experts.

This is not a production server. Just a trial. Please feel free to saying anything.

--edit--

I confused Foundation and Cocoa frameworks. What I said was Foundation. Basic classes which just enough to manipulating strings.

A: 

You won't get binary compatibility. Mac OS X uses the Mach-O object format and FreeBSD uses ELF, like linux. Cocoa won't work on platforms other than Mac OS, but if you stick to POSIX and open-source libraries though, you shouldn't have too much trouble building your CGI (and any dependencies) on your FreeBSD machine.

Also, Cocoa for a website? It's the Mac OS standard library for GUIs, associated datastructures, and various helpers. Apple used to promote something called WebObjects which was similar to Cocoa for the web, but I haven't heard anything about it in ages. I don't think Cocoa will work for a website, unless you just mean write a custom web server that has a graphical front-end in Cocoa.

pumpkin
There is CGI platform that uses Cocoa and Objective-C. He might be planning on using that.
TechZen
Cocoa is not a "standard library for GUIs", it's a full API and works just fine for command-line applications/tools. AppKit, a framework within Cocoa, handles the standard GUI aspects, but nothing says you have to use it. In fact, the registration system for an application I built for the US government is a Cocoa command line tool, called via Tomcat running on a web server. Any web technology that can call a command-line tool will work just fine with a command-line tool that uses Cocoa.
Joshua Nozzi
Strictly speaking, Cocoa isn't the framework used for command line tools. Cocoa is largely concerned with the UI. The Foundation framework is used for command line tools. There is a GNUStep version of the Foundation but its not directly compatible.
TechZen
Sorry, no. Cocoa is Foundation + AppKit: http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/OSX_Technology_Overview/AppTechnology/AppTechnology.html"The Cocoa application environment consists of two object-oriented frameworks: Foundation (Foundation.framework) and the Application Kit (AppKit.framework)."
Joshua Nozzi
I think I may be missing your main point due to semantics, though, TechZen. GNUStep != Cocoa, agreed.
Joshua Nozzi
Oh it was my fault confusing them. Sorry guys.
Eonil
Well, considering your goal, it's "six of one, half-dozen of the other" I think. :-) If you're sticking to Cocoa's Foundation, you're pretty much "there" with GNUStep's Foundation (with minor adjustments). GNUStep, after all, was meant to be an "open-source Cocoa" ... It's the compiling/linking inconvenience that's in your way.
Joshua Nozzi
I'm digging GNUstep with objc .o files. Thanks!
Eonil
+1  A: 

Sounds like your trying to shoehorn tools onto OS and hardware they were not designed for. There are hacks to get almost anything running on top of anything else but why ask for all the grief?

The entire point of the entire Apple API is that you have integration from hardware to OS to development tools. You supposed to pay more up front in return for greater robustness and lower over all lifecycle cost. (It doesn't always work just like Linux doesn't always save money and Windows doesn't always provide the software choices you need but that is the design goal.) When you break Apple's hardware-OS-Dev trinity you have to start fighting the API and the hardware instead of letting it work for you.

I don't think what you're doing will work and even if it does it will cost a lot of time and in the end time is money. Unless your being forced by external circumstances beyond your control to use this configuration, I would strongly suggest you do whatever it takes to find another way to accomplish what you want.

TechZen
I disagree. GNUStep works just fine on OpenBSD. You have only to install it. GNUStep is essentially Cocoa as it was in the earliest days of Mac OS X, which is more than enough to write a command line application (which can be used by CGI). This is a perfectly valid goal. That said, I'm not sure about using it with Xcode. I get the feeling it'd be less of a headache to use the IDE they provide.
Joshua Nozzi
This is not cost-efficient, but pretty fun :) (So I mentioned this is just a trial) Thanks TechZen, and I'll set my course to re-compiling sources on FreeBSD. Thanks Joshua!
Eonil
@Joshua Nozzi -- You'd be surprised how many gaps are in Gnustep versus the Foundation. Since Eonill is just doing this for fun its not a big deal but I can tell you from experience that porting from Foundation to Gnustep is non-trivial. There are always little gaps and minor differences that have to be tracked down.
TechZen
A: 

It’s entirely possible to cross-develop using Xcode. The Cocotron does this – and provides an implementation of Foundation – but doesn’t currently target FreeBSD. You could probably use it as a template to set up cross-development for BSD targets using GNUstep, but it won’t be easy.

Ahruman