]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #85590 - jam1garner:tool-bootstrap-su-fix, r=Mark-Simulacrum
authorYuki Okushi <jtitor@2k36.org>
Wed, 26 May 2021 04:30:59 +0000 (13:30 +0900)
committerGitHub <noreply@github.com>
Wed, 26 May 2021 04:30:59 +0000 (13:30 +0900)
commitd75521a36e4ead5addfa26fafe4e587bf9e80d2c
tree5493a9aa5b2a0057d736110ec6042e2cd84c20f1
parentae6a1a7043ce68e75cbc740dcdca792057df1555
parent903e369c831d52726a5292f847e384622189d9a0
Rollup merge of #85590 - jam1garner:tool-bootstrap-su-fix, r=Mark-Simulacrum

Fix bootstrap using host exe suffix for cargo

When attempting to cross compile rustc (for example, from Linux to Windows) and tell it to build cargo/tools, the following error occurs:

```
thread 'main' panicked at 'src.symlink_metadata() failed with No such file or directory (os error 2)', src/bootstrap/lib.rs:1196:24
```

Relevant part of stack trace:
<details>

```
   2: bootstrap::Build::copy
             at ./src/bootstrap/lib.rs:1196:24
   3: <bootstrap::tool::ToolBuild as bootstrap::builder::Step>::run
             at ./src/bootstrap/tool.rs:220:13
```
</details>

If I add `-vvv` (which seemed to be the recommended course for debugging a similar issue according to [zulip logs](https://zulip-archive.rust-lang.org/182449tcompilerhelp/19655failedtobootstrap.html)), it shows:

```
Copy ".../rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-pc-windows-gnu/release/cargo" to ".../rust/build/x86_64-unknown-linux-gnu/stage2-tools-bin/cargo"
```
and when taking a look at the contents of `build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-pc-windows-gnu/release` it contains `cargo.exe`, but no `cargo`.

I tried to study the surrounding code to make sure this was the intended behavior and while I can't be 100% certain, it does seem that using the exe suffix for the `compiler.host` target instead of the `target` target won't have the desired behavior when cross-compiling to/from Windows.