有了Xcode 4.5.2,Clang编译器似乎不是SDK版本依赖。为什么? [英] With Xcode 4.5.2, Clang compiler seems not to be SDK version dependent. Why?

查看:355
本文介绍了有了Xcode 4.5.2,Clang编译器似乎不是SDK版本依赖。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Xcode 4.4和更低版本,每个SDK都有一个副本或一个符号链接到Clang编译器

With Xcode 4.4 and earlier versions, each SDK used to have either a copy or a symlink to a Clang compiler available at

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/
    SDKs/iPhoneOS${IPHONE_SDKVERSION}.sdk/usr/bin/clang++

对于Xcode 4.5.2,上面的路径没有Clang编译器。但是,我在

With Xcode 4.5.2, there is no Clang compiler at the path above. However, I found it at

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

b)为什么不再依赖SDK版本?

推荐答案

这是因为clang可以使用单个(顶级)二进制文件编译多个架构。以前的基于gcc的工具链需要每个拱门有一个gcc。

It's because clang can compile for multiple architectures with a single (top-level) binary. The previous gcc-based toolchains needed one gcc per arch.

查看

See how to compile libcurl with arch armv7s under macosx? for examples of passing arch flags to clang.

此外,您可以使用xcrun找到您的工具,而不是硬编码他们的位置。例如,对于iOS的交叉编译:

Also, you can use xcrun to find your tools instead of hardcoding their locations. For example, when cross compiling for iOS:

export CC=`xcrun --sdk iphoneos --find clang`

这篇关于有了Xcode 4.5.2,Clang编译器似乎不是SDK版本依赖。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