-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add an rpath flag to disable the default of looking in the local directory for shared libraries #6947
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
Conversation
|
||
/// Disables adding $ORIGIN/@loader_path to the rpath, useful when deploying | ||
@Flag(name: .customLong("disable-local-rpath"), help: "Disable adding $ORIGIN/@loader_path to the rpath by default") | ||
public var shouldDisableLocalRpath: Bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care what the flag name is, feel free to suggest another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call it "origin" instead of "local"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered that originally but used this broader term when I disabled the Darwin @loader_path
too. Do you want me to keep that disabled for Darwin and change this flag and variable name to origin
? I have no preference on these two aspects of this pull.
@@ -5021,4 +5021,87 @@ final class BuildPlanTests: XCTestCase { | |||
XCTFail("expected a Swift target") | |||
} | |||
} | |||
|
|||
func testBasicSwiftPackageWithoutLocalRpath() throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is a copy and paste of testBasicSwiftPackage()
above, with the rpath disabled and a few checks removed.
@neonichu, please run the CI on this. |
@swift-ci please test |
…ctory for shared libraries This is useful when deploying build products, as most executables are not installed in the same directory as libraries and system libraries do not need it for system paths. Use the new flag when installing SwiftPM itself and the {Manifest,Plugin}API libraries on ELF platforms.
Linux CI passed, while Windows CI failed spuriously. Mac CI said it didn't find a warning diagnostic from the old test I modified, so I just updated the test to not look for that. |
@neonichu, please rerun the CI. |
@bnbarham, would you run the CI on this? |
@swift-ci please test |
@neonichu, passed CI, ready for review. |
This is useful when deploying build products, as most executables are not installed in the same directory as libraries and system libraries do not need it for system paths. Use the new flag when installing SwiftPM itself and the {Manifest,Plugin}API libraries on ELF platforms.
On linux, I currently see this with Swift 5.9:
After applying this pull to trunk on Android, the extraneous rpath is gone:
I have no idea if this is useful on Darwin too, but I went ahead and disabled adding
@loader_rpath
too. Let me know if that's worthwhile.