Created
July 5, 2012 19:04
-
-
Save rainzoo/3055727 to your computer and use it in GitHub Desktop.
Compile and run Objective C program on Ubuntu 11.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main (int argc, const char *argv[]) | |
{ | |
@autoreleasepool { | |
NSLog(@"Hello World"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC = clang | |
GNUSTEP_LOCAL_HEADERS=/usr/GNUstep/Local/Library/Headers | |
GNUSTEP_LOCAL_LIBRARIES=/usr/GNUstep/Local/Library/Libraries | |
FLAGS = -lgnustep-base -fconstant-string-class=NSConstantString | |
all: hello.m | |
$(CC) -o hello hello.m -I $(GNUSTEP_LOCAL_HEADERS) -L $(GNUSTEP_LOCAL_LIBRARIES) $(FLAGS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment