Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent using the default cc when that'd result in a broken build #111351

Closed
wants to merge 5 commits into from

Conversation

pietroalbini
Copy link
Member

@pietroalbini pietroalbini commented May 8, 2023

This PR adds a check in bootstrap to prevent issues like #111142 to happen. What happened there is, no compiler for aarch64-unknown-none was detected by bootstrap, and so the cc crate defaulted to the system host C compiler. That resulted in a broken target, as libcompiler_builtins.rlib (or well anything compiling C code in its build script) contained half the object files compiled for aarch64 and half of them compiled for x86_64.

The check added in the PR ensures that, for cross-compilation, the detected C compiler is not the same one as the host compiler, unless the detected compiler is clang (as it supports all targets from a single binary). This should not cause too many false positives, as for example a ./x build library --target i686-unknown-linux-gnu still works from a x86_64 host. If a false positive occurs, the error message still explains the workaround.

Example error message:

  running: "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S"
  cargo:warning=
  cargo:warning=   Error: the automatic detection of the C compiler for cross-compiled
  cargo:warning=   target aarch64-unknown-none returned the compiler also used for the
  cargo:warning=   current host platform.
  cargo:warning=
  cargo:warning=   This is likely wrong, and will likely result in a broken compilation
  cargo:warning=   artifact. Please specify the correct compiler for that target, either
  cargo:warning=   with environment variables:
  cargo:warning=
  cargo:warning=       CC_aarch64_unknown_none=path/to/cc
  cargo:warning=       CXX_aarch64_unknown_none=path/to/cxx
  cargo:warning=
  cargo:warning=   ...or in config.toml:
  cargo:warning=
  cargo:warning=       [target."aarch64-unknown-none"]
  cargo:warning=       cc = "path/to/cc"
  cargo:warning=       cxx = "path/to/cxx"
  cargo:warning=
  cargo:warning=   The detected C compiler was:
  cargo:warning=
  cargo:warning=       cc
  cargo:warning=
  exit status: 1

  --- stderr


  error occurred: Command "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S" with args "broken-cc" did not execute successfully (status code exit status: 1).


Build completed unsuccessfully in 0:00:02

Fixes #111142
r? @jyn514

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 8, 2023
@pietroalbini pietroalbini marked this pull request as ready for review May 8, 2023 12:24
@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented May 26, 2023

FYI I am not planning to review this currently since the CI failure seems to show it's not really workable. Unfortunately I don't have suggestions for improving it ... maybe thomcc has suggestions since he maintains cc, but tbh I think the real problem here is that cc generates broken code instead of giving an error.

@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 26, 2023
@pietroalbini
Copy link
Member Author

@jyn514 I think the CI problem above will need to be fixed regardless of whether we implement the error in bootstrap (like this PR does) or in cc (like you suggest). If the cc crate were to error out when it cannot find a suitable compiler, it would also error out on our CI like it's happening right now.

The error is that we're trying to compile 32bit mingw on that builder without the appropriate compiler. I'll fix it in the coming days, but I still think the PR can be reviewed (apart from the CI changes needed to inject the correct compilers).

@jyn514
Copy link
Member

jyn514 commented May 26, 2023

r? @Mark-Simulacrum

@rustbot rustbot assigned Mark-Simulacrum and unassigned jyn514 May 26, 2023
@jyn514 jyn514 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 26, 2023
@Mark-Simulacrum
Copy link
Member

I think CI is still failing (not sure if that was intended to be fixed?). My sense is that this will make it harder to do "trivial" cross-testing for cases where you don't actually need a C compiler, because you're not planning on using it. We have an escape hatch (or did?) in the form of an env-variable override ("BOOTSTRAP_SKIP_TARGET_SANITY"), added in #103569... but forcing people to use something like that doesn't feel great.

I think at minimum we should move this new check into the same code that's trying to confirm that we have C/C++ compilers in sanity.rs. That would probably fix CI without any other changes needed, and be a good enough starting point that I feel OK merging this. But if we see issues I'd be inclined to back this out or move it to a warning rather than hard error.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2023
@bors
Copy link
Contributor

bors commented Jun 14, 2023

