Skip to content

Add back -no-toolchain-stdlib-rpath when installing sourcekit-lsp on linux #715

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
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
// swift-tools-version:5.5

import PackageDescription
import Foundation

// When building the toolchain on the CI, don't add the CI's runpath for the
// final build before installing.
let sourcekitLSPLinkSettings : [LinkerSetting]
if ProcessInfo.processInfo.environment["SOURCEKIT_LSP_CI_INSTALL"] != nil {
sourcekitLSPLinkSettings = [ .unsafeFlags(["-no-toolchain-stdlib-rpath"], .when(platforms: [.linux, .android])) ]
} else {
sourcekitLSPLinkSettings = []
}

let package = Package(
name: "SourceKitLSP",
Expand Down Expand Up @@ -36,7 +46,8 @@ let package = Package(
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
],
exclude: ["CMakeLists.txt"]),
exclude: ["CMakeLists.txt"],
linkerSettings: sourcekitLSPLinkSettings),

.target(
name: "SourceKitLSP",
Expand Down Expand Up @@ -235,8 +246,6 @@ let package = Package(
// by the external environment. This allows sourcekit-lsp to take advantage of the automation used
// for building the swift toolchain, such as `update-checkout`, or cross-repo PR tests.

import Foundation

if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
// Building standalone.
package.dependencies += [
Expand Down
2 changes: 2 additions & 0 deletions Utilities/build-script-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def build_single_product(product: str, swift_exec: str, args: argparse.Namespace
"""
swiftpm_args = get_swiftpm_options(swift_exec, args)
additional_env = get_swiftpm_environment_variables(swift_exec, args)
if args.action == 'install':
additional_env['SOURCEKIT_LSP_CI_INSTALL'] = "1"
cmd = [swift_exec, 'build', '--product', product] + swiftpm_args
check_call(cmd, additional_env=additional_env, verbose=args.verbose)

Expand Down