substrate icon indicating copy to clipboard operation
substrate copied to clipboard

ios build fails with SDK "iphoneos" cannot be located

Open erwin1 opened this issue 5 years ago • 5 comments

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.

erwin1 avatar Dec 16 '19 10:12 erwin1

Possible fix:

  • Improve error message and suggest above commands

erwin1 avatar Dec 16 '19 10:12 erwin1

@erwin1 @jperedadnr is this fixed? Can the issue be closed?

johanvos avatar Jan 16 '20 10:01 johanvos

I think so

jperedadnr avatar Jan 16 '20 10:01 jperedadnr

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.

jperedadnr avatar Feb 04 '21 10:02 jperedadnr

On M1 Mac - Jul 2022

  • Launch xcode
  • Preferences
  • Locations
  • Make sure there's a dropdown option selected for the command line tools

chaudev avatar Jul 22 '22 02:07 chaudev