☔ The latest upstream changes (presumably #112418) made this pull request unmergeable. Please resolve the merge conflicts.

@pietroalbini
Copy link
Member Author

Rewrote the patch to take in account Mark's feedback and the discussion on Zulip.

To only show the error message when a C compiler is actually used, there is now a broken-cc binary responsible for showing the error message to the user, and when a broken C compiler is detected the path to the C compiler for that target is replaced with broken-cc. This means the error message is only shown when the compiler is invoked.

Before merging: I tested this on Linux, and it should also work for macOS. We need to test whether this behaves correctly on Windows though, and I don't have a Windows machine at hand. Right now the condition has !compiler.is_like_clang(), as clang has a single binary for all targets, but I don't know how the linker behaves on Windows and whether we should change that condition to compiler.is_like_gnu().

@pietroalbini
Copy link
Member Author

r? @onur-ozkan

@onur-ozkan onur-ozkan added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 27, 2023
Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging: I tested this on Linux, and it should also work for macOS. We need to test whether this behaves correctly on Windows though, and I don't have a Windows machine at hand. Right now the condition has !compiler.is_like_clang(), as clang has a single binary for all targets, but I don't know how the linker behaves on Windows and whether we should change that condition to compiler.is_like_gnu().

I don't have Windows environment to check this.

iirc you do have Windows environment, if so, can you check this ? @albertlarsan68

r=me with the Windows compatibility check

@miguelraz
Copy link
Contributor

miguelraz commented Nov 9, 2023

Checked out this branch locally and can confirm that running

./x.py build --stage 1 library --target i686-pc-windows-msvc

works on recent Windows on a 64bit 12 x AMD Ryzen 5 PRO 4650 and with the appropriate Visual Studio Developer tools installed.

@onur-ozkan
Copy link
Member

@bors r+ rollup=iffy

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 14, 2023
…r-ozkan

Prevent using the default `cc` when that'd result in a broken build

This PR adds a check in bootstrap to prevent issues like rust-lang#111142 to happen. What happened there is, no compiler for `aarch64-unknown-none` was detected by bootstrap, and so the `cc` crate defaulted to the system host C compiler. That resulted in a broken target, as `libcompiler_builtins.rlib` (or well anything compiling C code in its build script) contained half the object files compiled for aarch64 and half of them compiled for x86_64.

The check added in the PR ensures that, for cross-compilation, the detected C compiler is not the same one as the host compiler, unless the detected compiler is clang (as it supports all targets from a single binary). This should not cause too many false positives, as for example a `./x build library --target i686-unknown-linux-gnu` still works from a x86_64 host. If a false positive occurs, the error message still explains the workaround.

Example error message:

```
  running: "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S"
  cargo:warning=
  cargo:warning=   Error: the automatic detection of the C compiler for cross-compiled
  cargo:warning=   target aarch64-unknown-none returned the compiler also used for the
  cargo:warning=   current host platform.
  cargo:warning=
  cargo:warning=   This is likely wrong, and will likely result in a broken compilation
  cargo:warning=   artifact. Please specify the correct compiler for that target, either
  cargo:warning=   with environment variables:
  cargo:warning=
  cargo:warning=       CC_aarch64_unknown_none=path/to/cc
  cargo:warning=       CXX_aarch64_unknown_none=path/to/cxx
  cargo:warning=
  cargo:warning=   ...or in config.toml:
  cargo:warning=
  cargo:warning=       [target."aarch64-unknown-none"]
  cargo:warning=       cc = "path/to/cc"
  cargo:warning=       cxx = "path/to/cxx"
  cargo:warning=
  cargo:warning=   The detected C compiler was:
  cargo:warning=
  cargo:warning=       cc
  cargo:warning=
  exit status: 1

  --- stderr

  error occurred: Command "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S" with args "broken-cc" did not execute successfully (status code exit status: 1).

Build completed unsuccessfully in 0:00:02
```

Fixes rust-lang#111142
r? `@jyn514`
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 14, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 14, 2023
@pietroalbini
Copy link
Member Author

Seems like I gated things to run only on nvptx, rather than everywhere but nvptx 😅

@bors r=onur-ozkan rollup=never

@bors
Copy link
Contributor

bors commented Nov 15, 2023

📌 Commit bda0331 has been approved by onur-ozkan

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 15, 2023
@bors
Copy link
Contributor

bors commented Nov 15, 2023

⌛ Testing commit bda0331 with merge f8568c2...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 15, 2023
…r-ozkan

Prevent using the default `cc` when that'd result in a broken build

This PR adds a check in bootstrap to prevent issues like rust-lang#111142 to happen. What happened there is, no compiler for `aarch64-unknown-none` was detected by bootstrap, and so the `cc` crate defaulted to the system host C compiler. That resulted in a broken target, as `libcompiler_builtins.rlib` (or well anything compiling C code in its build script) contained half the object files compiled for aarch64 and half of them compiled for x86_64.

The check added in the PR ensures that, for cross-compilation, the detected C compiler is not the same one as the host compiler, unless the detected compiler is clang (as it supports all targets from a single binary). This should not cause too many false positives, as for example a `./x build library --target i686-unknown-linux-gnu` still works from a x86_64 host. If a false positive occurs, the error message still explains the workaround.

Example error message:

```
  running: "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S"
  cargo:warning=
  cargo:warning=   Error: the automatic detection of the C compiler for cross-compiled
  cargo:warning=   target aarch64-unknown-none returned the compiler also used for the
  cargo:warning=   current host platform.
  cargo:warning=
  cargo:warning=   This is likely wrong, and will likely result in a broken compilation
  cargo:warning=   artifact. Please specify the correct compiler for that target, either
  cargo:warning=   with environment variables:
  cargo:warning=
  cargo:warning=       CC_aarch64_unknown_none=path/to/cc
  cargo:warning=       CXX_aarch64_unknown_none=path/to/cxx
  cargo:warning=
  cargo:warning=   ...or in config.toml:
  cargo:warning=
  cargo:warning=       [target."aarch64-unknown-none"]
  cargo:warning=       cc = "path/to/cc"
  cargo:warning=       cxx = "path/to/cxx"
  cargo:warning=
  cargo:warning=   The detected C compiler was:
  cargo:warning=
  cargo:warning=       cc
  cargo:warning=
  exit status: 1

  --- stderr

  error occurred: Command "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S" with args "broken-cc" did not execute successfully (status code exit status: 1).

Build completed unsuccessfully in 0:00:02
```

Fixes rust-lang#111142
r? `@jyn514`
@bors
Copy link
Contributor

bors commented Nov 15, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 15, 2023
@rust-log-analyzer
Copy link
Collaborator

The job test-various failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 ---> d4f5fc006126
Step 15/23 : ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_TARGETS   tests/run-make   tests/ui   tests/mir-opt   tests/codegen-units   tests/codegen   tests/assembly   library/core
 ---> Using cache
 ---> 48e58432a869
Step 16/23 : ENV NVPTX_TARGETS=nvptx64-nvidia-cuda     CC_nvptx64_nvidia_cuda=clang-11     CXX_nvptx64_nvidia_cuda=clang++-11     CFLAGS_nvptx64_nvidia_cuda=-flto     CXXFLAGS_nvptx64_nvidia_cuda=-flto
 ---> 903fc9f97919
Step 17/23 : ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS   tests/run-make   tests/assembly
 ---> Using cache
 ---> 084df85bf4b4
---
[TIMING] core::build_steps::compile::StdLink { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target_compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu, crates: [], force_recompile: false } -- 0.000
[TIMING] core::build_steps::compile::Std { target: x86_64-unknown-linux-gnu, compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu }, crates: [], force_recompile: false, extra_rust_args: [] } -- 0.000
[TIMING] core::build_steps::test::TestHelpers { target: x86_64-unknown-linux-gnu } -- 0.000
##[group]Building test helpers for nvptx64-nvidia-cuda
running: "clang-11" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=nvptx64-nvidia-cuda" "-flto" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=nvptx64-nvidia-cuda" "-flto" "-o" "/checkout/obj/build/nvptx64-nvidia-cuda/native/rust-test-helpers/rust_test_helpers.o" "-c" "/checkout/tests/auxiliary/rust_test_helpers.c"
cargo:warning=In file included from /checkout/tests/auxiliary/rust_test_helpers.c:3:
cargo:warning=In file included from /usr/lib/llvm-11/lib/clang/11.1.0/include/stdint.h:52:
cargo:warning=/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
cargo:warning=#include <bits/libc-header-start.h>
cargo:warning=         ^~~~~~~~~~~~~~~~~~~~~~~~~~


