Skip to content

Make it easier to build libstd, liballoc, libcore, etc for cross compiled environments #32597

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

Closed
cardoe opened this issue Mar 30, 2016 · 4 comments
Labels
A-cross Area: Cross compilation C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@cardoe
Copy link
Contributor

cardoe commented Mar 30, 2016

This is really for those that do cross compiles and also for source based distros that cross compile. Right now you must build llvm, rustc, and libstd for each platform you intend to target but the idea here would be you build llvm, rustc and libstd for your HOST and it should only need libstd (and its depends) to be a full cross compile environment. e.g.

<snip>
/usr/lib/rust-1.7.0/rustlib/x86_64-unknown-linux-gnu/lib/libstd-6a154fe0.rlib

<snip>
/usr/lib/rust-1.7.0/rustlib/i686-unknown-linux-gnu/lib/libstd-6a154fe0.rlib

<snip>
/usr/lib/rust-1.7.0/rustlib/mips-unknown-linux-musl/lib/libstd-6a154fe0.rlib

It should be as simple as running: cargo build --target=mips-unknown-linux-musl or cargo build --target=i686-unknown-linux-gnu

A few projects are aiming to provide this or some subset of this but it seems like they run into limitations and have to massage parts of the Rust build system so it would be nice if the new rustbuild supported this use case.

@archshift
Copy link
Contributor

Indeed this would be incredibly useful, especially when trying to cross-compile to a platform that rust doesn't provide pre-built binaries for.

@joerg-krause
Copy link
Contributor

Yes, I would really appreciate it! For now, cross-compiling the rustlibs for unsupported targets without the need to compile the whole rust environment cannot be done easily.

I asked for support a while ago: #30710 and came up with my own solution to cross-build the rustlibs for my ARMv5 target: https://github.com/joerg-krause/rust-cross-libs.

@archshift
Copy link
Contributor

For me personally I'd appreciate some kind of way to either cargo install a library (using a certain target) or have cargo, when resolving dependencies, recursively use a provided replacement library.

For example, currently if you depend on https://crates.io/crates/rust-libcore in your Cargo.toml file, it will use said libcore when building your project, but any dependencies will still fail to find a libcore for the proper target.

@sanxiyn sanxiyn added the A-cross Area: Cross compilation label Jan 10, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 24, 2017
@steveklabnik
Copy link
Member

There has long been a desire to "bring xargo into cargo", so much so that it's on the cargo team's roadmap for this year. Given that this effort would be tracked as part of that, I don't think this tracking issue really serves a purpose; RFCs will be created and accepted (or denied) based on that effort. So I'm going to give this a close. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross Area: Cross compilation C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

No branches or pull requests

6 participants