jpsim / SourceKitten

An adorable little framework and command line tool for interacting with SourceKit.
MIT License
2.31k stars 226 forks source link

Troubleshooting SourceKitten on Linux #708

Open mikolasstuchlik opened 3 years ago

mikolasstuchlik commented 3 years ago

Hello,

I am having hard time troubleshooting SourceKitten module-info command on Linux.

I would like to read module info of a C (system library) module, Swift module and Foundation module on both macOS and Linux. I have no issues on macOS. It also works on one Ubuntu 21.04 machine but I don't know why. I was unable to get it working on any other Ubuntu 21.04 machine. (Commands I use are listed here: https://github.com/rhx/gir2swift/issues/21#issuecomment-916032763 )

YAML machine produced by SourceKitten was the same on both working and not-working Ubuntu machines. The error from SourceKit has kind sourcekitd_error_t.SOURCEKITD_ERROR_REQUEST_FAILED but carries no message.

At this point I need an advice on how to troubleshoot the sourcekitd. Is there a possibility to get some log? Should I try to build and run the sourcekitd in a debugger?

mikolasstuchlik commented 3 years ago

I have successfuly resolved the issue. The underlying question (how to troubleshoot) remains imho open.


I have been playing with the SourceKit before and I have left a symbolic link to the .so in /usr/lib. SourceKitten attempted to load the library using the symbolic link first and was successful. Therefore it didn't even try to load the path in the LINUX_SOURCEKIT_LIB_PATH variable. However library loaded using the symbolic link was causing the issue (I don't know why, I would guess it requires some other things in the toolchain).

jpsim commented 3 years ago

You can set a SOURCEKIT_LOGGING=3 environment variable to get more logging from SourceKit itself.