exit status: 1
exit status: 1
error occurred: Command "clang-11" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=nvptx64-nvidia-cuda" "-flto" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=nvptx64-nvidia-cuda" "-flto" "-o" "/checkout/obj/build/nvptx64-nvidia-cuda/native/rust-test-helpers/rust_test_helpers.o" "-c" "/checkout/tests/auxiliary/rust_test_helpers.c" with args "clang-11" did not execute successfully (status code exit status: 1).

Build completed unsuccessfully in 0:00:18
  local time: Wed Nov 15 10:56:53 UTC 2023
  network time: Wed, 15 Nov 2023 10:56:53 GMT

@bors
Copy link
Contributor

bors commented Dec 8, 2023

⌛ Testing commit bda0331 with merge 054a0a8...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2023
…r-ozkan

Prevent using the default `cc` when that'd result in a broken build

This PR adds a check in bootstrap to prevent issues like rust-lang#111142 to happen. What happened there is, no compiler for `aarch64-unknown-none` was detected by bootstrap, and so the `cc` crate defaulted to the system host C compiler. That resulted in a broken target, as `libcompiler_builtins.rlib` (or well anything compiling C code in its build script) contained half the object files compiled for aarch64 and half of them compiled for x86_64.

The check added in the PR ensures that, for cross-compilation, the detected C compiler is not the same one as the host compiler, unless the detected compiler is clang (as it supports all targets from a single binary). This should not cause too many false positives, as for example a `./x build library --target i686-unknown-linux-gnu` still works from a x86_64 host. If a false positive occurs, the error message still explains the workaround.

