Skip to content

x.py fails if .cargo/config configures build.target #155651

@CAD97

Description

@CAD97

Summary

When $CARGO_HOME/config.toml sets build.target, x fails to launch bootstrap.

Command used

./x.py setup

Expected behaviour

Setup would run as usual.

Actual behaviour

x.py tries and fails to launch {workspace-root}/build/bootstrap/debug/bootstrap. The bootstrap binary was actually generated at (in my case) {workspace-root}/build/bootstrap/{host-tuple}/debug/bootstrap.

Bootstrap configuration (bootstrap.toml)

n/a

Operating system

Ubuntu 25.10

HEAD

cf1817b

Additional context

My $CARGO_HOME/config.toml:

[build]
target = ["host-tuple"]
build-dir = "{cargo-cache-home}/build/{workspace-path-hash}"

[install]
root = "~/.local" # /bin implicit
Build Log

Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.06s
Traceback (most recent call last):
  File "/home/cad/src/rust-lang/rust/x.py", line 53, in <module>
    bootstrap.main()
    ~~~~~~~~~~~~~~^^
  File "/home/cad/src/rust-lang/rust/src/bootstrap/bootstrap.py", line 1425, in main
    bootstrap(args)
    ~~~~~~~~~^^^^^^
  File "/home/cad/src/rust-lang/rust/src/bootstrap/bootstrap.py", line 1383, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
    ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cad/src/rust-lang/rust/src/bootstrap/bootstrap.py", line 232, in run
    ret = subprocess.Popen(args, **kwargs)
  File "/usr/lib/python3.13/subprocess.py", line 1039, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        pass_fds, cwd, env,
                        ^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
                        gid, gids, uid, umask,
                        ^^^^^^^^^^^^^^^^^^^^^^
                        start_new_session, process_group)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/subprocess.py", line 1857, in _execute_child
    self._posix_spawn(args, executable, env, restore_signals, close_fds,
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      p2cread, p2cwrite,
                      ^^^^^^^^^^^^^^^^^^
                      c2pread, c2pwrite,
                      ^^^^^^^^^^^^^^^^^^
                      errread, errwrite)
                      ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/subprocess.py", line 1801, in _posix_spawn
    self.pid = os.posix_spawn(executable, args, env, **kwargs)
               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/cad/src/rust-lang/rust/build/bootstrap/debug/bootstrap'

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-cargoRelevant to the cargo team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions