-
-
Notifications
You must be signed in to change notification settings - Fork 15k
-C rpath does not work on OS X #17219
Copy link
Copy link
Closed
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.O-macosOperating system: macOSOperating system: macOS
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.O-macosOperating system: macOSOperating system: macOS
Type
Fields
Give feedbackNo fields configured for issues without a type.
With just
rustc -C prefer-dynamic test.rs, I get a binary with load commands that look like this:This is not an absolute path, and in fact does not even exist - since I downloaded rustc from a nightly, the real path is
/Users/comex/rust-nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustrt-4e7c5e5c.dylib. The pre-install path comes from that library'sLC_ID_DYLIB.The binary does not run, but so far that's expected behavior and setting
DYLD_LIBRARY_PATHworks. However, as far as I can tell,-C rpathis supposed to make a binary with the correct path built in. It does not. It adds a-rpathentry, but on OS X,-rpathis documented as follows:While
LC_RPATHshows up in the binary, theLC_LOAD_DYLIBload paths are the same oldx86_64-apple-darwin/etc/etc, so the rpath is not used and nothing changes.