ios – 在/usr/lib/system/libcache.dylib中,缺少必需的架构armv6

在试图为 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版本.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...