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

rustc needs parameter for soname (or ld flags in general) #43190

Closed
metux opened this issue Jul 12, 2017 · 3 comments
Closed

rustc needs parameter for soname (or ld flags in general) #43190

metux opened this issue Jul 12, 2017 · 3 comments

Comments

@metux
Copy link

metux commented Jul 12, 2017

rustc currently doesn't add, and doesn't allow specifying the library soname.
Thus, ld cannot differenciate between binary versions, which makes it extremley hard to have multiple versions coexist (requires horrible LD_LIBRARY_PATH games), and therefore causes bad headaches for distro packaging.

Actually, it doesn't even allow passing any linker flags at all.

@cuviper
Copy link
Member

cuviper commented Jul 12, 2017

You can use rustc -Clink-arg=-Wl,-soname=foo.so.1.

But as I mentioned in #43186, I don't think one should do this without actually ensuring the ABI stability that this implies. It's not there at all for Rust APIs -- rust-lang/rfcs#600 -- and even if it were it would probably still take some effort by the library author to do it right.

It could make sense for a cdylib, if you do make sure to keep that ABI stable.

@codyps
Copy link
Contributor

codyps commented Jul 12, 2017

In the context of cargo, that could be RUSTFLAGS="-Clink-arg=-Wl,-soname=foo.so.1" cargo build, but it seems likely that this will pass the -soname arg in more places than desirable (to dependencies, non-cdylib crates in the package, etc).

For supporting cdylibs, it may make sense to add some cargo support. Alternately, one could use something like patchelf to set the soname after the fact.

@Mark-Simulacrum
Copy link
Member

This feels like this is perhaps a Cargo issue, since I think -Clink-arg on Rust's side is sufficient based on discussion here. This may need an RFC, though.

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

No branches or pull requests

4 participants