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

Added Rust 1.62.0 #1427

Merged
merged 5 commits into from
Jul 4, 2022
Merged

Added Rust 1.62.0 #1427

merged 5 commits into from
Jul 4, 2022

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre
Copy link
Collaborator Author

UebelAndre commented Jul 1, 2022

This is blocked by the following error on windows: https://buildkite.com/bazel/rules-rust-rustlang/builds/6678#0181b81d-22e9-42be-92fe-ec6401ed53a2

Input from anyone with any windows experience would be welcomed 🙏

(04:57:41) ERROR: C:/b/bk-windows-1z0z/bazel/rules-rust-rustlang/test/unit/rustdoc/BUILD.bazel:3:19: Compiling Rust bin bin_with_transitive_proc_macro (1 files) failed: (Exit 1): process_wrapper.exe failed: error executing command
  cd /d C:/b/yts5t5gu/execroot/rules_rust
  SET CARGO_CFG_TARGET_ARCH=x86_64
    SET CARGO_CFG_TARGET_OS=windows
    SET CARGO_CRATE_NAME=bin_with_transitive_proc_macro
    SET CARGO_MANIFEST_DIR=${pwd}/test/unit/rustdoc
    SET CARGO_PKG_AUTHORS=
    SET CARGO_PKG_DESCRIPTION=
    SET CARGO_PKG_HOMEPAGE=
    SET CARGO_PKG_NAME=bin_with_transitive_proc_macro
    SET CARGO_PKG_VERSION=0.0.0
    SET CARGO_PKG_VERSION_MAJOR=0
    SET CARGO_PKG_VERSION_MINOR=0
    SET CARGO_PKG_VERSION_PATCH=0
    SET CARGO_PKG_VERSION_PRE=
    SET LIB=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64;
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Roslyn;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\\MSBuild\15.0\bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
    SET RUNFILES_MANIFEST_ONLY=1
    SET SYSROOT=bazel-out/x64_windows-fastbuild/bin/external/rust_windows_x86_64/toolchain_for_x86_64-pc-windows-msvc_impl
    SET TEMP=C:\temp
    SET TMP=C:\temp
  bazel-out\x64_windows-opt-exec-2B5CBBC6\bin\util\process_wrapper\process_wrapper.exe --subst pwd=${pwd} -- bazel-out/x64_windows-fastbuild/bin/external/rust_windows_x86_64/toolchain_for_x86_64-pc-windows-msvc_impl/bin/rustc.exe test/unit/rustdoc/rustdoc_bin.rs --crate-name=bin_with_transitive_proc_macro --crate-type=bin --error-format=human --out-dir=bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc --codegen=opt-level=0 --codegen=debuginfo=0 --remap-path-prefix=${pwd}=. --emit=dep-info,link --color=always --target=x86_64-pc-windows-msvc --cfg feature="with_proc_macro" -L bazel-out/x64_windows-fastbuild/bin/external/rust_windows_x86_64/toolchain_for_x86_64-pc-windows-msvc_impl/lib/rustlib/x86_64-pc-windows-msvc/lib --edition=2018 --codegen=linker=C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/link.exe --codegen link-args=/nologo /SUBSYSTEM:CONSOLE advapi32.lib ws2_32.lib userenv.lib Bcrypt.lib /MACHINE:X64 /DEFAULTLIB:msvcrt.lib /DEBUG:FASTLINK /INCREMENTAL:NO --extern=lib_with_proc_macro=bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc/liblib_with_proc_macro-78138021.rlib --extern=rustdoc_proc_macro=bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/test/unit/rustdoc/rustdoc_proc_macro-2600278351.dll -Ldependency=bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/test/unit/rustdoc -Ldependency=bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc
