Open petrochenkov opened 2 years ago
What prevents this from moving forward? Can I help with stabilization somehow?
AFAIK, it's still not implemented on some tier 1 platforms (Apple targets).
I don’t think I can help with that — I don’t own Mac. :(
Visited during the compiler team tracking issue triage meeting. Our understanding is that the implementation of this feature is complete but there are some not-quite resolved questions regarding support for older Apple linkers. As such, we're tentatively marking this as S-tracking-needs-to-bake
while those questions are resolved.
I use println!("cargo:rustc-link-lib=dylib:-as-needed=mylib");
on build.rs
. And got error: linking modifier as-needed
is unstable and only accepted on the nightly compiler. I already use the nightly toolchain.
rustc 1.79.0-nightly (85e449a32 2024-03-22)
I use
println!("cargo:rustc-link-lib=dylib:-as-needed=mylib");
onbuild.rs
. And got error: linking modifieras-needed
is unstable and only accepted on the nightly compiler. I already use the nightly toolchain.rustc 1.79.0-nightly (85e449a 2024-03-22)
@kamyuentse did you end up resolving this somehow?
Maybe running cargo with RUSTFLAGS="-Zunstable-features
as env var is required?
Maybe running cargo with
RUSTFLAGS="-Zunstable-features
as env var is required?
Hmm yeah thanks, setting RUSTFLAGS="-Zunstable-options
works when running a binary from the crate itself (call it crate_a
) where the build.rs
uses -as-needed
. When running a binary from another crate (say crate_b
) that depends on crate_a
, I keep getting error: linking modifier as-needed is unstable and only accepted on the nightly compiler
.
Hmm ok that does the trick even in the ^^ case, weird I could have sworn it didn't at first :D
This is a tracking issue for native link modifier
as-needed
, which is a part of RFC "Linking modifiers for native libraries" (https://github.com/rust-lang/rust/issues/81490, https://github.com/rust-lang/rfcs/pull/2951). The feature gate for the issue is#![feature(native_link_modifiers_as_needed)]
.About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Unresolved Questions
The modifier is not yet implemented for some Tier 1 targets (Apple targets).
Implementation history