Example error message:

```
  running: "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S"
  cargo:warning=
  cargo:warning=   Error: the automatic detection of the C compiler for cross-compiled
  cargo:warning=   target aarch64-unknown-none returned the compiler also used for the
  cargo:warning=   current host platform.
  cargo:warning=
  cargo:warning=   This is likely wrong, and will likely result in a broken compilation
  cargo:warning=   artifact. Please specify the correct compiler for that target, either
  cargo:warning=   with environment variables:
  cargo:warning=
  cargo:warning=       CC_aarch64_unknown_none=path/to/cc
  cargo:warning=       CXX_aarch64_unknown_none=path/to/cxx
  cargo:warning=
  cargo:warning=   ...or in config.toml:
  cargo:warning=
  cargo:warning=       [target."aarch64-unknown-none"]
  cargo:warning=       cc = "path/to/cc"
  cargo:warning=       cxx = "path/to/cxx"
  cargo:warning=
  cargo:warning=   The detected C compiler was:
  cargo:warning=
  cargo:warning=       cc
  cargo:warning=
  exit status: 1

  --- stderr

  error occurred: Command "/home/pietro/r/github/rust-lang/rust/2/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "--broken-cc-target=aarch64-unknown-none" "--broken-cc-detected=cc" "-I" "/home/pietro/r/github/rust-lang/rust/2/src/llvm-project/compiler-rt/lib/builtins" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/ea072bc2688e9ac2-lse_cas1_relax.o" "-c" "/home/pietro/r/github/rust-lang/rust/2/build/x86_64-unknown-linux-gnu/stage0-std/aarch64-unknown-none/release/build/compiler_builtins-13da5a491a5cb882/out/lse_cas1_relax.S" with args "broken-cc" did not execute successfully (status code exit status: 1).

Build completed unsuccessfully in 0:00:02
```

Fixes rust-lang#111142
r? `@jyn514`
@rust-log-analyzer
Copy link
Collaborator

The job dist-various-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.132
   Compiling libc v0.2.150
The following warnings were emitted during compilation:

