Skip to content

Update DYLD_LIBRARY_PATH to fix debugging tests in nightly toolchains #1521

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 2 commits into from
Apr 24, 2025

Conversation

plemarquand
Copy link
Contributor

A change in SwiftPM removed the rpath that pointed to usr/lib/swift/macosx/testing
(swiftlang/swift-package-manager#8295).

Consequently when debugging tests in VS Code libTesting.dylib could not be found and the tests would not start. This is only happening in nightly toolchains that contain the SwiftPM change noted above.

Fix this by adding the search path to the DYLD_LIBRARY_PATH.

A change in SwiftPM removed the rpath that pointed to
`usr/lib/swift/macosx/testing`
(swiftlang/swift-package-manager#8295).

Consequently when debugging tests in VS Code `libTesting.dylib` could
not be found and the tests would not start. This is only happening in
nightly toolchains that contain the SwiftPM change noted above.

Fix this by adding the search path to the DYLD_LIBRARY_PATH.
}
return path.join(base, "usr/lib");
return `${result}${path.join(this.toolchainPath, "lib/swift/macosx/testing")}`;

Choose a reason for hiding this comment

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

I think it's just missing usr/ prefix, now

Suggested change
return `${result}${path.join(this.toolchainPath, "lib/swift/macosx/testing")}`;
return `${result}${path.join(this.toolchainPath, "usr/lib/swift/macosx/testing")}`;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this.toolchainPath already has /usr prefixed in the path, the comment on it says "one folder up from the swift bin path": https://github.com/swiftlang/vscode-swift/pull/1521/files#diff-219ebe526be52811261023900cb320d9e51723308f63891304bfe53dcab033f1R107

The commit message has a bit of history there that predates my time, it may not be true anymore, however it would be a bigger change to update the toolchainPath everywhere.

Choose a reason for hiding this comment

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

Ah, ok if it already has that prefix then great! 👍

@plemarquand plemarquand merged commit 391e6fb into swiftlang:main Apr 24, 2025
16 checks passed
@plemarquand plemarquand deleted the update-dyld-lib-path branch April 24, 2025 23:10
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