Skip to content

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

Open
@niklaskorz

Description

@niklaskorz

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 #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

9a7e19f

Additional context

This was discovered in the context of nixpkgs (see NixOS/nixpkgs#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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions