Skip to content
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

Cargo can't set rpath into library or binary #9966

Closed
ruisv opened this issue Oct 8, 2021 · 4 comments
Closed

Cargo can't set rpath into library or binary #9966

ruisv opened this issue Oct 8, 2021 · 4 comments
Labels
C-bug Category: bug

Comments

@ruisv
Copy link

ruisv commented Oct 8, 2021

build.rs

println!("cargo:rustc-link-arg=-Wl,-rpath={}", &libdir);

I set rpath in this way but it didn't take effect.
How to set rpath into library or binary?

Thank you for your reply.

@ruisv ruisv added the C-bug Category: bug label Oct 8, 2021
@ehuss
Copy link
Contributor

ehuss commented Oct 8, 2021

There is an rpath setting in the profiles you can set, does that help?

@ruisv
Copy link
Author

ruisv commented Oct 13, 2021

There is an rpath setting in the profiles you can set, does that help?

When I use conda, there is an environment variable that stores the library path like $CONDA_PREFIX. If it is set in the configuration file, the environment variable cannot be automatically matched.

@ehuss
Copy link
Contributor

ehuss commented Oct 22, 2021

The link arguments should be passed to the binary. Can you provide a reproduction or any other details to indicate what you've tried and why it doesn't appear to be working? If I try a simple binary with your example, I get:

objdump -x target/debug/foo | grep runpath
  RUNPATH              /home/eric/Temp

where that is a path I added in build.rs.

@ehuss
Copy link
Contributor

ehuss commented Sep 26, 2023

Closing as there doesn't appear to be enough information here to move this forward. If the questions above could be answered, preferably with a full reproduction and set of steps, feel free to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants