Skip to content

x.py (bootstrap) does not accept -j, despite the docs and apparent logic to handle it. #40920

Closed

Description

While working on #40417 I discovered that x.py spits out the help string if you try to use the -j option. This will affect #40366 as well, which I ran across while looking to see if this issue had already been reported.

x.py is just a thin wrapper around the main() function of src/bootstrap/bootstrap.py, which mostly ensures the bootstrap binary (src/bootstrap/bin/main.rs) has been compiled and then passes most arguments (including -j) to the bootstrap binary.

It is the bootstrap binary itself which can't handle the -j argument -- the python script just passes the argument through to it. The bootstrap binary is placed at build/bootstrap/debug/bootstrap when it is built. You can see the buggy behavior by just doing this:

$ build/bootstrap/debug/bootstrap -j 10 build
unknown command: -j
Usage: x.py -j [options] [<args>...]

Options:
    -v, --verbose       use verbose output (-vv for very verbose)
    -i, --incremental   use incremental compilation
        --config FILE   TOML configuration file for build
        --build BUILD   build target of the stage0 compiler
        --host HOST     host targets to build
        --target TARGET target targets to build
        --on-fail CMD   command to run on failure
        --stage N       stage to build
        --keep-stage N  stage to keep without recompiling
        --src DIR       path to the root of the rust checkout
    -j, --jobs JOBS     number of jobs to run in parallel
    -h, --help          print this help message

Subcommands:
    build       Compile either the compiler or libraries
    test        Build and run some test suites
    bench       Build and run some benchmarks
    doc         Build documentation
    clean       Clean out build directories
    dist        Build and/or install distribution artifacts

To learn more about a subcommand, run `./x.py <command> -h`

If the bootstrap binary hasn't been built yet, you can build it by running x.py build first.

I think the problem is in the getopts logic in src/bootstrap/flags.rs. That's where I have gotten to debugging the program, anyway. I have never used the getopts module, so I paused to create this issue before diving into the docs.

I'll continue on and see if I can debug it and produce a patch, but I would be delighted if someone beat me to it. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler 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