[cfe-dev] objc_exec_class on Mac OS X

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


"llvm-config --host-triple" gives:
i686-apple-darwin9.5.0

and "clang -emit-llvm-bc -fnext-runtime hello.m" gives
clang: Unknown command line argument '-fnext-runtime'.  Try: 'clang -- 
help'

This is all from the current svn.

Brendan Younger

On Nov 9, 2008, at 6:32 PM, Daniel Dunbar wrote:

> Does it work if you use the -fnext-runtime flag?
>
> On Mac OS X, this should be the default, however it appears that you  
> are getting code for the GNU runtime. I just scanned over the  
> implementation and don't see an obvious problem. What is your target  
> triple?
>
>  - Daniel
>
> On Sun, Nov 9, 2008 at 3:17 PM, Brendan Younger <brendan at brendanyounger.com 
> > wrote:
> 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
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081109/a1b75e0d/attachment.html>


More information about the cfe-dev mailing list