rustrust-cargorustup

Rustup: how to add/build components for custom toolchain


I need to build a repo using a custom toolchain. However, that repo requires

rust-src rustc-dev llvm-tools-preview

However, it seems rustup can't install components for custom toolchains(correct me if I'm wrong).

Do you know how can I install them or build them by myself?

Thanks


Solution

  • The correct workflow is:

    1. build & install your custom toolchain to a folder.
    2. run ./x.py dist, then you can get many compressed components in the build/dist folder.
    3. select the component you want and decompress it, there is an install.sh script, you can use that script to install the component to your custom toolchain. One example of mine is ./install.sh --prefix=~/rust_custom --components=rustc-dev, suppose I installed my toolchain in ~/rust_custom folder.

    P.S.

    It seems x.py doesn't have an install command for the llvm-tools, so at least this component needs to be installed manually for a custom toolchain.