Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcekitten 'complete' resulting in Loading standard library failed. #750

Open
konrad1977 opened this issue Nov 1, 2022 · 3 comments
Open

Comments

@konrad1977
Copy link

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?

@fairyorbital
Copy link

same issue

@konrad1977
Copy link
Author

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=' or '-fbuild-session-file='
:0: error: unable to load standard library for target 'arm64-apple-ios16.1'
Error: Loading the standard library failed

@dpkirchner
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants