[SR-1676] Build SourceKit on Linux Created: 3 Jun 2016  Updated: 10 May 2017  Resolved: 10 May 2017

Status: Closed
Project: Swift
Component/s: Tooling

Type: New Feature Priority: Medium
Reporter: Brian Croom Assignee: Alex Blewitt
Resolution: Done Votes: 5
Labels: Linux

Issue Links:
blocks SR-710 Generate XCTestCaseProvider entries o... Open
is blocked by SR-1613 Require blocks runtime when compiling... Closed
is blocked by SR-1639 [SourceKit] Add in-process implementa... Closed
is blocked by SR-1677 Link with libdispatch when building S... Closed
SR-3698 Ensure dry run works for SourceKit Sub-task Open  
SR-3699 Configure builtbots so that source ki... Sub-task Closed  


SourceKit is currently disabled altogether on Linux, but the plan for resolving SR-710 requires that it be available. The InProc version of sourcekitd should be sufficient for this purpose, but there is still a bit of work required to get this building. See the linked sub-tasks for a (partial?) list of outstanding work.

Comment by Brian Croom [ 3 Jun 2016 ]

For reference, here is a list of related PRs that Brian Ivan Gesiak posted on SR-710 recently:

  • https://github.com/apple/swift/pull/2704 – Includes the swift-corelibs-libdispatch headers, so the SourceKit Linux build at least gets to the linking stage (which fails).
  • https://github.com/apple/swift/pull/2763 – When building SourceKit using an in-process model (as opposed to XPC), the linking phase of sourcekitd-repl fails, because we haven't build sourcekitd (instead we build sourcekitdInProc. This fixes that linker error.
  • https://github.com/apple/swift/pull/2766 – Fixes another linker error for SourceKit on Linux.
  • https://github.com/apple/swift/pull/2769 – Provides stub implementations for sourcekitdAPI functions that will need non-XPC implementations. The idea here is to at least get SourceKit to compile on Linux, and to leave the implementation for later. This probably shouldn't be merged, but I'd appreciate feedback.
    https://github.com/apple/swift/pull/2793 – After applying the above pull requests, the only remaining linker errors for SourceKit on Linux are for unresolved libdispatch symbols. Which begs the question: do we link libdispatch to Linux SourceKit, or do we replace libdispatch with something else (like std::async)? This pull request is the first in a series of steps that would replace libdispatch.
Comment by Brian Croom [ 14 Jun 2016 ]

I've opened some other pull requests related to this work:

https://github.com/apple/swift/pull/3019 - Annotate some tests that fail on Linux
https://github.com/apple/swift/pull/2862 - Link with libdispatch on Linux

Comment by Brian Croom [ 20 Jun 2016 ]

Here is some additional outstanding work on this front:

https://github.com/apple/swift/pull/3026 - In-Proc implementation of sourcekitd API functions
https://github.com/apple/swift/pull/3079 - Only build sourcekitd-repl if a unicode-aware libedit is present
https://github.com/apple/swift/pull/3080 - CMake dependency fixes
https://github.com/apple/swift/pull/3085 - Add Semaphore to SourceKitSupport's concurrency module

Comment by Brian Croom [ 19 Aug 2016 ]

Unassigning this from myself as I am unable to continue working on it currently (and haven't been for some time already.)

Comment by Alex Blewitt [ 23 Jan 2017 ]

The build script has been changed to allow source kit to be built on Linux. It does not yet exist in the standard installation however, which means that it's not in the downloadable packages that come from swift.org.

Comment by Norio Nomura [ 1 Apr 2017 ]

opened https://github.com/apple/swift/pull/8485 - Enable SourceKit tests if building SourceKit

Comment by Norio Nomura [ 26 Apr 2017 ]

opened https://github.com/apple/swift/pull/9025 - Enable SourceKit tests if building SourceKit other than ubuntu 14.04

Comment by Alex Blewitt [ 10 May 2017 ]

Since we're building SourceKit on Linux, and the other task isn't blocking this one, I believe we can close this. Norio, can you confirm?

Comment by Norio Nomura [ 10 May 2017 ]

Should we open another issue about tests failed and are disabled on ubuntu 14.04?

Comment by Alex Blewitt [ 10 May 2017 ]

Sounds like a good idea. The problem is, I wasn't able to reproduce it locally and it's difficult to know how the 14.04 buildbot is set up.

Generated at Thu Jun 21 09:16:45 CDT 2018 using JIRA 7.3.4#73015-sha1:a262b3457b3605f12635df4b0a0c3dc71d631a1e.