SDK Path wrong

Xcode 8.3.2

Build version 8E2002


In Terminal,

$ xcrun --show-sdk-path

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


However, build it In Xcode then I got some error.


error: There is no SDK with the name or path '/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk'


Any help ?

Answered by QuinceyMorris in 230228022

So, something in your project is holding on to the wrong path to the SDK. (This shouldn't happen — the project should never have any absolute references that make it depend on a particular Xcode or SDK version.) I would try the following things, in the following order, to try to get rid of the error:


1. Clean your project. Hold down the Option key and choose Clean Build Folder from the Product menu.


2. Go to the build settings for your target, and make sure the SDK setting is set to "Latest macOS" in the Architectures section at the top.


3. Go to the Search Paths section of the build settings, and check that an explicit reference to the SDK hasn't been added to one of the search paths.


4. If your project uses any build config files, check that those files don't have any absolute references to the beta SDK path.


If none of that helps, you can try showing your project file (the first item in the navigator pane on the left) as text, by enabling the Version editor (View->Version Editor-> Show Version Editor). Then you can search for the word "beta". You might be lucky and find a clue to the problem that way.

In a case you have:


Xcode.app


in the other :


Xcode-beta.app


Is it on purpose ?

In fact, I've installed xcode-beta first. then I install xcode.app later.

However, I delete xcode-beta.app yesterday. then I got a build error.


In xcode, is there any idea how to change the sdk path ?

I would try to reinstall xCode.

Accepted Answer

So, something in your project is holding on to the wrong path to the SDK. (This shouldn't happen — the project should never have any absolute references that make it depend on a particular Xcode or SDK version.) I would try the following things, in the following order, to try to get rid of the error:


1. Clean your project. Hold down the Option key and choose Clean Build Folder from the Product menu.


2. Go to the build settings for your target, and make sure the SDK setting is set to "Latest macOS" in the Architectures section at the top.


3. Go to the Search Paths section of the build settings, and check that an explicit reference to the SDK hasn't been added to one of the search paths.


4. If your project uses any build config files, check that those files don't have any absolute references to the beta SDK path.


If none of that helps, you can try showing your project file (the first item in the navigator pane on the left) as text, by enabling the Version editor (View->Version Editor-> Show Version Editor). Then you can search for the word "beta". You might be lucky and find a clue to the problem that way.

I configured again with CMAKE. then it is fine.

It happens to me every time Xcode has new version. clang and bunch of other apps can't find old name SDK.
then i do something stupid:
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
sudo ln -s MacOSX.sdk <<PUT HERE ANY SDK NAME WANTS and MISSES>>

but, how can i convince the system to do it by itself?


Please check the ENV variable SDKROOT. Propably there is the wrong path stored.

I changed my zprofile to auto get the SDK path using the following: export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)

Will this cause me any problems in the future?

Cheers,

Leandro

SDK Path wrong
 
 
Q