Skip to content

[SR-1639][SourceKit] Link SwiftLang libraries to sourcekitd #2766

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

Conversation

modocache
Copy link
Contributor

What's in this pull request?

When building SourceKit on Linux, sourcekitdAPI would not be linked to SourceKitSwiftLang, which caused the following symbols to be undefined:

  • SourceKit::LangSupport::SynthesizedUSRSeparator
  • SourceKit::LangSupport::createSwiftLangSupport(SourceKit::Context&)

Link SourceKitSwiftLang to resolve these symbols.

Resolved Related bug number: (SR-1639)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

When building SourceKit on Linux, sourcekitdAPI would not be linked to
SourceKitSwiftLang, which caused the following symbols to be undefined:

- `SourceKit::LangSupport::SynthesizedUSRSeparator`
- `SourceKit::LangSupport::createSwiftLangSupport(SourceKit::Context&)`

Link SourceKitSwiftLang to resolve these symbols.
@modocache
Copy link
Contributor Author

@swift-ci please test

DEPENDS
SourceKitSupport SourceKitSwiftLang
# Clang dependencies, required by SourceKitSwiftLang
clangFormat clangToolingCore clangDriver
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there's a way with CMake to link SourceKitSwiftLang such that its own dependencies don't need to be listed again here? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I wondered that as well. I was surprised I had to do this, to be honest. Maybe @llvm-beanz would know?

Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't have to do this. CMake understands transitive dependencies between static archives, it should do the right thing.

I suspect this is caused by the way Swift builds out-of-tree with LLVM & Clang. My "stab in the dark" here is that it handles static libraries specified by full path differently than libraries that are specified by target.

I wonder if this could be fixed in a minimally invasive way by having Swift include the CMake Exports lists from Clang and LLVM. Then the LLVM and Clang targets would be exposed more cleanly in Swift's build.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are already using the LLVM exports list. I am going to be looking into doing the Clang side of it in a bit. It is causing us problems on master-next.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on the problem? Including LLVMExports.cmake and ClangTargets.cmake should setup all the transitive dependencies correctly.

@briancroom
Copy link
Contributor

LGTM

@modocache
Copy link
Contributor Author

These changes are still relevant. Looks like @briancroom is cool with this change, so I'll go ahead and merge if the tests pass. If any other committers have thoughts, let me know!

The test run was so long ago, Jenkins must have cleaned up the job page -- it's a 404 now. Re-running to see how things currently stand:

@swift-ci please test

@modocache
Copy link
Contributor Author

The swift-package-manager failure in JSONTests.testDecoding is obviously unrelated. Merging!

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.

4 participants