[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help - Clang can't find <objc/objc.h> on Ubuntu

From: Jens Alfke
Subject: Help - Clang can't find <objc/objc.h> on Ubuntu
Date: Sat, 25 Feb 2012 09:42:00 -0800

I’m trying to get started with GNUstep development but running into problems 
getting the LLVM compiler and libobjc2 set up correctly. 

My story: I’ve got some Foundation-level Cocoa code (i.e. no UI) that runs on 
OS X 10.7 and iOS 5, and I’d like to get it running in GNUstep on Linux. 
Syntactically, this code uses properties and blocks pretty heavily (but not 

So I’ve installed Ubuntu 11.10 x86 inside VirtualBox on my MacBook Pro, and 
installed the following packages via apt-get:
* gnustep
* gnustep-devel
* llvm
* clang
* libobjc2

I can build & run a trivial app that calls NSLog (the example from the makefile 
tutorial.) And I’ve set up a makefile for my code, but when I try to build it I 
run into compiler problems.

If I just run “make”, GCC [4.6.1] barfs on the first use of the “^” character. 
So apparently it doesn’t have the Apple block extensions:
> Source/Header.h:19:11: error: expected identifier or ‘(’ before ‘^’ token

OK, according to instructions on the gnustep site, I can enter “make CC=clang 
LD=gcc” to build with Clang. But when I do this, Clang [2.9] can’t find objc.h:

> /usr/include/GNUstep/GNUstepBase/preface.h:112:11: fatal error: 'objc/objc.h' 
> file not found
>  #include <objc/objc.h>

The only copy of objc.h on my system is 
So apparently I either need to 
(a) configure Clang to search that directory (which I’m reluctant to do because 
it may have GCC-specific stuff in it), or
(b) copy the objc/ header directory into Clang’s header search path (where?), or
(c) reconfigure libobjc2 to understand that I have Clang installed and put its 
headers in the right place

I’m not sure which of these is appropriate. Actually I’m confused because it 
sounds from what I’ve read (i.e. the libobjc2 1.6 announcement) as though 
libobjc2 has Clang/LLVM specific functionality, so I expected that the two 
would play nicely together if I installed both, without need for further 
customization. But I’m fairly clueless about Linux and apt-get so I may just 
have done something wrong…



reply via email to

[Prev in Thread] Current Thread [Next in Thread]