-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add a --sysroot option to build and rustc commands #2312
Comments
This sounds like it's a use case for |
This won't be very useful if you have to pass the C sysroot in |
japaric
pushed a commit
to japaric/cargo
that referenced
this issue
Mar 4, 2016
This patch lets you use the 'profile.$profile.sysroot' key in Cargo.toml to pass `--sysroot $path` to `rustc` during the compilation of the current crate and its dependencies. Main use cases are kernel development and bare metal programming (e.g. microcontrollers) where the application depends on a minimal set of "core" crates like `core`, `alloc`, `collections`, etc. These dependencies need to be cross compiled for the target platform/architecture and a "sysroot" (*) provides, IMO ,the cleanest way to make these core dependencies available to the many crates that conform the application. (*) A sysroot is basically a directory that holds the already (cross) compiled "standard" crates (i.e. `core`, `std`, etc) that are linked to your Rust programs when you call `rustc`. The important bit is that you don't explicitly spell out these dependencies in e.g. a Cargo.toml; they are implicitly available. The fastest way to familiarize with sysroots is to explore the default sysroot with something like `tree $(rustc --print sysroot)`. cc rust-lang#2312
This sounds like it can be closed. Please reopen if I'm wrong! 🌵 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When cross compiling you need to provide both a target and a sysroot (a place where all the target libraries can be found). Both cargo and rustc should provide a way to set these. rustc's
--sysroot
might be buggy or rust specific, see rust-lang/rust#31180 and it does not pass it on to the linker.The text was updated successfully, but these errors were encountered: