Error running sourcekit-lsp in MacOS

In Catalina Beta 2, I get the following error when I try to run sourcekit-lsp after following the tutorial here (The end of step 4):
This copy of libswiftCore.dylib requires an OS version prior to 10.14.4.

I used swift --version to verify that I am building with the latest 5.1 version of swift. Is there anything else I can do to make sure the output will be compatible with Catalina? Or is this just not supported yet?

update: I found that there is a swift-5.1 branch and I tried that to no avail.

It seems like it's trying to use the bundled version of the stdlib instead of the one in /usr/lib/swift. What does otool -L .build/debug/sourcekit-lsp say? I would expect /usr/lib/swift/libswiftCore.dylib.

Can you reproduce this in a new swift package? E.g.

mkdir foo
swift package init --type executable
swift build
.build/debug/foo

CC @Aciid

1 Like

I am not sure what's going on either. Output from otool will help.

Thank you for the response! Yes, I am able to reproduce the same error with a new package using the steps you outlined.

Here is the line of otools output that I assume is most relevant:
@rpath/libswiftCore.dylib (compatibility version 1.0.0, current version 1001.0.82)

Full otools output
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
    /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 274.22.0)
    /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1570.15.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 944.3.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1570.15.0)
    @rpath/libswiftCore.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftCoreFoundation.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftDarwin.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftDispatch.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftFoundation.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftIOKit.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftSwiftOnoneSupport.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftXPC.dylib (compatibility version 1.0.0, current version 1001.0.82)
    @rpath/libswiftos.dylib (compatibility version 1.0.0, current version 1001.0.82)

I think you're not compiling with the development snapshot toolchain; what's the output of swiftc --version? Does it work if you build with the environment variable TOOLCHAINS=swift?

1 Like

Yes, that was the problem. Thank you very much and sorry for the misdirection when I said I was on 5.1 - I guess I wasn't!