# Configuration: 5d6eebaaa0c6cca8d5f86110c67943a0ce709adb6662fab8c10a837f68797d33
# Execution platform: @local_config_platform//:host
error: linking with `C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/link.exe` failed: exit code: 1120
  |
  = note: "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/link.exe" "/NOLOGO" "C:\\temp\\rustcEgLni4\\symbols.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.0.rcgu.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.1.rcgu.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.2.rcgu.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.3.rcgu.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.4.rcgu.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.5.rcgu.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.6.rcgu.o" "bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.257sxo9e6of9nshp.rcgu.o" "/LIBPATH:bazel-out/x64_windows-fastbuild/bin/external/rust_windows_x86_64/toolchain_for_x86_64-pc-windows-msvc_impl/lib/rustlib/x86_64-pc-windows-msvc/lib" "/LIBPATH:bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/test/unit/rustdoc" "/LIBPATH:bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc" "/LIBPATH:C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-1cd530251ef8500f.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-8749f5778873ad0b.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-952a244e6b15fd3d.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-d590b5e29f586f0c.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-157899a56f45c8e0.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libminiz_oxide-7b45cc2f3e360e16.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libadler-20c8aee5cf2ca628.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-601e4def09298a16.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-6bfe55bee864f405.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-2dcf1993985aac9f.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-df8a6f52e5519032.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-170085950b44d410.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-4f71a076c7db927f.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-d75ffa8a17ba1137.rlib" "C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-6f60f6a23a58b163.rlib" "advapi32.lib" "userenv.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\\bin_with_transitive_proc_macro.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\b\\yts5t5gu\\external\\rust_windows_x86_64\\lib\\rustlib\\etc\\libstd.natvis" "/nologo" "/SUBSYSTEM:CONSOLE" "advapi32.lib" "ws2_32.lib" "userenv.lib" "Bcrypt.lib" "/MACHINE:X64" "/DEFAULTLIB:msvcrt.lib" "/DEBUG:FASTLINK" "/INCREMENTAL:NO"
  = note: bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.3.rcgu.o : error LNK2019: unresolved external symbol _ZN4test16test_main_static17h3f2f4fbff47df3a8E referenced in function _ZN30bin_with_transitive_proc_macro4main17h28726504dc060f8dE
          bazel-out/x64_windows-fastbuild/bin/test/unit/rustdoc\bin_with_transitive_proc_macro.exe : fatal error LNK1120: 1 unresolved externals
 
error: aborting due to previous error

@UebelAndre UebelAndre force-pushed the rustup branch 2 times, most recently from 7c22a98 to 5c18ea4 Compare July 1, 2022 15:47
@UebelAndre
Copy link
Collaborator Author

#1427 (comment) appeared to be a flaky failure on windows 😞

@UebelAndre UebelAndre enabled auto-merge (squash) July 1, 2022 15:51
@UebelAndre UebelAndre disabled auto-merge July 1, 2022 15:51
@UebelAndre
Copy link
Collaborator Author

@illicitonion friendly ping 😅

@scentini
Copy link
Collaborator

scentini commented Jul 4, 2022

I just spent the better part of my day hunting that flake, tl;dr I believe the issue comes from rust_doc_test overwriting the outputs of the underlying crate. I managed to consistently reproduce the failure with

bazel \
  --windows_enable_symlinks --output_user_root=C:/b \
build \
  --enable_runfiles \
//test/unit/rustdoc:bin_with_transitive_proc_macro_doctest  \
//test/unit/rustdoc:bin_with_transitive_proc_macro_test

Will send a PR tomorrow.

@scentini scentini self-requested a review July 4, 2022 18:12
@UebelAndre UebelAndre merged commit bde2c36 into bazelbuild:main Jul 4, 2022
@UebelAndre UebelAndre deleted the rustup branch July 4, 2022 18:13
scentini added a commit that referenced this pull request Jul 7, 2022
This is supposed to fix the long standing Windows flakiness as described in #1427 (comment)

Initially I thought it's an issue with `rustdoc_test`, however the actual issue is that `rust_binary` and its `rust_test` have the same crate name and generate the same intermediary `.o` files. For sandboxed builds this is not an issue, as the actions are isolated, however, we have a race condition in non-sandboxed builds (Windows):

Let's consider the following build:
```
bazel build --spawn_strategy=standalone \
    //test/unit/rustdoc:bin_with_transitive_proc_macro \
    //test/unit/rustdoc:bin_with_transitive_proc_macro_test
```

The `bin_with_transitive_proc_macro` compile action will create the following intermediate file: `bazel-out/k8-fastbuild/bin/test/unit/rustdoc/bin_with_transitive_proc_macro.bin_with_transitive_proc_macro.573369dc-cgu.2.rcgu.o`, as will the `bin_with_transitive_proc_macro_test` action. These two files differ slightly (as the second action is for a test), namely the `bin_with_transitive_proc_macro` output has the following symbols:

