Skip to content

Installing docs with x.py install is very slow. #80684

Closed

Description

@vext01

CC @pietroalbini

On today's git (0cd459f) x.py install seems to get stuck if you are building docs.

In config.toml:

[install]
prefix = "build/ykrustc-stage2-latest"
sysconfdir = "etc"

x.py install will get stuck at:

    Finished release [optimized] target(s) in 8.38s
Dist rust-docs-1.51.0-dev-x86_64-unknown-linux-gnu
        finished in 17.222 seconds
Install docs stage2 (Some(TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }))
install: creating uninstall script at /home/vext01/source/rust/build/tmp/empty_dir/build/ykrustc-stage2-latest/lib/rustlib/uninstall.sh
install: installing component 'rust-docs'

The underlying command is: sh /home/vext01/source/rust/build/tmp/tarball/rust-docs/x86_64-unknown-linux-gnu/rust-docs-1.51.0-dev-x86_64-unknown-linux-gnu/install.sh --prefix=/home/vext01/source/rust/build/ykrustc-stage2-latest --sysconfdir=build/ykrustc-stage2-latest/etc --datadir=build/ykrustc-stage2-latest/share --docdir=build/ykrustc-stage2-latest/share/doc/rust --bindir=build/ykrustc-stage2-latest/bin --libdir=build/ykrustc-stage2-latest/lib --mandir=build/ykrustc-stage2-latest/share/man --disable-ldconfig

Adding this to the config seems to work around the hang:

[build]
docs = false

Thanks!

Activity

  1. emilyalbini commented on Jan 4, 2021

    @emilyalbini
    Member

    How long did you let the command run before killing it? I remember installing the docs taking a long time last time I did it.

  2. vext01 commented on Jan 4, 2021

    @vext01
    ContributorAuthor

    I left it for half an hour or so IIRC. I'll run it for longer and see if it goes away.

    How long do you think it should take to install on a modern SSD?

  3. emilyalbini commented on Jan 4, 2021

    @emilyalbini
    Member

    I don't remember exactly how long it takes, but it doesn't depend on the speed of the disk. install.sh is just really inefficient. You can see if it's actually hanging by checking the contents of lib/rustlib/install.log this command while it's installing:

    tail -f build/ykrustc-stage2-latest/lib/rustlib/install.log
    
  4. vext01 commented on Jan 4, 2021

    @vext01
    ContributorAuthor

    The log file is empty, but I can see new files appearing on the disk (using find and diff) so progress must be occurring. Slowly.

  5. vext01 commented on Jan 4, 2021

    @vext01
    ContributorAuthor

    It's been about 40 minutes now. It seems to be adding files to build/tmp/empty_dir/ is that right?

  6. vext01 commented on Jan 4, 2021

    @vext01
    ContributorAuthor

    Build completed successfully in 0:57:44

    So it's just very slow.

  7. changed the title [-]`x.py install` hangs installing docs.[/-] [+]Installing docs with `x.py install` is very slow.[/+] on Jan 4, 2021
  8. added
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    C-bugCategory: This is a bug.
    T-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.
    on Jan 5, 2021
  9. jyn514 commented on Feb 14, 2021

    @jyn514
    Member

    I took a look into this. The main issue is that the generated install.sh is very inefficient; it takes about 5 minutes to copy 2500 files (there are more than 2500, but I got bored and cancelled it). @pietroalbini @Mark-Simulacrum what do you think about rewriting this inner loop in Rust so it's not launching so many external processes?

    https://github.com/rust-lang/rust-installer/blob/5254dbfd25d5284728ab624dca1969d61427a0db/install-template.sh#L548

  10. daira commented on Mar 31, 2021

    @daira
    Contributor

    This issue is compounded on macOS, where it seems to be even more inefficient to launch lots of processes from a shell. Sorry I don't have timings, but it takes tens of minutes at least for this step [edit: over an hour]; long enough that I would expect most users who are trying to build our software from source in macOS (it's Zcash, which installs a pinned version of Rust in order to build) are likely to think it's hanging and give up.

  11. Mark-Simulacrum commented on Mar 31, 2021

    @Mark-Simulacrum
    Member

    I think the problem may largely be that the manifest.in generated for rust-docs component (at least) is a file: list instead of using the directory: command; directory commands should be much more efficient. This change may be a recent(ish) regression; I suspect that fixing that is likely the right solution here.

  12. jyn514 commented on Mar 31, 2021

    @jyn514
    Member

    what do you think about rewriting this inner loop in Rust so it's not launching so many external processes?

    Oops I forgot to link back here: we discussed this briefly on Zulip and it was difficult to do in a cross-platform way.

  13. daira commented on Apr 1, 2021

    @daira
    Contributor

    We solved our problem for Zcash by just not installing rust-docs (passing --without=rust-docs to install.sh). This reduced our total build time on macOS from 95 minutes to 27 minutes! Obviously it doesn't solve the underlying issue.

  14. 12 remaining items

  15. added a commit that references this issue on Nov 16, 2025
  16. added a commit that references this issue on Nov 17, 2025
  17. added 2 commits that reference this issue on Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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)T-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions