本文介绍了最新SDK的SDKROOT路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode构建旧代码并指定SDKROOT=/Developer/SDKs/MacOSX"${HOST_VERSION}".sdk/

I am using Xcode to build an old code and specify SDKROOT=/Developer/SDKs/MacOSX"${HOST_VERSION}".sdk/

我想为系统上预装(?)的最新SDK指定SDKROOT.例如我已经在10.8上,并且想用-syslibroot指定SDKROOT,但是/Developer/SDKs/中没有这样的SDK.如果SDK_VERSION == HOST_VERSION,我应该完全忽略syslibroot吗?

I want to specify SDKROOT for latest SDK that comes pre-installed (?) on the system. e.g. I am on 10.8 already and I want to specify SDKROOT with -syslibroot, but there is no such SDK in /Developer/SDKs/. Should i just ignore syslibroot altogether if SDK_VERSION == HOST_VERSION?

推荐答案

较新的Xcode版本在Xcode.app软件包中包含SDK,例如

Newer Xcode versions have the SDKs inside the Xcode.app bundle, e.g.

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

通过运行,您将获得已安装的SDK列表及其路径.

You get the list of installed SDKs together with their path by running

xcodebuild -sdk -version

从命令行.

如果已安装命令行工具"(Xcode首选项->下载->组件),则没有"-syslibroot"的编译应等同于针对最新的SDK进行编译.

If you have installed the "Command Line Tools" (Xcode Preferences -> Downloads -> Components) then compiling without "-syslibroot" should be equivalent to compiling against the latest SDK.

请参阅命令行工具"软件包的帮助:

See the help to the "Command Line Tools" package:

这篇关于最新SDK的SDKROOT路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 05:27