Skip to content

stdlib build on Windows fails with pathmapping enabled #4366

Open
bazelbuild/bazel
#25430
@malt3

Description

@malt3

Steps to reproduce:

  • Use Windows (this works fine on macOS or Linux)
  • Create a minimal workspace, as below (use txtar to extract).
  • bazel build //:hello
-- .bazelrc --
build --experimental_output_paths=strip
-- WORKSPACE --
-- MODULE.bazel --
module(
    name = "scratch",
    version = "0.0.0",
)

bazel_dep(
    name = "rules_go",
    version = "0.54.1",
)

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(
    name = "go_sdk",
    version = "1.24.1",
)

use_repo(go_sdk, "go_sdk")
-- BUILD --
load("@rules_go//go:def.bzl", "go_library")

go_library(
    name = "hello",
    srcs = ["hello.go"],
    importpath = "example.com/hello",
)
-- hello.go --
package hello

I'm not sure if this is supposed to work, considering that pathmapping itself is experimental.
The full error message is printed below:

PS C:\Users\user\workspace\test> bazel build //:hello
Starting local Bazel server (8.2.1) and connecting to it...
INFO: Analyzed target //:hello (83 packages loaded, 5973 targets configured).
ERROR: C:/users/malte/_bazel_malte/47xxqnog/external/rules_go+/BUILD.bazel:42:7: GoStdlib external/rules_go+/stdlib_/pkg failed: (Exit -1): builder.exe failed: error executing GoStdlib command (from target @@rules_go+//:stdlib) bazel-out\cfg\bin\external\rules_go++go_sdk+go_sdk\builder_reset\builder.exe stdlib -sdk external/rules_go++go_sdk+go_sdk -goroot external/rules_go++go_sdk+go_sdk -installsuffix windows_amd64 -out ... (remaining 5 arguments skipped)
Action failed to execute: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\malte\_bazel_malte\47xxqnog\execroot\_main\bazel-out\cfg\bin\external\rules_go++go_sdk+go_sdk\builder_reset\builder.exe" stdlib -sdk external/rules_go++go_sdk+go_sdk -goroot external/rules_go++go_sdk+go_sdk -installsuffix windows_amd64 -out bazel-out/cfg/bin/external/rules_go+/stdlib_ -package std -gcflags ""): The system cannot find the file specified.
 (error: 2)
Target //:hello failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 69.606s, Critical Path: 28.78s
INFO: 6 processes: 5 internal, 1 local.
ERROR: Build did NOT complete successfully                                                                                                                                                                                                                                                                                                                                                                                      
PS C:\Users\user\workspace\test>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions