-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rpath is incorrect when crate links against compiler libraries #58343
Comments
The "one |
Notice that relative rpaths are generally unsuited for what I want to do, which is I suppose there are also good reasons to want relative rpaths, so I think this should be a flag. I am not sure what kind of flag and what would be a good default, though. |
Turns out |
For those who stumble upon this issue, you can workaround this by specifying # Fails
$ ./target/debug/binary
./target/debug/binary: error while loading shared libraries: librustc_driver-110042e1a47a5f15.so: cannot open shared object file: No such file or directory
# Add the path to the `lib` folder of your toolchain.
$ LD_LIBRARY_PATH=~/.rustup/toolchains/nightly-2024-08-21-x86_64-unknown-linux-gnu/lib ./target/debug/binary
(Runs successfully) Interestingly enough, I don't have to specify |
When compiling something like Miri that links against librustc and other compiler libraries, even with
rpath = true
in myCargo.toml
, the resulting binary does not work withoutLD_LIBRARY_PATH
:Looking at the bianary, I noticed a RUNPATH and no RPATH and learned that RPATH got deprecated in favor of RUNPATH:
However, after some research, two things strike me about this:
First of all, the number of "../" is wrong -- there is one too much. Starting at the directory containing the binary (
~/src/rust/miri/target/release
), going up 4 times leads to~/src
, while therustc.2
directory is at~/src/rust/rustc.2
.Second, according to this, the binary needs to have theI verified this locally and that flag does not seem to be needed.ORIGIN
flag set for$ORIGIN
to actually work, and that flag is not set:I am also really surprised that it encodes the path to the sysroot as relative to the binary, but the path to other libs compiled in the same crate as absolute to the binary. Shouldn't it rather be the other way around?
The text was updated successfully, but these errors were encountered: