Skip to content

[Linux] Set rpath in add_swift_executable. #67711

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
Aug 5, 2023

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented Aug 3, 2023

Because the rpath isn't set, the dynamic linker can't find the Swift libraries when we try to run swift-backtrace on Linux (when we actually install everything).

rdar://113337854

Because the rpath isn't set, the dynamic linker can't find the Swift
libraries when we try to run `swift-backtrace` on Linux (when we
actually install everything).

rdar://113337854
@al45tair al45tair requested review from tomerd and etcwilde August 3, 2023 15:52
@al45tair
Copy link
Contributor Author

al45tair commented Aug 3, 2023

@swift-ci Please smoke test

@al45tair
Copy link
Contributor Author

al45tair commented Aug 3, 2023

@swift-ci Please smoke test Windows platform

@al45tair
Copy link
Contributor Author

al45tair commented Aug 3, 2023

@swift-ci Please smoke test macOS platform

@al45tair
Copy link
Contributor Author

al45tair commented Aug 3, 2023

@swift-ci Please smoke test Windows platform

@al45tair
Copy link
Contributor Author

al45tair commented Aug 3, 2023

@swift-ci Please smoke test macOS platform

elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
set_target_properties(${name} PROPERTIES
BUILD_WITH_INSTALL_RPATH YES
INSTALL_RPATH "$ORIGIN/../../../lib/swift/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}")
Copy link
Member

Choose a reason for hiding this comment

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

This will add this relative rpath to all target executables on linux, like swift-reflection-test, so it seems mistaken. Better to pass in a relative path, like _add_swift_runtime_link_flags() does with relpath_to_lib_dir.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

swift-reflection-test isn't ever installed, and the rpath set there doesn't matter. If it was installed, it would be put into libexec and in that case it would also need this rpath.

Copy link
Member

Choose a reason for hiding this comment

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

True, it isn't installed now.

@al45tair
Copy link
Contributor Author

al45tair commented Aug 3, 2023

@swift-ci Please smoke test Windows platform

1 similar comment
@al45tair
Copy link
Contributor Author

al45tair commented Aug 4, 2023

@swift-ci Please smoke test Windows platform

@al45tair al45tair requested a review from mikeash August 4, 2023 09:01
@al45tair al45tair merged commit 208fce1 into swiftlang:main Aug 5, 2023
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