[cfe-dev] objc_exec_class on Mac OS X

Brendan Younger brendan at brendanyounger.com
Sun Nov 9 15:17:16 PST 2008


Hi,

I've been trying to get clang to compile Objective-C code on Mac OS X  
for a while now.  I keep getting linker errors of the form

Undefined symbols:
   "___objc_exec_class", referenced from:
       _.objc_load_function in cc5ZSPXw.o

and from what I can tell, _objc_exec_class is a GNUStep function which  
is apparently not in Apple's libobjc.  In case anyone wants to try  
this themselves, compiling the following with "clang -emit-llvm-bc - 
x=objective-c < hello.m | llc > hello.s" and then "gcc -o hello - 
framework Foundation -lobjc hello.s" fails with the undefined symbol  
message above.

#import <Foundation/Foundation.h>

int main(int argc, char const *argv[]) {
	NSLog(@"Hello, world!");
	// printf("Hello, world!\n");
	
	return 0;
}

Any ideas?

Brendan Younger



More information about the cfe-dev mailing list