-
Notifications
You must be signed in to change notification settings - Fork 93
Adding non freestanding crates to list of crates xargo builds #17
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
Comments
Yeah, I think we can make Xargo obey a
Cross compiling non freestanding crates is more complicated than cross compiling freestanding crates, because the former might require a C cross compiler to build C dependencies like jemalloc and libbacktrace. And if you want to work with
Anything that requires these will require either hacking more logic into Xargo or "crate-ifying" them in the rust-lang/rust repo. I prefer the later. |
So from what I have found, passing in something like As for compiler-rt, you already download the source for it when building the sysroot, and building it is just (in the src/.. dir) |
Actually yea, something like the alloc_jemalloc crate but for compiler-rt and others would be better. And because compiler-rt produces libcompiler-rt.a it could be wrapped with a crate that just produces a staticlib only. |
I think that should be
(what's build_helper?) the gcc crate only work correctly for some built-in targets (Xargo primary objective are custom targets) and the gcc prefixes it selects are based on what Ubuntu/Debian chose. And that breaks down when your Linux distribution installs a toolchain like
The problem with this is that: (a)
nods I actually have this idea of building |
I was referring to rust-lang/rust: src/build_helper (I thought it had more helper methods than it actually does). It's used by the build.rs in libstd. And I thought it was doing a bunch of environment checking, but its actually done by the libbacktrace configure I think which is called just before (in libstd/build.rs).
Is there anywhere that provides a libcompiler-rt.a as a download for a particular triple? |
Any chance that could be made easier with something like Docker or a VM? I think that would be useful to get going faster, then at a later stage if beneficial the user could setup the environment locally. I've seen an example Dockerfile for a Rust project recently if that's helpful. You might want to use Alpine as the base rather than ubuntu, also came across this reddit comment that suggests getting it running on Alpine should be fine :) Could be useful addition to cu too? |
Docker would help, yes. Some could make a single massive Docker image with all the cross C toolchains one can think of. The Rust team has been thinking about something different though: Make rustup capable of (automatically) installing cross C toolchains.
You can't run
There's already a docker image for copper. |
I must have misunderstood what I read, sorry about that.
Ah, sorry I only came across |
To clarify, you can cross compile Rust programs to the x86_64-unknown-linux-musl target. Those binaries are (fully) statically linked and can run on any linux distribution regardless of the libc it uses. You can't do the same with rustc and get a rustc that works on Alpine because there some bug in rustc/llvm that I haven't figured out how to fix.
Don't be sorry! The docker image wasn't really documented. I have been it using for cu's Travis CI job but that's not really visible. The docker image is mentioned in the copper website but the website just came out today 😄. |
So, is there any way we can build liblibc/libstd into our sysroots created by Xargo today, even if it involves some bootstrapping with a |
No, at this very moment. It should be relatively easy to make Xargo build
In priniciple, this Cargo.toml should just work (assuming you have the [package]
name = "foo"
version = "0.1.0"
authors = ["Jorge Aparicio <[email protected]>"]
[dependencies]
std = { path = "/home/japaric/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd" } where But it doesn't work 😄. Right now, it errors building And if you try to compile So, this scenario of explicitly listing |
Yeah, I am getting the |
Xargo now builds everything the std crate incluning std itself. But it still won't try to build a sysroot for built-in targets; that's covered by #77. I don't intend to add a way to pick which crates should conform the sysroot. That will be covered by std-aware cargo. So I'm going to close this. |
cargo-sysroot had the ability to add additional crates by providing a sysroot.toml. Are there any plans for supporting this with xargo?
The text was updated successfully, but these errors were encountered: