Linux上构筑iPhone OS3.1.2开发环境之编译HELLO WORLD

来源:互联网 发布:郑州优化公司 编辑:程序博客网 时间:2024/05/18 03:01

  

原文地址 http://blog.csdn.net/lmss82/archive/2010/02/08/5300230.aspx

终于到了编译范例的时候了,范例在APPS目录里,好兴奋呀。。。

 

开始编译:

 

zhaowei@zhaowei-ubuntu:~/toolchain/apps/HelloToolchain$ make
arm-apple-darwin9-gcc -lobjc -bind_at_load -framework Foundation -framework CoreFoundation -framework UIKit -w -o HelloToolchain HelloToolchain.o
ld: library not found for -lobjc
collect2: ld returned 1 exit status
make: *** [HelloToolchain] 错误 1

 

看见没有,又报错了。在官方讨论区我找到解决方法。看下面:

 

Here's the solution I used (thanks brian.cr...):

Build the toolchain

In ~/Projects/iphone/toolchain/toolchain/sys, rename folder System to System2

In ~/Projects/iphone/toolchain/toolchain/sys/usr, rename folder lib to lib2

Copy folder ~/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/System to ~/Projects/iphone/toolchain/toolchain/sys

Copy folder ~/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/usr/lib to ~/Projects/iphone/toolchain/toolchain/sys/usr


Try to build HelloToolchain? again using instructions on this page (above).

Hope that helps. This was the only error I encountered using the toolchain.sh script

 

 

重新编译,看输出结果,证明我们编译成功了。呼呼,接下来就是要上传到IPHONE了。

 


zhaowei@zhaowei-ubuntu:~/toolchain/apps/HelloToolchain$ make
/home/zhaowei/toolchain/toolchain/pre/bin/arm-apple-darwin9-gcc -lobjc -bind_at_load -framework Foundation -framework CoreFoundation -framework UIKit -w -o HelloToolchain HelloToolchain.o

 

 

使用这个命令上传到IPHONE:

 

Navigate to the apps/HelloToolchain directory and run the following commands, noting that you must set "IP" to the address of your iPhone and change the path as appropriate:

cd ~/toolchain/apps/HelloToolchain
IP=xxx.xxx.xxx.xxx PATH=../../toolchain/pre/bin/:$PATH make deploy

 

上传会需要你输入密码,我居然试了半天,密码错误,怎么可能,默认的密码都进不去,后来才想起,是自己当初玩的时候修改了密码

 

默认密码:!1.02 的系统密码是dottie. 1.1.1密码是alpine.

 

我的密码是:***** 。哈哈。

 

记得修改密码哦。

 

 

上传成功的样子:

 

zhaowei@zhaowei-ubuntu:~/toolchain/apps/HelloToolchain$ sudo IP=192.168.0.2 PATH=../../toolchain/pre/bin/:$PATH make deploy
/home/zhaowei/toolchain/toolchain/pre/bin/arm-apple-darwin9-gcc -c   src/HelloToolchain.m -o HelloToolchain.o
/home/zhaowei/toolchain/toolchain/pre/bin/arm-apple-darwin9-gcc -lobjc -bind_at_load -framework Foundation -framework CoreFoundation -framework UIKit -w -o HelloToolchain HelloToolchain.o
root@192.168.0.2's password:
sh: line 0: cd: /Applications/HelloToolchain.app: No such file or directory
not found
root@192.168.0.2's password:
icon.png                                     100% 1073     1.1KB/s   00:00   
HelloToolchain_                              100%   13KB  13.1KB/s   00:00   
HelloToolchain                               100%   61     0.1KB/s   00:00   
Info.plist                                   100%  746     0.7KB/s   00:00   
root@192.168.0.2's password:
sh: ldid: command not found

 

此时我的ITOUCH上有个图标,三个问号 ??? 的图标,看到最后一项没,ldid,我得继续研究研究了。

 

 

---------------------------------------------------------------

 

刚给ITOUCH装上LDID后,再次运行,机器响了一下,赶紧打开运行那个HELLOWORD,这回可以打开了,我的HelloWorld

终于出来了。

 

 

 

zhaowei@zhaowei-ubuntu:~/toolchain/apps/HelloToolchain$ sudo IP=192.168.0.2 PATH=../../toolchain/pre/bin/:$PATH make deploy
[sudo] password for zhaowei:
Sorry, try again.
[sudo] password for zhaowei:
/home/zhaowei/toolchain/toolchain/pre/bin/arm-apple-darwin9-gcc -c   src/HelloToolchain.m -o HelloToolchain.o
/home/zhaowei/toolchain/toolchain/pre/bin/arm-apple-darwin9-gcc -lobjc -bind_at_load -framework Foundation -framework CoreFoundation -framework UIKit -w -o HelloToolchain HelloToolchain.o
root@192.168.0.2's password:
root@192.168.0.2's password:
icon.png                                                                                                     100% 1073     1.1KB/s   00:00   
HelloToolchain_                                                                                              100%   13KB  13.1KB/s   00:00   
HelloToolchain                                                                                               100%   61     0.1KB/s   00:00   
Info.plist                                                                                                   100%  746     0.7KB/s   00:00   
root@192.168.0.2's password:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

原创粉丝点击