-
Notifications
You must be signed in to change notification settings - Fork 8
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
Consider not building std as a dylib. #35
Comments
Right so some workspace should require std as a dylib, not std itself. Looks like just a straight-up layer violation to me. Only root crates should decide how things are built. |
I definitely think we should do this, if only to just make the implementation more conservative. We can always add this back in later but it's really difficult to remove the dylib crate type after it's out there! I think the best way to do this will be to iterate over the libstd dependency graph and just forcibly delete the
I'm not sure I quite understand this, @ehuss can you clarify? |
With a dylib, if you do The dylib problem also comes up with having a global shared I thought there was a cargo issue somewhere about this, but I can't find it. (The closest is rust-lang/cargo#6313, but the issue there is a bit more complex, but the root of the problem is that there is no hash in the dylib filename.) It's been a long while since I looked at this, but IIRC you can't just tell rustc to use |
Aha yes that all makes sense! One thing I'm wondering though, why does libstd not have a hash in its filename? Does it have to do with the (it may be worth a separate issue to put a hash in the filename) |
Ah ok, |
This commit forcibly prevents Cargo from building the `std` crate as a `dylib`, even though libstd upstream lists a `dylib` crate type. We ideally want a first-class feature for doing this one day, but for now we can just hack around with the manifests to ensure that the `dylib` crate type never shows up. Note that this is only supported for libstd, and it's also all part of the unstable details of building std. Closes rust-lang/wg-cargo-std-aware#35
Don't build libstd as a `dylib` This commit forcibly prevents Cargo from building the `std` crate as a `dylib`, even though libstd upstream lists a `dylib` crate type. We ideally want a first-class feature for doing this one day, but for now we can just hack around with the manifests to ensure that the `dylib` crate type never shows up. Note that this is only supported for libstd, and it's also all part of the unstable details of building std. Closes rust-lang/wg-cargo-std-aware#35
It was supposed to be closed by rust-lang/cargo#7353 but apparently it didn't work. |
Indeed! |
The current manifest for
std
builds it as both an rlib and dylib. The dylib isn't needed for Cargo (AFAIK, it is mainly forlibrustc_driver.so
). We should figure out some way to prevent it from being built.One problem this causes is that it causes a rebuild of everything when you switch compilers because the dylib does not include a hash in the filename. (dylibs without hashes are generally problematic, but that is a separate issue.)
See also rust-lang/rust#56443.
The text was updated successfully, but these errors were encountered: