Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDKROOT path for latest SDK

Tags:

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

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?

like image 521
JamesWebbTelescopeAlien Avatar asked Dec 20 '12 03:12

JamesWebbTelescopeAlien


People also ask

Where are Xcode SDKs located?

Newer Xcode versions have the SDKs inside the Xcode. app bundle, e.g. from the command line. 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.

Where is Macos SDK installed?

The SDK is located at /Applications/Xcode. app/Contents/Developer/Platforms/MacOSX. platform/Developer/SDKs/MacOSX.


2 Answers

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 

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

xcodebuild -sdk -version 

from the command line.

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:

Downloading this package will install copies of the core command line tools and system headers into system folders, including the LLVM compiler, linker, and build tools.

like image 50
Martin R Avatar answered Oct 26 '22 20:10

Martin R


As stated in another stackoverflow question:

xcrun --sdk macosx --show-sdk-path 
like image 36
Sriram Murali Avatar answered Oct 26 '22 19:10

Sriram Murali