libstd.so removal breaks external proc_macro with -Cprefer-dynamic #141958
Labels
A-linkage
Area: linking into static, shared libraries and binaries
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Hello,
I hope I'm explaining this correctly, please let me know if more info or clarifications are necessary.
In ChromeOS we are building external proc_macro crates with -Cprefer-dynamic, like this one. By this I mean non rustc_driver and outside the scope of the
rustc_private
feature, which modifies the linking behavior such that libstd.so is not dynalically linked if its already statically linked.This results in binaries which dynamically link against libstd.so, however libstd.so got removed in 2cf1559, so now the binaries fail:
Perhaps commit 2cf1559 was too eager in removing libstd.so from the sysroot? AFAIU it incorrectly assumes libstd is always statically linked?
Code
If I remove the
can_be_rustc_dynamic_dep
check added in commit 2cf1559, the binaries start working again because libstd.so is not gated behindlink_std_into_rustc_driver(target_compiler.host)
anymore.Any ideas how to proceed? I can send a PR undoing the
can_be_rustc_dynamic_dep
check, however maybe the check can somehow be improved? Or is it just an incorrect assumption that libstd is always statically linked?Version it worked on
Worked fine in 1.82 or earlier, before commit 2cf1559 landed.
If I undo or revert that commit like I mention in the Code section above, binaries work fine again on all versions 1.83 and later.
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: