substrate
substrate copied to clipboard
ios build fails with SDK "iphoneos" cannot be located
When building for target iOS on Mac, this error occurred:
[Mon Dec 16 11:12:57 CET 2019][FINE] PB Command for sdk: xcrun --sdk iphoneos --show-sdk-path [Mon Dec 16 11:12:57 CET 2019][FINE] Start process sdk... [Mon Dec 16 11:12:57 CET 2019][FINE] [SUB] xcrun: error: SDK "iphoneos" cannot be located [Mon Dec 16 11:12:57 CET 2019][FINE] [SUB] xcrun: error: SDK "iphoneos" cannot be located [Mon Dec 16 11:12:57 CET 2019][FINE] [SUB] xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
When running the same command in a terminal, it produced the same error:
xcrun --sdk iphoneos --show-sdk-path xcrun: error: SDK "iphoneos" cannot be located
However, the path to xcode seemed to be wrong:
sudo xcode-select --print-path /Library/Developer/CommandLineTools
And when corrected like this:
sudo xcode-select --switch /Applications/Xcode.app xcrun --sdk iphoneos --show-sdk-path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk
The build succeeded.
Possible fix:
- Improve error message and suggest above commands
@erwin1 @jperedadnr is this fixed? Can the issue be closed?
I think so
The issue still happens in the compile phase, when searching for the path for the SDK.
The changes in https://github.com/jperedadnr/substrate/commit/c1e2d792aeaa4969848549f84f42178461617bfc have not been upstreamed.
In case XcodeUtils::getSdkDir
fails, we should run xcode-select
.
On M1 Mac - Jul 2022
- Launch xcode
- Preferences
- Locations
- Make sure there's a dropdown option selected for the command line tools