```
0000000000000000 T main
0000000000000000 t _ZN30bin_with_transitive_proc_macro4main17hfc292cc42314e131E
                 U _ZN3std2rt10lang_start17h1dbc829c47cd61d9E
```

while the `bin_with_transitive_proc_macro_test` `.o` output looks like this:
```
0000000000000000 T main
0000000000000000 t _ZN30bin_with_transitive_proc_macro4main17h28726504dc060f8dE
                 U _ZN3std2rt10lang_start17h1dbc829c47cd61d9E
                 U _ZN4test16test_main_static17h37e3d88407f5b40fE
```

Now, when the two actions run in parallel, it can happen that `bin_with_transitive_proc_macro` creates the output, and `bin_with_transitive_proc_macro_test` overwrites it. Then, at linking time for `bin_with_transitive_proc_macro`, `rustc` will complain:
```
note: ld.lld: error: undefined symbol: test::test_main_static::h37e3d88407f5b40f
```
This is because `bin_with_transitive_proc_macro` is not a test and as such is not linked against `libtest`.

This PR fixes the issue by directing the compilation outputs of `rust_test` to be under a `test-{hash}` directory.
github-merge-queue bot pushed a commit that referenced this pull request Aug 22, 2024
…lying lib (#2803)

This PR also makes `rust_test` put its compilation outputs in the same
directory as the `rust_library` rule (i.e. not in a `test-{hash}`
subdirectory anymore).

After this change both the `rust_library` and `rust_test` rules will put
all its compilation outputs in the same directory, but there won't be
any name collisions in non-sandboxed environments (see
#1427 for more context).

This is a partial rollback of
1018533
and
26344d4.
felipeamp added a commit to felipeamp/rules_rust that referenced this pull request Sep 2, 2024
underlying lib

This is a rollforward of
bazelbuild#2803, but behind a feature
flag.

This PR also makes `rust_test` put its compilation outputs in the same
directory as the `rust_library` rule (i.e. not in a `test-{hash}`
subdirectory anymore).

After this change both the `rust_library` and `rust_test` rules will put
all its compilation outputs in the same directory, but there won't be
any name collisions in non-sandboxed environments (see
bazelbuild#1427 for more context).

Issue: bazelbuild#2827
felipeamp added a commit to felipeamp/rules_rust that referenced this pull request Sep 2, 2024
underlying lib

This is a rollforward of
bazelbuild#2803, but behind a feature
flag.

This PR also makes `rust_test` put its compilation outputs in the same
directory as the `rust_library` rule (i.e. not in a `test-{hash}`
subdirectory anymore).

After this change both the `rust_library` and `rust_test` rules will put
all its compilation outputs in the same directory, but there won't be
any name collisions in non-sandboxed environments (see
bazelbuild#1427 for more context).

Issue: bazelbuild#2827
felipeamp added a commit to felipeamp/rules_rust that referenced this pull request Sep 2, 2024
underlying lib

This is a rollforward of
bazelbuild#2803, but behind a feature
flag.

This PR also makes `rust_test` put its compilation outputs in the same
directory as the `rust_library` rule (i.e. not in a `test-{hash}`
subdirectory anymore).

After this change both the `rust_library` and `rust_test` rules will put
all its compilation outputs in the same directory, but there won't be
any name collisions in non-sandboxed environments (see
bazelbuild#1427 for more context).

Issue: bazelbuild#2827
github-merge-queue bot pushed a commit that referenced this pull request Sep 12, 2024
…lying lib (#2828)

This is a rollforward of
#2803, but behind the
`incompatible_change_rust_test_compilation_output_directory`
incompatible flag.

This PR also makes `rust_test` put its compilation outputs in the same
directory as the `rust_library` rule (i.e. not in a `test-{hash}`
subdirectory anymore).

After this change both the `rust_library` and `rust_test` rules will put
all its compilation outputs in the same directory, but there won't be
any name collisions in non-sandboxed environments (see
#1427 for more context).

Issue with context: #2827
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants