rust-lang / rust-lang/rust

minor issue on src/bootstrap/bootstrap.py

Open
#154,349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

in bootstrap.py: 1101

   def bootstrap_binary(self):
        # this ONLY works if the compiler toolchain is not set. not sure
        # where this happens but this fixed it for me
        """Return the path of the bootstrap binary

        >>> rb = RustBuild()
        >>> rb.build_dir = "build"
        >>> rb.bootstrap_binary() == os.path.join("build", "bootstrap",
        ... "debug", "bootstrap")
        True
        """
        # print(self.build)
        # for some reason this isnt correct on my machine
        return os.path.join(self.bootstrap_out(), "debug", "bootstrap")

the above function does not work correctly as it does not take into account self.build, in rare cases, the script will have the build process place it in self.boostrap_out(), self.build_dir,"debug","bootstrap".
as I am not familiar with your build process I got past it by inserting the self.build_dir in the final line.

I am willing to contribute a fix if someone can fill me in on how the script currently works.

Summary
Command used

./configure --build x86_64-pc-windows-gnu
x.py setup

Expected behaviour

bootstrap to download, extract and build

Actual behaviour

toolchain downloaded and built boostrap successfully but the call to the boostrap executable failed
because the 'process' placed the artifacts in a different directory

Bootstrap configuration (bootstrap.toml)
# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
profile = 'dist'

[llvm]

[gcc]

[build]

# Build triple for the pre-compiled snapshot compiler. If `rustc` is set, this must match its host
# triple (see `rustc --version --verbose`; cross-compiling the rust build system itself is NOT
# supported). If `rustc` is unset, this must be a platform with pre-compiled host tools
# (https://doc.rust-lang.org/nightly/rustc/platform-support.html). The current platform must be
# able to run binaries of this build triple.
#
# If `rustc` is present in path, this defaults to the host it was compiled for.
# Otherwise, `x.py` will try to infer it from the output of `uname`.
# If `uname` is not found in PATH, we assume this is `x86_64-pc-windows-msvc`.
# This may be changed in the future.
build = 'x86_64-pc-windows-gnu'

# Arguments passed to the `./configure` script, used during distcheck. You
# probably won't fill this in but rather it's filled in by the `./configure`
# script. Useful for debugging.
configure-args = ['--build', 'x86_64-pc-windows-gnu']

[install]

[rust]

[dist]

[target.x86_64-pc-windows-gnu]
Operating system

build environment was msys2 on windows x86_64

HEAD

on commit index 9faa75e1848..f53259e91ee 100644
ca2139d3262232d6b15471783f503ffe125531f6

Additional context
Build Log

$ ./x.py setup Building bootstrap warning: unused config key `build.extended` in `C:\msys64\home\jthec\rust\.cargo\config.toml` warning: unused config key `build.tools` in `C:\msys64\home\jthec\rust\.cargo\config.toml` Finished `dev` profile [unoptimized] target(s) in 0.17s x86_64-pc-windows-gnu Traceback (most recent call last): File "C:/msys64/home/jthec/rust/x.py", line 53, in bootstrap.main() ~~~~~~~~~~~~~~^^ File "C:/msys64/home/jthec/rust/src/bootstrap/bootstrap.py", line 1417, in main bootstrap(args) ~~~~~~~~~^^^^^^ File "C:/msys64/home/jthec/rust/src/bootstrap/bootstrap.py", line 1374, in bootstrap run(args, env=env, verbose=build.verbose, is_bootstrap=True) ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:/msys64/home/jthec/rust/src/bootstrap/bootstrap.py", line 234, in run ret = subprocess.Popen(args, **kwargs) File "C:/msys64/mingw64/lib/python3.14/subprocess.py", line 1038, 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 "C:/msys64/mingw64/lib/python3.14/subprocess.py", line 1552, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ # no special security ^^^^^^^^^^^^^^^^^^^^^ ...<4 lines>... cwd, ^^^^ startupinfo) ^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified

<log>

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 in src/bootstrap/bootstrap.py around line 1101, focusing on RustBuild.bootstrap_binary and the bootstrap_out/build_dir paths. Reproduce the failure with ./configure --build x86_64-pc-windows-gnu followed by x.py setup in the reported MSYS2 environment. Done means the bootstrap executable is located and launched successfully when the build artifacts use the reported directory layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.