0

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.

eonil
  • 83,476
  • 81
  • 317
  • 516

5 Answers5

1

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.

Jens Ayton
  • 14,532
  • 3
  • 33
  • 47
1

You should be OK with the GNUstep Foundation on FreeBSD 9.0 with Objective-C 2 (clang). See these instructions.

Note: Do not installing under '/' with a FreeBSD default install, because it has little space on the '/' partition. I've used /usr/local/gnustep instead, and made some links as the instructions suggest.

Note II: GNUstep sources from subversion repository didn't compile for me, so I used the latest stable GNUstep sources.

0

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
  • 64,370
  • 15
  • 118
  • 145
  • 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 Jun 06 '10 at 15:35
  • @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 Jun 07 '10 at 13:00
0

Yes, you can do this, and I am doing it right now successfully using FreeBSD 8.2 and Xcode 4.0, running the Foundation class from The Cocotron. Here is a link: describing exactly what I did to build the cross compiler and set everything up. I also detail in that post, how I attempted to get AppKit (GUI) to work. I failed, it may work in the future, it doesn't fully work yet.

So far it's great. I use a common codebase to write iPhone App (game client) and FreeBSD Game Server; after my server compiles I even have a target rsync the files to my dev box.

One more note, you mention DB, I'm successfully using mysqlclient libraries within my App and my post details how to do that. Since you're building a cross-compiler with The Cocotron you can use any library. Just install the library on FreeBSD first, then create the platform as described.

Nektarios
  • 10,173
  • 8
  • 63
  • 93
-2

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.

copumpkin
  • 2,836
  • 18
  • 25
  • There is CGI platform that uses Cocoa and Objective-C. He might be planning on using that. – TechZen Jun 06 '10 at 14:45
  • 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 Jun 06 '10 at 15:12
  • 1
    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 Jun 06 '10 at 15:15
  • 1
    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 Jun 06 '10 at 15:26
  • 1
    I think I may be missing your main point due to semantics, though, TechZen. GNUStep != Cocoa, agreed. – Joshua Nozzi Jun 06 '10 at 15:34
  • Oh it was my fault confusing them. Sorry guys. – eonil Jun 06 '10 at 15:36
  • 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 Jun 06 '10 at 15:41
  • I'm digging GNUstep with objc .o files. Thanks! – eonil Jun 06 '10 at 16:31