You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the issue is more about using the cfg(target_feature), rather than crt-static itself? Since #29717 is still open, i bet that's what's going on.
libc should not be relying on the link_cfg feature except when built as part of the standard library. When built as a normal crates.io crate that attribute should not exist, which means it is likely a bug in libc.
The syntax #[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))] is intended to be an unstable detail only used for libc when built as part of the standard library because the standard library is compiled at a point where it does not know whether the user wants a static CRT or dynamic CRT.
As far as I can tell by looking at the code, that attribute should only even be activated during a cargo build when you've opted out of the use_std default feature. However I see that CI does test cargo build --no-default-features which makes me wonder whether it is testing that target. Because it doesn't explicitly specify --target that means.... it isn't actually testing that target until it does the docker tests, which never build the crate with --no-default-features!
Activity
Rollup merge of rust-lang#37545 - alexcrichton:crt-static, r=brson
47 remaining items
clarfonthey commentedon Jul 20, 2017
So apparently, libc fails to compile on MUSL for me because of this feature:
But this appears to be stabilised? Am I missing something?
(note: this is via
cargo build --release --target x86_64-unknown-linux-musl)steveklabnik commentedon Jul 20, 2017
@clarcharr I believe that's because it's stable in 1.19, which is gonna get released in like 45 minutes.
clarfonthey commentedon Jul 20, 2017
@steveklabnik sorry, I should have clarified that this is on nightly.
QuietMisdreavus commentedon Jul 20, 2017
It looks like the issue is more about using the
cfg(target_feature), rather thancrt-staticitself? Since #29717 is still open, i bet that's what's going on.retep998 commentedon Jul 20, 2017
libcshould not be relying on thelink_cfgfeature except when built as part of the standard library. When built as a normal crates.io crate that attribute should not exist, which means it is likely a bug inlibc.jirutka commentedon Jul 20, 2017
/cc @shizmob
clarfonthey commentedon Jul 20, 2017
@retep998 I'm having trouble imagining this as a bug in libc considering how musl is a tested target; maybe a recent change triggered this?
retep998 commentedon Jul 20, 2017
The syntax
#[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))]is intended to be an unstable detail only used forlibcwhen built as part of the standard library because the standard library is compiled at a point where it does not know whether the user wants a static CRT or dynamic CRT.As far as I can tell by looking at the code, that attribute should only even be activated during a cargo build when you've opted out of the
use_stddefault feature. However I see that CI does testcargo build --no-default-featureswhich makes me wonder whether it is testing that target. Because it doesn't explicitly specify--targetthat means.... it isn't actually testing that target until it does the docker tests, which never build the crate with--no-default-features!clarfonthey commentedon Jul 20, 2017
aha!
I'll link this in a comment on libc to point out that the musl build is indeed failing.
varkor commentedon Apr 3, 2020
This issue is still linked to in errors for
#[link(cfg(foo))], so shouldn't it still be open?petrochenkov commentedon May 9, 2020
@varkor
It's better to make a new issue (or remove reference to this issue from the feature gate).
varkor commentedon May 9, 2020
I've opened #72059, though I haven't had time to look into the state of this feature.
Rollup merge of rust-lang#108549 - clubby789:fix-link-cfg-issue, r=eholk