rust-lang / rust-lang/rust

`make install` only keeps docs of last target for multi-target builds

Open
#140,922 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Summary

When building with multiple targets, e.g., target = ['aarch64-apple-darwin', 'bpfel-unknown-none'], only the docs of the last target in the list are installed by make install. If one these targets is nostd and the other isn't, the end user might except the docs to have std docs but will not if the nostd target is listed last (as of https://github.com/rust-lang/rust/pull/137073). As can be seen in the docs attached at the end of this issue, this is because make install tries to install the docs for each target, and with every subsequent target uninstalls the previous target's docs:

Dist rust-docs-1.89.0-aarch64-apple-darwin
	finished in 7.115 seconds
Installing stage2 docs (aarch64-apple-darwin)
install: creating uninstall script at /Users/niklaskorz/dev/rust/rust/inst/lib/rustlib/uninstall.sh
install: installing component 'rust-docs'

    rust docs installed.

Dist rust-docs-1.89.0-bpfel-unknown-none
	finished in 0.499 seconds
Installing stage2 docs (bpfel-unknown-none)
install: uninstalling component 'rust-docs'
install: creating uninstall script at /Users/niklaskorz/dev/rust/rust/inst/lib/rustlib/uninstall.sh
install: installing component 'rust-docs'

    rust docs installed.
Command used
./configure \
  --release-channel=stable \
  --build=aarch64-apple-darwin \
  --host=aarch64-apple-darwin \
  --target=aarch64-apple-darwin,bpfel-unknown-none

make

make install
Expected behaviour

I'm not entirely sure if there is a "correct behavior" here, but I would either except every target's docs to be installed, or in case of mixed std and nostd targets, to keep the docs of the "most complete" target (i.e., not the nostd targets). Alternatively, I could imagine a new config variable in [install] that configures from which target docs should be installed.

Actual behaviour

Only the docs of the last target in the build.target config list are installed.

Bootstrap configuration (bootstrap.toml)
profile = 'dist'

[llvm]

[gcc]

[build]

build = 'aarch64-apple-darwin'
host = ['aarch64-apple-darwin']
target = ['aarch64-apple-darwin', 'bpfel-unknown-none']

configure-args = ['--release-channel=stable', '--build=aarch64-apple-darwin', '--host=aarch64-apple-darwin', '--target=aarch64-apple-darwin,bpfel-unknown-none']

[install]

prefix = '/Users/niklaskorz/dev/rust/rust/inst'
sysconfdir = '/Users/niklaskorz/dev/rust/rust/sysconfdir'

[rust]

channel = 'stable'

[target.aarch64-apple-darwin]

[target.bpfel-unknown-none]

[dist]
Operating system

macOS 15.4.1 (but affects all systems)

HEAD

9a7e19f2b66c472811b4bff02695c7a03f3f4151

Additional context

This was discovered in the context of nixpkgs (see https://github.com/NixOS/nixpkgs/issues/405914), where we build multiple targets into one toolchain by default (the system target, e.g. aarch64-apple-darwin or x86_64-unknown-linux-gnu, and additionally wasm32-unknown-unknown, wasm32v1-none, bpfel-unknown-none and bpfeb-unknown-none).

make install log (as gist because it exceeds the issue size limit)

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 reproducing the multi-target case with the provided configure arguments, then trace the make install path for rust-docs and the uninstall script shown in the log. Review bootstrap.toml, especially [build] targets and [install], to determine the intended policy for multiple targets. Done means the selected or combined documentation remains installed consistently, with behavior covered by an appropriate regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.