在试图为
iphoneos编写一个虚拟程序时,Xcode4,gcc似乎没有超出初始的sysroot目录
$echo $ISYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk $gcc -arch armv6 --sysroot=$ISYSROOT test.cpp ld: in /usr/lib/system/libcache.dylib,missing required architecture armv6 in file for architecture armv6 collect2: ld returned 1 exit status
如果我把sysroot,
$gcc -arch armv6 test.cpp ld: warning: ignoring file /usr/lib/crt1.o,missing required architecture armv6 in file ld: warning: ignoring file /usr/lib/libgcc_s.1.dylib,missing required architecture armv6 in file ld: warning: ignoring file /usr/lib/libSystem.dylib,missing required architecture armv6 in file Undefined symbols for architecture armv6: "start",referenced from: -u command line option ld: symbol(s) not found for architecture armv6 collect2: ld returned 1 exit status
以下作品,但感觉非常干酪,而且不可伸缩.这里发生了什么?
$gcc -arch armv6 -L$ISYSROOT/usr/lib/system --sysroot=$ISYSROOT test.cpp
更新.显然这是一个已知的问题,虽然仍然不清楚如何将sysroot传递给gcc,但是不能
http://www.doitscared.com/?m=201104
When compiling the library,if you see this error “ld: file not found:
/usr/lib/system/libcache.dylib for architecture armv7″,then your
linker command is using “–sysroot” which doesn’t work in Xcode 4.
Instead,change the linker command to use “-isysroot”. (Note: This
only applies to the linker command. The compile commands must continue
to use “–sysroot”. See here for more details.)
解决方法
将您的项目的部署目标更改为至少4.3,它将工作.这是XCode 4的一个问题,但实际上并不需要在4.3之前将应用程序部署到iOS版本. iOS用户往往会保持最新的iOS版本.