discuss-gnustep
[Top][All Lists]
Advanced

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

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


From: Thomas Davie
Subject: Re: Help - Clang can't find <objc/objc.h> on Ubuntu
Date: Sat, 25 Feb 2012 18:03:44 +0000

Hi Jens,

I've recently done a complete build of everything up to and including having a 
working foundation, with blocks support on Ubuntu.  I didn't use the packages 
for most of this stuff as I found similar issues to you.  Here's what I did to 
get to a working setup:

sudo apt-get install subversion
sudo apt-get install g++
sudo apt-get install gobjc
sudo apt-get install vim
sudo apt-get install curl
sudo apt-get install libffi-dev
sudo apt-get install libxml2-dev
sudo apt-get install libicu-dev
sudo apt-get install libgnutls-dev
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
cd ../../
mkdir build
cd build
../llvm/configure --enable-optimized
make
sudo make install
cd ../
curl http://www.openssl.org/source/openssl-1.0.1-beta3.tar.gz > 
openssl-1.0.1-beta3.tar.gz # Ignore the bit about openssl if you don't need a 
recent one, I needed more recent than ubuntu's package manager provides
tar xvfz openssl-1.0.1-beta3.tar.gz
cd openssl-1.0.1-beta3
./config
make
sudo make install
cd ..
svn co http://svn.gna.org/svn/gnustep/tools/make/trunk/ gnustep-make
svn co http://svn.gna.org/svn/gnustep/libs/base/trunk/ gnustep-base
svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/1.6/ libobjc2
cd gnustep-make
./configure --prefix=/usr/GNUstep --enable-native-objc-exceptions 
--with-layout=gnustep 
--with-config-file=/usr/GNUstep/Local/Configuration/GNUstep.conf
make
sudo make install
vim ~/.bashrc # Add . /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
exit # And reopen shell
./configure --with-openssl-include=/usr/local/ssl/include 
--with-openssl-library=/usr/local/ssl/lib/ --enable-libffi 
--with-default-config=/usr/GNUstep/Local/Configuration/GNUstep.conf
make
sudo -E make install
cd ../libobjc2
export CC=clang
make
sudo -E make install
cd ../gnustep-make
./configure --prefix=/usr/GNUstep --enable-native-objc-exceptions 
--with-layout=gnustep 
--with-config-file=/usr/GNUstep/Local/Configuration/GNUstep.conf
sudo make install
cd ../gnustep-base
make clean
./configure --with-openssl-include=/usr/local/ssl/include 
--with-openssl-library=/usr/local/ssl/lib/ --enable-libffi 
--with-default-config=/usr/GNUstep/Local/Configuration/GNUstep.conf
make
sudo -E make install

You should now have a working GNUstep Foundation :)

Hope that helps

Bob

On 25 Feb 2012, at 17:42, Jens Alfke wrote:

> 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 
> GCD).
> 
> 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 
> /usr/lib/gcc/i686-linux-gnu/4.6/include/objc/objc.h.
> 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…
> 
> Thanks!
> 
> —Jens
> 
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep




reply via email to

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