Skip to content

Adjust libstd to make non-Rust dependencies optional #54

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
nagisa opened this issue Apr 4, 2020 · 8 comments
Open

Adjust libstd to make non-Rust dependencies optional #54

nagisa opened this issue Apr 4, 2020 · 8 comments
Labels
plan before stabilization This needs a plan for how to address before stabilization, but does not need to be implemented. S-needs-design Status: needs design work

Comments

@nagisa
Copy link
Member

nagisa commented Apr 4, 2020

Cross-compiling C dependencies is a major pain. The only such dependency libstd has currently to the best of my knowledge is backtrace-sys. I would much rather have an easy time building libstd without an ability to produce backtraces than having to fiddle getting full toolchain set-up for a thing as obscure as, say, netbsd.

@RalfJung
Copy link
Member

RalfJung commented Apr 5, 2020

FWIW, here's the libstd feature config that Miri uses to avoid any C dependencies. Since rust-lang/backtrace-rs#297 landed, that avoids any C dependency, and we have CI on the Miri side to ensure this remains the case.

Another problem is that libstd by default is built as rlib and dylib, and building a dylib also usually requires a target toolchain. However, std-aware cargo might already work around this, I am not sure. (Miri works around this by only doing a check-build of libstd.)

@ehuss
Copy link
Contributor

ehuss commented Apr 5, 2020

However, std-aware cargo might already work around this, I am not sure.

There is a hack in Cargo to force it to skip the dylib. You even commented on it. 😜 Ideally there would be first-class support for that, but that is off-topic.

@RalfJung
Copy link
Member

RalfJung commented Apr 5, 2020

Ah lol, my memory is getting worse it seems. ;)
But good to hear that that will not be a problem! That solution is not accessible to Miri, but we have our own solution, so that's okay.

@joshtriplett
Copy link
Member

At this point, std now uses gimli rather than libbacktrace.

@runiq
Copy link

runiq commented May 17, 2021

Triage: Given that the only C dependency has been replaced with a Rust dependency, can this be closed or is the underlying issue still worth solving?

@RalfJung
Copy link
Member

I'd say the underlying issue has been solved -- even working backtraces requires no non-Rust dependency.

@ehuss
Copy link
Contributor

ehuss commented May 17, 2021

linux-musl still requires a C compiler (and I think fortanix-sgx does, too). I'm not sure if there needs to be 100% coverage for all targets, but I'm not sure where to draw the line.

@12101111
Copy link

linux-musl still requires a C compiler (and I think fortanix-sgx does, too). I'm not sure if there needs to be 100% coverage for all targets, but I'm not sure where to draw the line.

I'm working on refactoring libunwind and the c/c++ part will not link into libunwind.rlib ( by kind = "static-nobundle" or kind = "static", modifiers = "-bundle" from linking modifiers rfc), It will copy to self-contained directory by rustbuild. If we handle #46 properly , the linker will use libunwind.a either from old self-contained directory or provided by system, and unwind crate don't need c/c++ compiler to compile. rust-lang/rust#85600

@ehuss ehuss added plan before stabilization This needs a plan for how to address before stabilization, but does not need to be implemented. S-needs-design Status: needs design work labels May 3, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
plan before stabilization This needs a plan for how to address before stabilization, but does not need to be implemented. S-needs-design Status: needs design work
Projects
None yet
Development

No branches or pull requests

6 participants