---
title: "linux下编译objectc"
author: "haoningabc"
date: "2014-10-23T01:24:38Z"
tags: ["GCC"]
categories: ["移动开发"]
slug: "linux-objectc"
draft: false
lastmod: "2014-10-23T08:28:30Z"
id: 2146826
url: "https://haoningabc.iteye.com/blog/2146826"
---

编译静态库给ios使用 http://www.tuicool.com/articles/UZr6z2


1. $ yum -y install gcc-objc
2. 从http://wwwmain.gnustep.org下载GNUstep Startup和GNUstep Base，并从源码进行安装。
3.. $ export PATH=$PATH:/usr/GNUstep/System/Tools
4. $ echo "/usr/GNUstep/Local/Library/Libraries/" >> /etc/ld.so.conf
$ ldconfig
5.$ gcc `gnustep-config --objc-flags` -L/usr/GNUstep/Local/Library/Libraries -lgnustep-base hello.m -o hello
6. run program

prepare:
#yum install gcc-objc 
#yum install libpng libpng-devel libtiff libtiff-devel libobjc libxml2 libxml2-devel     libX11-devel libXt-devel libjpeg libjpeg-devel 
#wget ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-startup-0.25.0.tar.gz 
#tar zxvf gnustep-startup-0.25.0.tar.gz 
#cd gnustep-startup-0.25.0 
#./configure 
#make 
#vi ~/.bashrc加入一行： 
/usr/GNUstep/System/Library/Makefiles/GNUstep.sh 

把/usr/GNUstep/Local/Library/Libraries/加到系统的lib路径里面 
#vi /etc/ld.so.conf 加入下面一行： 
/usr/GNUstep/Local/Library/Libraries/ 

编译环境配置好，写一个test.m并用下面的命令编译： 
#gcc `gnustep-config --objc-flags` -L/usr/GNUstep/Local/Library/Libraries -lgnustep-base test.m -o  test 

#./test 
正常的话会正确执行，如果有报“Unknown time zone name `CST'.”，请修改/etc/localtime 设置正确的系统时区 
#vi /etc/localtime 清空之前的内容，加入下面的： 
TZif2 
UTC-8 

http://blog.sina.com.cn/s/blog_5326096f0101c3m8.html