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

Build fails on windows #2728

Closed
danfabi opened this issue Jul 5, 2024 · 3 comments
Closed

Build fails on windows #2728

danfabi opened this issue Jul 5, 2024 · 3 comments

Comments

@danfabi
Copy link

danfabi commented Jul 5, 2024

Builds on Windows fail with the following message:

PS C:\Users\danfabi\test> C:\Users\danfabi\Downloads\bazelisk-windows-amd64.exe build --verbose_failures //...
Starting local Bazel server and connecting to it...
INFO: Analyzed target //wintest:wintest (114 packages loaded, 1165 targets configured).
ERROR: C:/users/danfabi/_bazel_danfabi/bhxa56sx/external/rules_rust~/util/process_wrapper/BUILD.bazel:31:36: Compiling Rust (without process_wrapper) bin process_wrapper (6 files) [for tool] failed: (Exit 1): process_wrapper.bat failed: error executing Rustc command (from target @@rules_rust~//util/process_wrapper:process_wrapper)
  cd /d C:/users/danfabi/_bazel_danfabi/bhxa56sx/execroot/_main
  SET CARGO_CFG_TARGET_ARCH=x86_64
    SET CARGO_CFG_TARGET_OS=windows
    SET CARGO_CRATE_NAME=process_wrapper
    SET CARGO_MANIFEST_DIR=${pwd}/external/rules_rust~/util/process_wrapper
    SET CARGO_PKG_AUTHORS=
    SET CARGO_PKG_DESCRIPTION=
    SET CARGO_PKG_HOMEPAGE=
    SET CARGO_PKG_NAME=process_wrapper
    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\2022\BuildTools\VC\Tools\MSVC\14.40.33807\lib\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\Extensions\Microsoft\CodeCoverage.Console;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\\x64;C:\Program Files (x86)\Windows Kits\10\bin\\x64;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\;;C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
    SET REPOSITORY_NAME=rules_rust~
    SET TEMP=C:\Users\danfabi\AppData\Local\Temp
    SET TMP=C:\Users\danfabi\AppData\Local\Temp
  bazel-out\x64_windows-opt-exec-ST-d57f47055a04\bin\external\rules_rust~\util\process_wrapper\process_wrapper.bat -- bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain/bin/rustc.exe external/rules_rust~/util/process_wrapper/main.rs --crate-name=process_wrapper --crate-type=bin --error-format=human --out-dir=bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper --codegen=opt-level=3 --codegen=debuginfo=0 --codegen=strip=debuginfo --remap-path-prefix=${pwd}= --emit=link=bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper/process_wrapper.exe --emit=dep-info --color=always --target=x86_64-pc-windows-msvc -L bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain/lib/rustlib/x86_64-pc-windows-msvc/lib --edition=2018 --codegen=linker=C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/link.exe --codegen=link-arg=/nologo --codegen=link-arg=/SUBSYSTEM:CONSOLE --codegen=link-arg=advapi32.lib --codegen=link-arg=ws2_32.lib --codegen=link-arg=userenv.lib --codegen=link-arg=Bcrypt.lib --codegen=link-arg=/MACHINE:X64 --codegen=link-arg=/DEFAULTLIB:msvcrt.lib --codegen=link-arg=/OPT:ICF --codegen=link-arg=/OPT:REF --extern=tinyjson=bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_tinyjson/libtinyjson-1980135637.rlib -Ldependency=bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_tinyjson --sysroot=bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain
# Configuration: 590d424db4209e05e2d7658e14528d117da1b173ee8fd32ea0aa1f0f9f68f037
# Execution platform: @@platforms//host:host
error: linking with `C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/link.exe` failed: exit code: 1181
  |
  = note: "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/link.exe" "/NOLOGO" "C:\\Users\\danfabi\\AppData\\Local\\Temp\\rustcpEmpM4\\symbols.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.00.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.01.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.02.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.03.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.04.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.05.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.06.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.07.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.08.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.09.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.10.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.11.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.12.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.13.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.14.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.process_wrapper.91892bd128cd3e3a-cgu.15.rcgu.o" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper\\process_wrapper.orb0p63oiqth2jz.rcgu.o" "/LIBPATH:bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain/lib/rustlib/x86_64-pc-windows-msvc/lib" "/LIBPATH:bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~i~rules_rust_tinyjson" "/LIBPATH:bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\danfabi\\_bazel_danfabi\\bhxa56sx\\execroot\\_main\\bazel-out\\x64_windows-opt-exec-ST-d57f47055a04\\bin\\external\\rules_rust~~i~rules_rust_tinyjson\\libtinyjson-1980135637.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-3f3d3458f17b6f6c.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-abeae64c6d03c880.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-3e121b6b11e11352.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-e2e5cc9326100cbd.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-69a32640c1d25dc0.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-f21c671d69976121.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-e2cf21c27cba2cec.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-bc730a99dc830cc7.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-9e9cd975a713105d.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-8dee4f8da48c4bc1.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-f028abb8ba1671f1.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-d1841cbd6e8b84a0.rlib" "bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-eb4525b43981c490.rlib" "kernel32.lib" "advapi32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "msvcrt.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/LIBPATH:bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools/rust_toolchain\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/external/rules_rust~/util/process_wrapper/process_wrapper.exe" "/OPT:REF,ICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/nologo" "/SUBSYSTEM:CONSOLE" "advapi32.lib" "ws2_32.lib" "userenv.lib" "Bcrypt.lib" "/MACHINE:X64" "/DEFAULTLIB:msvcrt.lib" "/OPT:ICF" "/OPT:REF"
  = note: LINK : fatal error LNK1181: cannot open input file 'bazel-out\x64_windows-opt-exec-ST-d57f47055a04\bin\external\rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools\rust_toolchain\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-3f3d3458f17b6f6c.rlib'


error: aborting due to 1 previous error

Target //wintest:wintest failed to build
INFO: Elapsed time: 8.715s, Critical Path: 1.44s
INFO: 4 processes: 3 internal, 1 local.
ERROR: Build did NOT complete successfully

I have tried various Visual Studio Build Tools (2017, 2019, 2022). I have also verified that the file which link.exefails to open ('bazel-out\x64_windows-opt-exec-ST-d57f47055a04\bin\external\rules_rust~~rust~rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools\rust_toolchain\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-3f3d3458f17b6f6c.rlib') actually exists. Developer mode is enabled on the Windows machine.

A minimal testcase which produces the result above can be found here: https://github.com/danfabi/wintest

Any help with this would be appreciated very much :-)

@danfabi danfabi closed this as completed Jul 6, 2024
@jjh42
Copy link

jjh42 commented Jul 26, 2024

did you find a solution for this?

@criemen
Copy link
Contributor

criemen commented Jul 29, 2024

MSVC doesn't support long paths, even if developer mode or long paths are enabled on the system, and this path is above the (rather short) length limitation of windows. See also https://bazel.build/configure/windows#long-path-issues.

@csarn
Copy link

csarn commented Aug 16, 2024

For everyone who comes across this and still can't get it to work on windows, also read the next headline:
https://bazel.build/configure/windows#filename-support
and enable 8.3 filenames. This made it work for me.

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

No branches or pull requests

4 participants