Skip to content

Do not set DYLD_LIBRARY_PATH to point the installed toolchain/sdk on macOS. #733

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 29, 2021
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
2 changes: 1 addition & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions Sources/SwiftDriver/Jobs/Toolchain+InterpreterSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,9 @@ extension DarwinToolchain {
targetInfo: FrontendTargetInfo) throws -> [String: String] {
var envVars: [String: String] = [:]

let runtimePaths = try runtimeLibraryPaths(
for: targetInfo,
parsedOptions: &parsedOptions,
sdkPath: sdkPath,
isShared: true
).map { $0.name }

addPathEnvironmentVariableIfNeeded("DYLD_LIBRARY_PATH", to: &envVars,
currentEnv: env, option: .L,
parsedOptions: &parsedOptions,
extraPaths: runtimePaths)
parsedOptions: &parsedOptions)

addPathEnvironmentVariableIfNeeded("DYLD_FRAMEWORK_PATH", to: &envVars,
currentEnv: env, option: .F,
Expand Down
5 changes: 5 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,12 @@ final class SwiftDriverTests: XCTestCase {
}

XCTAssertFalse(job.commandLine.contains(.flag("--")))
// On darwin, swift ships in the OS. Immediate mode should use that runtime.
#if os(macOS)
XCTAssertFalse(job.extraEnvironment.keys.contains("\(driver.targetTriple.isDarwin ? "DYLD" : "LD")_LIBRARY_PATH"))
#else
XCTAssertTrue(job.extraEnvironment.keys.contains("\(driver.targetTriple.isDarwin ? "DYLD" : "LD")_LIBRARY_PATH"))
#endif
}

do {
Expand Down