Hi!
I have the following files:
example.m
GNUmakefile
I have libobjc2 and gnustep installed and when I run:
I get the following error:
That's not good! When I run:
I get the following compilation error:
That's really not good! Finally if I try:
I get the following compilation error:
Question: does anyone know how to compile a simple Objective-C framework using libobjc2?
Thanks!
(I am using FreeBSD 9.1 AMD64 and gnu step/libobjc2/libdispatch have been successfully installed)
I have the following files:
example.m
Code:
#import <Foundation/Foundation.h>
int main( int argc, const char *argv[] ) {
NSLog (@"First ObjC Program");
return 0;
}
GNUmakefile
Code:
GNUSTEP_MAKEFILES=/usr/local/GNUstep/System/Library/Makefiles
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = exampleapp
exampleapp_OBJC_FILES = example.m
include $(GNUSTEP_MAKEFILES)/tool.make
I have libobjc2 and gnustep installed and when I run:
Code:
clang -ObjC example.m -o example \
-I/usr/local/lib \
-I/usr/local/lib/gcc42/gcc/x86_64-portbld-freebsd9.1/4.2.5/include \
-fconstant-string-class=NSConstantString -I/usr/local/GNUstep/System/Library/Headers \
-L/usr/local/GNUstep/System/Library/Libraries \
-L/usr/local/lib -lgnustep-base
./example
I get the following error:
Code:
Module ./example.m version 9 doesn't match runtime 8
Abort (core dumped)
That's not good! When I run:
Code:
clang `gnustep-config --objc-flags` example.m -o example `gnustep-config --base-libs` -I/usr/local/lib/gcc42/gcc/x86_64-portbld-freebsd9.1/4.2.5/include -I/usr/local/GNUstep -L/usr/local/GNUstep -I/usr/local/GNUstep/System/Library/Headers -L/usr/local/GNUstep/System/Library/Libraries -L/usr/local/lib
I get the following compilation error:
Code:
gnustep-config: Command not found.
gnustep-config: Command not found.
/usr/lib/crt1.o: In function `_start':
/usr/src/lib/csu/amd64/crt1.c:(.text+0x82): undefined reference to `main'
/tmp/example-O1DIn2.o: In function `gnustep_base_user_main':
example.m:(.text+0x1d): undefined reference to `NSLog'
/tmp/example-O1DIn2.o: In function `.objc_load_function':
example.m:(.text+0x3f): undefined reference to `__objc_exec_class'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
That's really not good! Finally if I try:
Code:
gmake CC=clang CXX=clang++
I get the following compilation error:
Code:
This is gnustep-make 2.6.2. Type 'gmake print-gnustep-make-help' for help.
/usr/local/GNUstep/System/Library/Makefiles/common.make:857: WARNING: Your PATH may not be set up correctly !
/usr/local/GNUstep/System/Library/Makefiles/common.make:858: Please try again after adding "/usr/local/GNUstep/System/Tools" to your path
Making all for tool exampleapp...
Compiling file example.m ...
In file included from example.m:1:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/Foundation.h:33:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/FoundationErrors.h:29:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObject.h:30:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObjCRuntime.h:95:
In file included from /usr/local/GNUstep/System/Library/Headers/GNUstepBase/GSObjCRuntime.h:85:
/usr/local/GNUstep/System/Library/Headers/ObjectiveC2/objc/runtime.h:42:27: warning:
redefinition of typedef 'Ivar' is a C11 feature [-Wtypedef-redefinition]
typedef struct objc_ivar* Ivar;
^
/usr/local/include/objc/runtime.h:52:27: note: previous definition is here
typedef struct objc_ivar* Ivar;
^
In file included from example.m:1:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/Foundation.h:33:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/FoundationErrors.h:29:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObject.h:30:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObjCRuntime.h:95:
In file included from /usr/local/GNUstep/System/Library/Headers/GNUstepBase/GSObjCRuntime.h:85:
/usr/local/GNUstep/System/Library/Headers/ObjectiveC2/objc/runtime.h:83:15: error:
typedef redefinition with different types ('void *' vs 'struct objc_property *')
typedef void *objc_property_t;
^
/usr/local/include/objc/runtime.h:139:31: note: previous definition is here
typedef struct objc_property* objc_property_t;
^
In file included from example.m:1:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/Foundation.h:33:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/FoundationErrors.h:29:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObject.h:30:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObjCRuntime.h:95:
In file included from /usr/local/GNUstep/System/Library/Headers/GNUstepBase/GSObjCRuntime.h:85:
/usr/local/GNUstep/System/Library/Headers/ObjectiveC2/objc/runtime.h:127:1: error:
unknown type name 'Method_t'; did you mean 'Method'?
Method * class_copyMethodList(Class cls, unsigned int *outCount);
^~~~~~
Method
/usr/local/GNUstep/System/Library/Headers/ObjectiveC2/objc/runtime.h:78:17: note:
expanded from macro 'Method'
# define Method Method_t
^
/usr/local/include/objc/runtime.h:115:29: note: 'Method' declared here
typedef struct objc_method *Method;
^
In file included from example.m:1:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/Foundation.h:33:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/FoundationErrors.h:29:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObject.h:30:
In file included from /usr/local/GNUstep/System/Library/Headers/Foundation/NSObjCRuntime.h:95:
In file included from /usr/local/GNUstep/System/Library/Headers/GNUstepBase/GSObjCRuntime.h:85:
/usr/local/GNUstep/System/Library/Headers/ObjectiveC2/objc/runtime.h:136:1: error:
unknown type name 'Method_t'; did you mean 'Method'?
Method class_getClassMethod(Class aClass, SEL aSelector);
^~~~~~
Method
/usr/local/GNUstep/System/Library/Headers/ObjectiveC2/objc/runtime.h:78:17: note:
expanded from macro 'Method'
# define Method Method_t
^
/usr/local/include/objc/runtime.h:115:29: note: 'Method' declared here
typedef struct objc_method *Method;
/usr/local/include/objc/runtime.h:115:29: note: 'Method' declared here
typedef struct objc_method *Method;
^
1 warning and 17 errors generated.
gmake[3]: *** [obj/exampleapp.obj/example.m.o] Error 1
gmake[2]: *** [internal-tool-all_] Error 2
gmake[1]: *** [exampleapp.all.tool.variables] Error 2
gmake: *** [internal-all] Error 2
Question: does anyone know how to compile a simple Objective-C framework using libobjc2?
Thanks!
(I am using FreeBSD 9.1 AMD64 and gnu step/libobjc2/libdispatch have been successfully installed)