This was tricky for me, so I am posting a guide as usual.
1. sudo apt-get install subversion
2. sudo apt-get install build-essential
3. sudo apt-get install pacman
4. sudo apt-get install libobjc2
5. sudo apt-get install clang
6. Then follow the instructions here:
http://clang.llvm.org/get_started.html
Here is a sample program:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
}
return 0;
}
Save it as main.m and to compile it do:
sudo clang main.m `gnustep-config --objc-flags` `gnustep-config --objc-libs` -x objective-c -fconstant-string-class=NSConstantString -fobjc-nonfragile-abi -fblocks -lgnustep-base -lgnustep-gui -ldispatch -I /usr/include/GNUstep -L /usr/lib/GNUstep
it will create a file called a.out, to run it do:
sudo ./a.out
References:
http://sohanikh.blogspot.com/2013/02/how-to-build-llvm-from-source-on-ubuntu.html
http://clang.llvm.org/get_started.html
http://clang.llvm.org/get_started.html
http://stackoverflow.com/questions/14921482/clang-compiling-error-undefined-reference-to-objc-autoreleasepoolpush