Description
Description
In some configurations, SourceKit on Linux fails to cache modules (while emitting SIL?), crashing with the following error:
/usr/local/swift/bin/sourcekit-lsp: symbol lookup error: /usr/local/swift/lib/libsourcekitdInProc.so:
undefined symbol: _Z13OStream_write14BridgedOStreamN4llvm9StringRefE
The function in question is defined here
https://github.com/apple/swift/blob/b914fc05d881a1d672684b50e98334d5fb203713/lib/Basic/BasicBridging.cpp#L22-L25
I was able to confirm that pre-building a module cache with swiftc
stops the crash from occurring. Running nm
on libsourcekitdInProc.so
, it seems like the symbol is unresolved:
/usr/local/swift/lib$ nm libsourcekitdInProc.so | grep OStream_write
U _Z13OStream_write14BridgedOStreamN4llvm9StringRefE
Interestingly, other libraries (and swiftc) static-link the symbol from libBasic just fine so I'm not sure what's special about sourcekitdInProc.
Steps to reproduce
- Use
sourcekit-lsp
with a non-prebuilt module in the search path (such as by passing-Xswiftc -I/path/to/module
) - When the editor opens the file and loads type info, observe that sourcekit-lsp crashes.
Expected behavior
libsourcekitdInProc.so should not cause a crash.
Environment
- Swift compiler version info: Swift version 5.9-dev (LLVM bf1b8ef1742ad70, Swift 627525c)
- Linux version: Ubuntu Jammy 22.04.3 LTS
Note that I was able to repro this as far back as Swift 5.7.3 (didn't test anything earlier than that).