Skip to content

[build-script] Cross-compile sourcekit-lsp for arm64 #59046

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 1 commit into from
Jun 1, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 24, 2022

Currently, when building an open source toolchain, SourceKit-LSP is only built for x86_64. Copy the cross-compilation config from swiftpm.py to also produce a fat sourcekit-lsp executable for both x86_64 and arm64.

rdar://78039145

@ahoppen ahoppen force-pushed the pr/fat-sourcekit-lsp branch from 7fdbbf4 to e88f0fb Compare May 24, 2022 11:02
Copy link
Member

@finagolfin finagolfin left a comment

Choose a reason for hiding this comment

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

Makes sense, but some changes needed.

@@ -74,6 +74,10 @@ def get_dependencies(cls):
swiftpm.SwiftPM,
swiftsyntax.SwiftSyntax]

@classmethod
def has_cross_compile_hosts(self, args):
return args.cross_compile_hosts
Copy link
Member

Choose a reason for hiding this comment

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

Maybe pull this into the base class so all products can use it?

Copy link
Member Author

@ahoppen ahoppen May 24, 2022

Choose a reason for hiding this comment

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

Good idea 👍

helper_cmd += [cross_compile_host]
elif product.is_cross_compile_target(host_target):
helper_cmd += ['--cross-compile-hosts', host_target,
'--skip-cmake-bootstrap']
Copy link
Member

Choose a reason for hiding this comment

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

Please just copy the above lines here instead, as this is a SPM-specific flag.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I missed this.

@ahoppen ahoppen force-pushed the pr/fat-sourcekit-lsp branch 2 times, most recently from 2a323e6 to 7c5be0f Compare May 24, 2022 12:42
@ahoppen ahoppen marked this pull request as draft May 24, 2022 12:42
@ahoppen ahoppen force-pushed the pr/fat-sourcekit-lsp branch 5 times, most recently from 37dc138 to 498d4f7 Compare May 25, 2022 20:36
@ahoppen ahoppen requested a review from benlangmuir May 26, 2022 07:14
@ahoppen ahoppen marked this pull request as ready for review May 26, 2022 07:14
Copy link
Contributor

@benlangmuir benlangmuir left a comment

Choose a reason for hiding this comment

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

Made a minor suggestion, but LGTM.

def supports_cross_compilation(self):
"""
Whether the product can be built for a different architecture than the
host by passing --cross-compile-host to it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just override has_cross_compile_hosts on IndexStoreDB?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I didn’t think of that. Good idea 👍

Currently, when building an open source toolchain, SourceKit-LSP is only built for x86_64. Copy the cross-compilation config from swiftpm.py to also produce a fat sourcekit-lsp executable for both x86_64 and arm64.

rdar://78039145
@ahoppen ahoppen force-pushed the pr/fat-sourcekit-lsp branch from 498d4f7 to c1994b4 Compare May 27, 2022 08:31
@ahoppen
Copy link
Member Author

ahoppen commented May 27, 2022

swiftlang/sourcekit-lsp#556

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented May 27, 2022

swiftlang/sourcekit-lsp#556

@swift-ci Please build toolchain

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.

3 participants