a technical blog

FIRSTSteps with GNUStep

with one comment

If you are like me and are not able to work with OSX on your regular day-job, you might sometimes have this feeling that you are not living up to your full potential. You are in the need of coding a small app or tool; too big or GUI-based that perl or python could do the job (at least from the knowledge I have of them). Java is the alternative and also the main language used at my day-job; but only what is common in the JavaEE world; so:

  • I always have to look up at google how to read in a file: I find the stream-concept very mighty, but hard to remember.
  • I don’t recall all the Swing or SWT classes by memory and how to handle them
  • and most importantly: I find java-based graphical applications ugly and disgusting as hell!

But I digress… Where I wanted to go was: I really would like to leverage my Objective-C and Cocoa knowledge more often; also on other platforms.  I was aware of GNUStep for many years, but the presentation in the web looked never very appealing compared to what I am used to in the Mac-world. Yesterday, I gave it a shot anyway and was… well I would not find it fair to judge it after such a short time. For now, I would only like to describe my first steps to help others get started. Don’t be afraid; it is quiet easy to get it running!

First of all: Here is my result after 6 intensive hours of getting comfortable. Hello-world GNUStep-style… once more.

A simple window-based app printing “Hello World” on the press of a button. Isn’t it beautiful?

As you can easily see, I have been trying it out under Windows XP; actually on a VM running on my Mac and I was pretty impressed how similar it is to Cocoa. You might say: Sure, what did you expect? Well, I don’t know; I was just suprised that it is so close to the “original”; even considering the Interface Build named “Gorm”:

Looks quiet similar to the original; and even though the UI is rather outdated, it works perfectly fine: creating action-target connection? object-outlet connections? No problem!

So, how did I get my app running? Basically, it is not very hard and I will give you the steps. Plus, a few hints that would have saved at least 4 of the 6 hours.

Download and Install the Framework

First go to and get the latest windows installers for the following packages: GNUStep MSYS System, GNUStep Core, GNUStep Devel. The packages cone  with a minimal MinGW confgured to work with GNUStep (including the GNU binutils and gcc).

Install them in the order mentioned above and continue with downloading from the same page the following applications (under Applications, Frameworks and Libraries) and install them:

  • System Preferences (small preferences app to configure the GNUStep environment); I haven’t used it yetm but for completnes, I list it anyway.
  • Gorm: Gorm is the GNUStep Interface Builder and, even though with a very dated UI, still gives most things you know and love about Apple’s Interface Builder.

Developing your Hello World Application

I followed the steps for a first application in the GNUStep documentation and used it for reference. You will notice that it is not nearly complete and my only real pain-point in the whole GNUStep experience. When you get to the end, you will know what I mean. It stops right in the middle and leaves you out alone in the dark. Especially, if you are not familiar with Cocoa on the Mac. If you know, you will get past this easily.

Here a few hints that might make your life easier:

  • First thing you might ask yourself is how to actual connect outlets and actions. The document says Ctrl-drag the connection. For me, it did not work on my Windows VM (I guess this is no problem on a normal Windows System). When I noticed Ctrl = Ctrl + Cmd, everything worked… almost. When you drag connection to the destination object, the connection is not established yet. You have to select the outlet or action to connect in the Inspector and press “Connect”. I am using XCode 4 now for some time; but i think it was the same in Xcode 3, but it still took me some time…
  • Notice the line defining the variable FirstApp_OBJC FILES in the GNUmakefile given in the docu: It took me some time to notice the space between OBJC and FILES. (The linker does not find my main-method? What the hell?) Make it an underscore “_”. No thanks, Windows Notepad! Big thanks to Vim!

Now, you are at the end of the documentation. What are the last steps?

  1. When you get to the end of the doc, you will notice that the description stops with a template for the main-method. What do I have to fill it with? Well, If you are familar with Cocoa this will not be a big issue; just call NSApplicationMain(argc, argv) as you always do it and the rest is handled by the configuration in the Info-gnustep.plist, generated during a “make”. Additionally, bracket the call with an auto-release-pool.
  2. Do a make, open the MinGW-Shell and browse to your project-directory: Note that even though the windows HDs C, D, etc. are not listed on “ls”, they are still there and can be “cd’ed” to. Call make and ideally, there should be no compile or linker error and the (or however you called it) should have been built.
  3. If so, start the built app with “openapp”
  4. You did NSLog-calls and don’t see any output on the console: It goes to the Windows Logging Daemon. Right-click “My Computer” on your Desktop and select “Manage”. Browse to Computer Management/System Tools/EventViewer/Application to see NSLog-calls.

E voila. AppKit on Windows! You can get the project of my Hello-World App ongithub. It should built right away when you have done the “Download and Install Framework” step.

I might write something more on how useful GNUStep actually is in daily use in a few weeks, but for now I hope this post gives you enough information to get started on your own.

Written by 38leinad

March 23, 2011 at 6:12 pm

Posted in tutorial

Tagged with , ,

One Response

Subscribe to comments with RSS.

  1. A  That’s why it’s important for you as
    a home owner to take the time to learn a little about how it all works and have the necessary skills to make small repairs on your own.
    Video camera inspection accurately identifies the source of the problem whether it be broken pipes, root
    growth, mud or grease backed up, or any other circumstance.
    So the next time that you find yourself having problems with a broken or leaky toilet,
    rather than calling an expensive plumber to take a look at the problem for you why not just consider fixing
    it yourself.

Any thoughts?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: