在ipad中设置gcc编译环境

在ipad中设置gcc编译环境的步骤如下:

 

1. You will need to Jailbreak the iPhone first, search on google for more info.

2. Install OpenSSH from Cydia.

 

3. 安装ipad中的实用工具:

    wget(下载工具)

    AptBackup 安装apt工具

4. 电脑连接ipad

   1)用wifi连接

      在windows中用putty/ssh连接ipad

 

      用户:root / mobile

      密码:alpine

 

      苹果电脑用内置的Terminal,在Terminal中打ssh [email protected](ipad的ip地址)

 

    2)不用wifi连接

      没 wifi 用 iPhone Tunnel Suite 3.0

      苹果电脑用 iPhoneSSH

 

5. 安装fake libgcc这个是装其他编译工具的依赖条件

   1) Download this application using: wget http://www.syshalt.net/pub/iphone/gcc-iphone/fake-libgcc_1.0_iphoneos-arm.deb

   2) Install libcc using: dpkg –i fake-libgcc_1.0_iphoneos-arm.deb

 

6. 安装iphone-gcc ldid make等编译工具

   1) Install ldid to sign the application (this will prevent iOS to kill the application at startup)

   2) Install iphone-gcc using this command: apt-get install iphone-gcc ldid make

 

7. 下载并安装sdk包 

   1) Download using: wget http://www.syshalt.net/iphone/gcc-iphone/sdk-3.2-headers.tar.gz

      如果不行可以下载sys32Libheader.tgz 

      地址http://www.rayfile.com/zh-cn/files/a83cdef8-627d-11df-beeb-0015c55db73d/

   2) Untar with command: tar -xvzf sdk-3.2-headers.tar.gz

8. 配置gcc编译的环境变量

   使用电脑ssh连接ipad,或者在ipad里面使用终端,比方说现在是以mobile用户登录的,在mobile目录下生成 .bash_profile文件, 

 

   vi .bash_profile

   填入如下内容 

 

 

   C_INCLUDE_PATH=/var/sys32/usr/include 

   export C_INCLUDE_PATH 

   CPLUS_INCLUDE_PATH=/var/sys32/usr/include 

   export CPLUS_INCLUDE_PATH 

   LIBRARY_PATH=/var/sys32/usr/lib 

   export LIBRARY_PATH 

 

   :wq 退出 (我还没研究出如何在ipad里面切换出vi的insert模式,我是在电脑ssh ipad后搞的) 

 

   在ipad里切换成root用户,修改/etc/profile文件,在里面加入一行 

 

   source /var/mobile/.bash_profile 

 

   保存退出 

 

   然后重新进入一下ipad的终端,就发现gcc的环境变量弄好了,再也不必输入-L -I参数和长长的目录了。 

 

9. 编译时:

   1)gcc

   2)Sign your compilet aplication using: ldid –S <application>

   3)Run the application using: ./<application>

10.写一个hello world测试一下。

 

Suggestion: Install using: apt-get install nano(编辑工具,不过一般用vim比较顺手)

This will help you code easy directly from terminal.

你可能感兴趣的:(gcc,application,Path,include,ipad,Terminal)