Skip to content

List dependencies to build SourceKit-LSP in the Linux section #403

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

Merged
merged 2 commits into from
May 26, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 26, 2021

They were previously only listed in the Docker section, but they apply to general Linux equally.

Also add a comment that modifying your PATH is really necessary and that you shouldn’t try to be clever and skip that step.

Resolves rdar://77853086 [SR-14614]

ahoppen added 2 commits May 26, 2021 12:17
I’ve spend an hour trying to figure out why the test suite didn’t pass, because I was trying to be clever and not modify my `PATH` to have `<path_to_swift_toolchain>/usr/bin` as the first entry. So: Add a comment, telling you to not try and be clever.
They were previously only listed in the Docker section, but they apply to general Linux equally.
@ahoppen ahoppen requested a review from benlangmuir May 26, 2021 10:20
```sh
$ export PATH="<path_to_swift_toolchain>/usr/bin:${PATH}"
$ swift package update
$ swift build -Xcxx -I<path_to_swift_toolchain>/usr/lib/swift -Xcxx -I<path_to_swift_toolchain>/usr/lib/swift/Block
```

Setting `PATH` as described above is important even if `<path_to_swift_toolchain>/usr/bin` is already in your `PATH` because `/usr/bin` must be the **first** path to search.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because /usr/bin must be the first path to search.

Why would it need to be first? Obviously if you have more than one toolchain on your path you need the right one to come before the wrong one, but that's just normal PATH behaviour.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that in the docker container, we have the following PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

sourcekit-lsp finds libsourcekitdInProc and libIndexStore relative to /usr/sbin in /usr/sbin/../lib/ (aka. /usr/lib). Thus /usr/sbin is not discarded and it becomes the default toolchain. But it doesn’t contain the swift (or clang) executable, causing all sorts of later failures. If /usr/bin is before /usr/sbin in PATH, we don’t hit this issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the note is fine for now, but this seems like something we should fix. We could recognize when one toolchain is a strict superset of another one (sbin and bin have the same libraries but only bin has the executables).

@benlangmuir
Copy link
Contributor

@swift-ci please test

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

Successfully merging this pull request may close these issues.

2 participants