SourceKitten icon indicating copy to clipboard operation
SourceKitten copied to clipboard

Sourcekitten 'complete' resulting in Loading standard library failed.

Open konrad1977 opened this issue 1 year ago • 3 comments

I tried the complete version from documentation but with my current SDK. sourcekitten complete --text "import UIKit ; UIColor." --offset 22 -- -target arm64-apple-ios16.0-simulator -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk

:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone' :0: error: unable to load standard library for target 'arm64-apple-ios16.0-simulator' Error: Loading the standard library failed

I don't know whats wrong. Any ideas?

konrad1977 avatar Nov 01 '22 16:11 konrad1977

same issue

fairyorbital avatar Nov 15 '22 10:11 fairyorbital

sourcekitten complete --text "import UIKit ; UIColor." --offset 22 -- -Xcc -isysroot -sdk $(xcrun --show-sdk-path --sdk iphonesimulator) -target arm64-apple-ios16.1

Dunno if I am closer or further away: :0: warning: no such sysroot directory: '-fbuild-session-timestamp=1668526260' :0: error: option '-fmodules-validate-once-per-build-session' requires '-fbuild-session-timestamp=<seconds since Epoch>' or '-fbuild-session-file=' :0: error: unable to load standard library for target 'arm64-apple-ios16.1' Error: Loading the standard library failed

konrad1977 avatar Nov 15 '22 15:11 konrad1977

I think I might be a little bit closer, but I'm still running in to what I believe is the same bug. I'm on 0.34.1.

$ sourcekitten complete --text "import UIKit ; UIColor." --offset 22 -- -sdk $(xcrun --show-sdk-path --sdk iphoneos) -Xcc "-isysroot $(xcrun --show-sdk-path --sdk iphoneos)"
<unknown>:0: warning: no such sysroot directory: ' /Applications/Xcode-15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk'
<unknown>:0: warning: using sysroot for 'iPhoneOS' but targeting 'MacOSX'
2C457FED-88F1-4B8C-AE75-94B6D5AF6827.swift:1:8: error: no such module 'UIKit'
import UIKit ; UIColor.
       ^
[{"typeName":"_","numBytesToErase":0,"sourcetext":".self","context":"source.codecompletion.context.thisclass","descriptionKey":"self","kind":"source.lang.swift.keyword","name":"self"}]

I've tried with and without -target arm64-apple-ios17.0. With -target:

$ sourcekitten complete --text "import UIKit ; UIColor." --offset 22 -- -target arm64-apple-ios17.0 -sdk $(xcrun --show-sdk-path --sdk iphoneos) -Xcc "-isysroot $(xcrun --show-sdk-path --sdk iphoneos)"
<unknown>:0: warning: no such sysroot directory: ' /Applications/Xcode-15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk'
<unknown>:0: error: unable to load standard library for target 'arm64-apple-ios17.0'
Error: Loading the standard library failed

For what it's worth, I believe that the arguments passed to -Xcc need to be quoted (-Xcc arguments are passed to the compiler, and I guess in this case -isysroot path/to/something is supposed to be passed to cc). I think that's why you're seeing that -fbuild-session-timestamp error.

I'm guessing the complete feature is not compatible with the latest Xcode + clang + etc.

dpkirchner avatar Dec 02 '23 01:12 dpkirchner