rust-lang / rust-lang/rustup

Add support for custom targets in the style of xargo/cargo-xbuild

Open
#1,538 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Hello.

I've been using xargo for a while and recently checked out cargo-xbuild. Curious as to how these work, I realised all that you need to do is build the libcore-etc for the target and put these in the sysroot directory. Rustup manages its own sysroot for common targets.

It would be really nice if we could instead do rustup target add x86_64-sel4-robigalia.json to ask rustup to track the target file and rebuild the libcore-etc when either rustc updates or when the user attempts to build something using the target with a newer rustc or when the target file changes.

As a bonus feature it might be faster (or bandwidth-cheaper or just more convenient such as when offline) for some people to build any simple targets using only rust-src and a collection of target.json files.

I'm currently just using unmodified and unwrapped cargo with only these two environment variables set after having used xargo/xbuild at least once after calling rustup update.

export RUSTFLAGS="--sysroot $HOME/my_project/target/sysroot"
export RUSTDOCFLAGS=$RUSTFLAGS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the rustup target add flow and how rustup manages sysroots and rust-src; the issue names no source files or tests, so first identify those entry points. Done means custom target JSON files can be tracked, libcore-etc is rebuilt when rustc or the target changes, and simple targets can optionally use rust-src offline.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.