Hello, currently I try to compile against a c library which isn't in the standard folder so I need to set a -rpath-link however I didn't find anything in the docs, is there any way by setting it?
4 Likes
You can specify arbitrary linker flags via:
-
#[link_args = "..."]
right in sources, but it's unfortunately gated and thus not for stable -
-C link-args="..."
, but that's command line for compiler, which Cargo seems to be unable to set ATM.
Bringing this thread back to life! I'm working with a vendor SDK for embedded linux and this is a requirement.
If anyone is familiar with nvidia jetsons and or Drive PX systems or have used Rust with an Nvidia sdk in a cross compilation environment then I'd be happy to learn about any work arounds.
1 Like
Ok, just for future searches. At the current time I was only able to make this work using the RUSTFLAGS environment variable to specify multiple -C linker-flag=-Wl,-rpath-link,/foo
options.
It would be super to be able to emit this via my build script instead.
1 Like
Now you can set the rust flags for cargo in the .cargo/config
file in your project like this:
[build]
rustflags = ["-C", "linker-flag=-Wl,-rpath-link,/foo"]
3 Likes