warning: [email protected]: sccache: error: failed to execute compile
warning: [email protected]: sccache: caused by: Compiler not supported: "thread \'main\' panicked at src/bin/broken-cc.rs:19:35:\nbroken-cc not invoked by bootstrap correctly\nstack backtrace:\n   0: rust_begin_unwind\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/std/src/panicking.rs:645:5\n   1: core::panicking::panic_fmt\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/panicking.rs:72:14\n   2: core::panicking::panic_display\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/panicking.rs:178:5\n   3: core::panicking::panic_str\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/panicking.rs:152:5\n   4: core::option::expect_failed\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/option.rs:1985:5\n   5: core::option::Option<T>::expect\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/option.rs:894:21\n   6: broken_cc::main\n             at ./checkout/src/bootstrap/src/bin/broken-cc.rs:19:23\n   7: core::ops::function::FnOnce::call_once\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/ops/function.rs:250:5\nnote: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"
error: failed to run custom build command for `compiler_builtins v0.1.103`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/build/compiler_builtins-ececb303a62a2782/build-script-build` (exit status: 1)
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/build/compiler_builtins-ececb303a62a2782/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:compiler-rt=/cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.103/compiler-rt
  cargo:rustc-cfg=feature="unstable"
  cargo:rustc-cfg=feature="mem-unaligned"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c
  cargo:rustc-cfg=__absvdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/absvsi2.c
  cargo:rustc-cfg=__absvsi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/absvti2.c
  cargo:rustc-cfg=__absvti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/addvdi3.c
  cargo:rustc-cfg=__addvdi3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/addvsi3.c
  cargo:rustc-cfg=__addvsi3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/addvti3.c
  cargo:rustc-cfg=__addvti3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/clzdi2.c
  cargo:rustc-cfg=__clzdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/clzsi2.c
  cargo:rustc-cfg=__clzsi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/clzti2.c
  cargo:rustc-cfg=__clzti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/cmpdi2.c
  cargo:rustc-cfg=__cmpdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/cmpti2.c
  cargo:rustc-cfg=__cmpti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/ctzdi2.c
  cargo:rustc-cfg=__ctzdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/ctzsi2.c
  cargo:rustc-cfg=__ctzsi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/ctzti2.c
  cargo:rustc-cfg=__ctzti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/divdc3.c
  cargo:rustc-cfg=__divdc3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/divsc3.c
  cargo:rustc-cfg=__divsc3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/divxc3.c
  cargo:rustc-cfg=__divxc3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/extendhfsf2.c
  cargo:rustc-cfg=__extendhfsf2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/ffsti2.c
  cargo:rustc-cfg=__ffsti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/x86_64/floatdixf.c
  cargo:rustc-cfg=__floatdixf="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/x86_64/floatundixf.S
  cargo:rustc-cfg=__floatundixf="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/int_util.c
  cargo:rustc-cfg=__int_util="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/muldc3.c
  cargo:rustc-cfg=__muldc3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/mulsc3.c
  cargo:rustc-cfg=__mulsc3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/mulvdi3.c
  cargo:rustc-cfg=__mulvdi3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/mulvsi3.c
  cargo:rustc-cfg=__mulvsi3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/mulvti3.c
  cargo:rustc-cfg=__mulvti3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/mulxc3.c
  cargo:rustc-cfg=__mulxc3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/negdf2.c
  cargo:rustc-cfg=__negdf2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/negdi2.c
  cargo:rustc-cfg=__negdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/negsf2.c
  cargo:rustc-cfg=__negsf2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/negti2.c
  cargo:rustc-cfg=__negti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/negvdi2.c
  cargo:rustc-cfg=__negvdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/negvsi2.c
  cargo:rustc-cfg=__negvsi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/negvti2.c
  cargo:rustc-cfg=__negvti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/paritydi2.c
  cargo:rustc-cfg=__paritydi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/paritysi2.c
  cargo:rustc-cfg=__paritysi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/parityti2.c
  cargo:rustc-cfg=__parityti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/popcountdi2.c
  cargo:rustc-cfg=__popcountdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/popcountsi2.c
  cargo:rustc-cfg=__popcountsi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/popcountti2.c
  cargo:rustc-cfg=__popcountti2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/powixf2.c
  cargo:rustc-cfg=__powixf2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/subvdi3.c
  cargo:rustc-cfg=__subvdi3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/subvsi3.c
  cargo:rustc-cfg=__subvsi3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/subvti3.c
  cargo:rustc-cfg=__subvti3="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/truncdfhf2.c
  cargo:rustc-cfg=__truncdfhf2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/truncsfhf2.c
  cargo:rustc-cfg=__truncsfhf2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/ucmpdi2.c
  cargo:rustc-cfg=__ucmpdi2="optimized-c"
  cargo:rerun-if-changed=/checkout/src/llvm-project/compiler-rt/lib/builtins/ucmpti2.c
  cargo:rustc-cfg=__ucmpti2="optimized-c"
  TARGET = Some("x86_64-unknown-linux-gnux32")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnux32
  CC_x86_64-unknown-linux-gnux32 = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnux32
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnux32
  CC_x86_64_unknown_linux_gnux32 = Some("sccache /checkout/obj/build/bootstrap/debug/broken-cc")
  CFLAGS_x86_64-unknown-linux-gnux32 = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnux32
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnux32
  CFLAGS_x86_64_unknown_linux_gnux32 = Some("-ffunction-sections -fdata-sections -fPIC -mx32 --broken-cc-target=x86_64-unknown-linux-gnux32 --broken-cc-detected=gcc-9")
  CRATE_CC_NO_DEFAULTS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnux32
  CC_x86_64-unknown-linux-gnux32 = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnux32
  CC_x86_64_unknown_linux_gnux32 = Some("sccache /checkout/obj/build/bootstrap/debug/broken-cc")
  CFLAGS_x86_64-unknown-linux-gnux32 = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnux32
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnux32
  CFLAGS_x86_64_unknown_linux_gnux32 = Some("-ffunction-sections -fdata-sections -fPIC -mx32 --broken-cc-target=x86_64-unknown-linux-gnux32 --broken-cc-detected=gcc-9")
  CRATE_CC_NO_DEFAULTS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnux32
  CC_x86_64-unknown-linux-gnux32 = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnux32
  CC_x86_64_unknown_linux_gnux32 = Some("sccache /checkout/obj/build/bootstrap/debug/broken-cc")
  CFLAGS_x86_64-unknown-linux-gnux32 = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnux32
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnux32
  CFLAGS_x86_64_unknown_linux_gnux32 = Some("-ffunction-sections -fdata-sections -fPIC -mx32 --broken-cc-target=x86_64-unknown-linux-gnux32 --broken-cc-detected=gcc-9")
  CRATE_CC_NO_DEFAULTS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "sccache" "/checkout/obj/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-mx32" "-ffunction-sections" "-fdata-sections" "-fPIC" "-mx32" "--broken-cc-target=x86_64-unknown-linux-gnux32" "--broken-cc-detected=gcc-9" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnux32/release/build/compiler_builtins-115f055d36c69560/out/45c91108d938afe8-absvdi2.o" "-c" "/checkout/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c"
  cargo:warning=sccache: error: failed to execute compile
  cargo:warning=sccache: caused by: Compiler not supported: "thread \'main\' panicked at src/bin/broken-cc.rs:19:35:\nbroken-cc not invoked by bootstrap correctly\nstack backtrace:\n   0: rust_begin_unwind\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/std/src/panicking.rs:645:5\n   1: core::panicking::panic_fmt\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/panicking.rs:72:14\n   2: core::panicking::panic_display\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/panicking.rs:178:5\n   3: core::panicking::panic_str\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/panicking.rs:152:5\n   4: core::option::expect_failed\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/option.rs:1985:5\n   5: core::option::Option<T>::expect\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/option.rs:894:21\n   6: broken_cc::main\n             at ./checkout/src/bootstrap/src/bin/broken-cc.rs:19:23\n   7: core::ops::function::FnOnce::call_once\n             at ./rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/ops/function.rs:250:5\nnote: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"

  --- stderr



  error occurred: Command "sccache" "/checkout/obj/build/bootstrap/debug/broken-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-mx32" "-ffunction-sections" "-fdata-sections" "-fPIC" "-mx32" "--broken-cc-target=x86_64-unknown-linux-gnux32" "--broken-cc-detected=gcc-9" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnux32/release/build/compiler_builtins-115f055d36c69560/out/45c91108d938afe8-absvdi2.o" "-c" "/checkout/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c" with args "broken-cc" did not execute successfully (status code exit status: 2).

warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] core test:false 17.998
Build completed unsuccessfully in 0:21:34

@bors
Copy link
Contributor

bors commented Dec 8, 2023

💔 Test failed - checks-actions

@fmease
Copy link
Member

fmease commented Jan 24, 2024

(I had to synchronize the queue)
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2024
@Dylan-DPC
Copy link
Member

@pietroalbini any updates on this? thanks

@alex-semenyuk alex-semenyuk added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 12, 2024
@JohnCSimon
Copy link
Member

@pietroalbini
Ping from triage: I'm closing this due to inactivity because it hasn't seen any contributions in over a year.

Note: if you are going to continue please open the PR BEFORE you push to it, else you won't be able to reopen - this is a quirk of github.
Thanks

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this Nov 29, 2024
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid aarch64-unknown-none target produced if the CC_aarch64_unknown_none env var is not set