I’m crazy, so I’d really like to have Objective C as a target for Roundabout. If Perl is my first-implementation and reference language, I’d like to have ObjC as the “speed and power” language.
The first step to making this happen is making ObjC — or more correctly, Cocoa — code compile on Linux with GNUstep. It’s been a really long time since I found myself staring into the abyss of having absolutely no idea what an environment expects me to do to make it go, but that’s where I am with GNUstep.
My first step was to write an overly-correct hello.m that does things Apple ObjC2 style:
And then I tried to build it:
[mdxi@fornax test]$ clang -ObjC hello.m hello.m:1:9: fatal error: 'Foundation/Foundation.h' file not found #import <Foundation/Foundation.h> 1 diagnostic generated. [mdxi@fornax test]$
Okay, the GNUstep intro stressed how easy it was to do things because they used Makefiles to wrap up all the irritating bits of using frameworks. I found an example GNUmakefile and modified it a bit
include $(GNUSTEP_MAKEFILES)/common.make TOOL_NAME = Hello Hello_OBJC_FILES = hello.m include $(GNUSTEP_MAKEFILES)/tool.make
Which got me this, instead:
[mdxi@fornax test]$ make GNUmakefile:1: /common.make: No such file or directory GNUmakefile:6: /tool.make: No such file or directory make: *** No rule to make target `/tool.make'. Stop.
Clearly ‘make’ didn’t magic those ENV vars into existance just because you’re compiling GNUstep stuff. You’re supposed to set them somewhere, somewhen, somehow.
Yep. There’s a setup bash script. On my system:
source /opt/GNUstep/System/Library/Makefiles/GNUstep.sh
Which yeilded:
[mdxi@fornax test]$ make This is gnustep-make 2.4.0. Type 'make print-gnustep-make-help' for help. Making all for tool Hello... Compiling file hello.m ... gcc: error trying to exec 'cc1obj': execvp: No such file or directory make[3]: *** [obj/Hello.obj/hello.m.o] Error 1 make[2]: *** [internal-tool-all_] Error 2 make[1]: *** [Hello.all.tool.variables] Error 2 make: *** [internal-all] Error 2
Well, yeah, I know that. I don’t want to use gcc-objc. I wanna use clang, because it is the new hotness. You do that like this:
make CC=clang
Which still doesn’t quite fix things:
[mdxi@fornax test]$ make CC=clang
This is gnustep-make 2.4.0. Type 'make print-gnustep-make-help' for help.
Making all for tool Hello...
Compiling file hello.m ...
In file included from hello.m:1:
In file included from /opt/GNUstep/Local/Library/Headers/Foundation/Foundation.h:30:
In file included from /opt/GNUstep/Local/Library/Headers/GNUstepBase/GSVersionMacros.h:193:
In file included from /opt/GNUstep/Local/Library/Headers/GNUstepBase/GSConfig.h:225:
/opt/GNUstep/Local/Library/Headers/GNUstepBase/preface.h:81:11: fatal error: 'objc/objc.h' file
not found
#include <objc/objc.h>
^
1 diagnostic generated.
Sucks that it still isn’t working, but at least the error messages are a lot awesomer.