SolaWing / xcode-build-server

a build server protocol implementation for integrate xcode with sourcekit-lsp
MIT License
283 stars 16 forks source link

Loading the standard library failed (Xcode 15.3 beta) #40

Closed kuglee closed 2 months ago

kuglee commented 2 months ago

Hi,

Thanks for this tool. I've installed this tool from brew.

I'm using Xcode 15.3 beta (15E5178i) and the autocomplete doesn't work in neovim. I don't know if this tool should be working with Xcode beta.

This is the output from :LspLog

[ERROR][2024-02-21 23:09:28] .../vim/lsp/rpc.lua:734    "rpc"   "/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp" "stderr"    "INFO:root:Xcode Build Server Startup. Waiting Request...\nWARNING:root:observe thread exit by exception: invalid literal for int() with base 10: b'94*{'\n"
[ERROR][2024-02-21 23:09:33] .../vim/lsp/rpc.lua:734    "rpc"   "/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp" "stderr"    "[2024-02-21 23:09:33.218] error response (Request Failed): Loading the standard library failed\n"

buildServer.json

{
    "name": "xcode build server",
    "version": "0.2",
    "bspVersion": "2.0",
    "languages": [
        "c",
        "cpp",
        "objective-c",
        "objective-cpp",
        "swift"
    ],
    "argv": [
        "/opt/homebrew/bin/xcode-build-server"
    ],
    "workspace": "/Users/kuglee/Downloads/NeovimTest/NeovimTest.xcodeproj/project.xcworkspace",
    "build_root": "/Users/kuglee/Library/Developer/Xcode/DerivedData/NeovimTest-epiyiyxemrrqtehjglonzjurbatt",
    "scheme": "NeovimTest",
    "kind": "xcode"
}

If I remove the buildServer.json, I get autocompletion, so the LSP support is working correctly.

SolaWing commented 2 months ago

seems your build log not parsed correctly, and the default flags not compatible with beta xcode. to make it work:

ensure your build and log same with your buildServer.json build_root. To rule out unexpected interference, you should compile in xcode and confirm from the log that the output is to the same build_root directory.

if the build_root is same with xcode build, and still not work, you can upload the <build_root>/Logs/Build logs for me to analyze the issue.

also you can see details logs by set environment SOURCEKIT_LOGGING=3, set it before lsp setup, in nvim, exe:

vim.env.SOURCEKIT_LOGGING="3" in lua, or let $SOURCEKIT_LOGGING="3" in vimscript

FYI: #32 seems to similar to your issue. especially suggestion from https://github.com/SolaWing/xcode-build-server/issues/32#issuecomment-1928894449

kuglee commented 2 months ago

The build root was correct.

I've got the LSP working after exporting the build log and running xcode-build-server parse /Users/kuglee/Downloads/logs/Build\ NeovimTest_2024-02-22T08-34-43.txt.

I've attached the configs and logs. logs.zip

SolaWing commented 2 months ago

I found your xcactivitylog format contains a unknown * type, record TaskMetrics info. I made it compatible in newest head. You can install by git clone to try if that fixes the problem

kuglee commented 2 months ago

It fixed the problem. I've deleted the .compile and buildServer.json files and regenerated the buildServer.json with xcode-build-server config. Also tried it on a different project.

Thanks 🙏