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

Tracking Issue for native link modifier as-needed #99424

Open
3 tasks
petrochenkov opened this issue Jul 18, 2022 · 8 comments
Open
3 tasks

Tracking Issue for native link modifier as-needed #99424

petrochenkov opened this issue Jul 18, 2022 · 8 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC S-tracking-needs-to-bake Status: The implementation is "complete" but it needs time to bake. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@petrochenkov
Copy link
Contributor

This is a tracking issue for native link modifier as-needed, which is a part of RFC "Linking modifiers for native libraries" (#81490, rust-lang/rfcs#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

@petrochenkov petrochenkov added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 18, 2022
@GoldsteinE
Copy link
Contributor

What prevents this from moving forward? Can I help with stabilization somehow?

@petrochenkov
Copy link
Contributor Author

AFAIK, it's still not implemented on some tier 1 platforms (Apple targets).

@GoldsteinE
Copy link
Contributor

I don’t think I can help with that — I don’t own Mac. :(

@wesleywiser
Copy link
Member

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.

@kamyuentse
Copy link

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 (85e449a 2024-03-22)

@hietalajulius
Copy link

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 (85e449a 2024-03-22)

@kamyuentse did you end up resolving this somehow?

@bjorn3
Copy link
Member

bjorn3 commented Nov 14, 2024

Maybe running cargo with RUSTFLAGS="-Zunstable-features as env var is required?

@hietalajulius
Copy link

hietalajulius commented Nov 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC S-tracking-needs-to-bake Status: The implementation is "complete" but it needs time to bake. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants