With Xcode 4.5.2, Clang compiler seems not to be SDK version dependent. Why?

烈酒焚心 提交于 2019-12-10 23:31:56

问题


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++

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) Why does it not depend on the SDK version anymore ?


回答1:


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.

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`


来源:https://stackoverflow.com/questions/13354029/with-xcode-4-5-2-clang-compiler-seems-not-to-be-sdk-version-dependent-why

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!