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
[SR-1967] Need way to disable inclusion of hard-coded RPATH to stdlib dir #44576
Comments
CC @belkadan |
See, e.g., apple/swift-package-manager#459 |
I'm hesitant to mess with this because while the current situation is wrong, it's also useful.
Rather than a One thing we can fix immediately is that we still add this rpath even with |
I actually just submitted a PR for not adding this when statically linking the standard library: #10381 |
As of that PR we no longer add the RPATH when statically linking the Swift stdlib. If there's a prevailing idea here about how to solve the other issue I'd be happy to take a stab at it. |
@belkadan When SwiftPM handles this itself, it can always directly pass the RPATH necessary, I'm not sure why swiftc doing it by default is the right interface (clang++ doesn't embed an RPATH to libc++, for example). Its rather annoying to have hard coded functionality with no way to disable it, so if we don't have an alternate proposal I would like some interface to disable it. I'm ok with your proposed `-stdlib-runtime-install-path` semantics, it is monotonically better than what we have now. Are you ok with going forward with that? |
clang++ doesn't rpath to libc++ because libc++ has an absolute install path. swiftCore et al do not. If you want to go with -stdlib-runtime-install-path, please bring it up on swift-dev so that other people can weigh in on the problem. |
@dan-zheng added a flag for this a little more than a year ago and I have updated the CMake config of most of the toolchain to use it: The help text for that flag is incorrect, as it is the default on macOS now, but not on linux and other platforms using the Unix driver (I don't know what Windows does for a rpath, maybe @compnerd could let us know). I think those are the right defaults for mac and unix, as macs now ship with Swift but most linux distros don't, and these new flags now allow the user to override those defaults. We can probably close this now, once those remaining details are addressed. |
I don't think Windows has an rpath, and the POSIX platforms now have sensible defaults and flags that let you opt out. |
Additional Detail from JIRA
md5: 5c00e4292b15293eed2dbd4557a31849
is duplicated by:
relates to:
Issue Description:
swiftc
is currently unconditionally embedding an LC_RPATH to the standard library location in all the binaries it creates.This isn't appropriate for most use cases, those locations embed information on the host system which is not suitable for redistribution.
We need
swiftc
to either stop doing this, or provide a way we can disable it. For now, we have to resort to stripping it of the binaries usinginstall_name_tool
.The text was updated successfully, but these errors were encountered: