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

lint-docs fails its tests in a cross-compiling environment #129956

Closed
chenx97 opened this issue Sep 4, 2024 · 0 comments · Fixed by #129957
Closed

lint-docs fails its tests in a cross-compiling environment #129956

chenx97 opened this issue Sep 4, 2024 · 0 comments · Fixed by #129957
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@chenx97
Copy link
Contributor

chenx97 commented Sep 4, 2024

Description

Currently, lint-docs doesn't detect or use the linker option bootstrap has. This causes rustc to use the wrong linker when running lint-docs for a foreign target.

I tried this code:

cat > config.toml << 'EOF'
[llvm]
download-ci-llvm = true

[rust]
debug = false
debuginfo-level = 0
deny-warnings = false
parallel-compiler = false

[build]
target = ["aarch64-unknown-linux-gnu"]
host = ["aarch64-unknown-linux-gnu"]
extended = true
tools = ["cargo", "rustfmt", "rustdoc", "rust-analyzer-proc-macro-srv"]
EOF
./x.py test src/tools/lint-docs

I expected to see this happen:

the test should complete successfully

Instead, this happened:

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "cc" "/tmp/rustc7SdjrZ/symbols.o" "lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o" "lint_example.30n99m0wmvpbs2ttsaf6l8qgp.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-d03532c057d00a3f.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-3d0de4e3fa9bbd8a.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-62590d15ce0c75d4.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-e5b7cea9b3f74463.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-a96b2a6d932eeacd.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-37fe99ea887d359c.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-6aea647da60f5d56.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-066bd40bba4f0f1c.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-df0cacc3519fb3e8.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-eb9b6fda793a42e8.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-35465fa51f1203f9.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-deb47ddfa7d4c793.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-e2effffda4bc7106.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-c1eadd4c4bf236fc.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-1f258c784570b7d2.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-404257254a09efc3.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-66ec4246aee3d3e5.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-68ec090f3319860e.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-72679d50ff21414a.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "lint_example" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status
          


error: aborting due to 1 previous error

Meta

rustc commit:

d6c8169c186ab16a3404cd0d0866674018e8a19e
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 4, 2024
@jieyouxu jieyouxu added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Sep 4, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 4, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Sep 5, 2024
…bertlarsan68

forward linker option to lint-docs

This fixes an error found when building the doc for a cross-built toolchain.

```
warning: the code example in lint `unstable_syntax_pre_expansion` in /buildroots/chenx97/rustc-1.80.1-src/compiler/rustc_lint_defs/src/builtin.rs failed to generate the expected output: did not find lint `unstable_syntax_p
re_expansion` in output of example, got:

error: linking with `cc` failed: exit status: 1
...
```
Closes: rust-lang#129956
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Sep 5, 2024
…bertlarsan68

forward linker option to lint-docs

This fixes an error found when building the doc for a cross-built toolchain.

```
warning: the code example in lint `unstable_syntax_pre_expansion` in /buildroots/chenx97/rustc-1.80.1-src/compiler/rustc_lint_defs/src/builtin.rs failed to generate the expected output: did not find lint `unstable_syntax_p
re_expansion` in output of example, got:

error: linking with `cc` failed: exit status: 1
...
```
Closes: rust-lang#129956
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Sep 5, 2024
…bertlarsan68

forward linker option to lint-docs

This fixes an error found when building the doc for a cross-built toolchain.

```
warning: the code example in lint `unstable_syntax_pre_expansion` in /buildroots/chenx97/rustc-1.80.1-src/compiler/rustc_lint_defs/src/builtin.rs failed to generate the expected output: did not find lint `unstable_syntax_p
re_expansion` in output of example, got:

error: linking with `cc` failed: exit status: 1
...
```
Closes: rust-lang#129956
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Sep 6, 2024
…bertlarsan68

forward linker option to lint-docs

This fixes an error found when building the doc for a cross-built toolchain.

```
warning: the code example in lint `unstable_syntax_pre_expansion` in /buildroots/chenx97/rustc-1.80.1-src/compiler/rustc_lint_defs/src/builtin.rs failed to generate the expected output: did not find lint `unstable_syntax_p
re_expansion` in output of example, got:

error: linking with `cc` failed: exit status: 1
...
```
Closes: rust-lang#129956
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Sep 6, 2024
…bertlarsan68

forward linker option to lint-docs

This fixes an error found when building the doc for a cross-built toolchain.

```
warning: the code example in lint `unstable_syntax_pre_expansion` in /buildroots/chenx97/rustc-1.80.1-src/compiler/rustc_lint_defs/src/builtin.rs failed to generate the expected output: did not find lint `unstable_syntax_p
re_expansion` in output of example, got:

error: linking with `cc` failed: exit status: 1
...
```
Closes: rust-lang#129956
@bors bors closed this as completed in d34ad5d Sep 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 6, 2024
Rollup merge of rust-lang#129957 - chenx97:lint-docs-linker-opt, r=albertlarsan68

forward linker option to lint-docs

This fixes an error found when building the doc for a cross-built toolchain.

```
warning: the code example in lint `unstable_syntax_pre_expansion` in /buildroots/chenx97/rustc-1.80.1-src/compiler/rustc_lint_defs/src/builtin.rs failed to generate the expected output: did not find lint `unstable_syntax_p
re_expansion` in output of example, got:

error: linking with `cc` failed: exit status: 1
...
```
Closes: rust-lang#129956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants