bazel-gazelle: Gazelle fails to run on Windows
I am using Windows 10 and Bazel 0.17.1.
Following the steps in https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel, on a new workspace, I get the following output:
$ bazel run //:gazelle --verbose_failures
INFO: Analysed target //:gazelle (34 packages loaded).
INFO: Found 1 target...
ERROR: C:/users/kamik/_bazel_kamik/mbmxo7xv/external/bazel_gazelle/internal/language/go/gen_std_package_list/BUILD.bazel:3:1: GoLink external/bazel_gazelle/internal/language/go/gen_std_package_list/windows_amd64_stripped/gen_std_package_list.exe failed (Exit 1): link.exe failed: error executing command
cd C:/users/kamik/_bazel_kamik/mbmxo7xv/execroot/__main__
SET CGO_ENABLED=1
SET GOARCH=amd64
SET GOOS=windows
SET GOROOT=external/go_sdk
SET GOROOT_FINAL=GOROOT
SET PATH=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64
bazel-out/host/bin/external/io_bazel_rules_go/go/tools/builders/windows_amd64_stripped/link.exe -sdk external/go_sdk -installsuffix windows_amd64 -package_list bazel-out/host/bin/external/go_sdk/packages.txt -o bazel-out/host/bin/external/bazel_gazelle/internal/language/go/gen_std_package_list/windows_amd64_stripped/gen_std_package_list.exe -main bazel-out/host/bin/external/bazel_gazelle/internal/language/go/gen_std_package_list/windows_amd64_stripped/gen_std_package_list%/github.com/bazelbuild/bazel-gazelle/internal/language/go/gen_std_package_list.a -- -extld C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -w -extldflags /MACHINE:X64
external\go_sdk\pkg\tool\windows_amd64\link.exe: cannot open file bazel-out/host/bin/external/bazel_gazelle/internal/language/go/gen_std_package_list/windows_amd64_stripped/gen_std_package_list%/github.com/bazelbuild/bazel-gazelle/internal/language/go/gen_std_package_list.a: open bazel-out/host/bin/external/bazel_gazelle/internal/language/go/gen_std_package_list/windows_amd64_stripped/gen_std_package_list%/github.com/bazelbuild/bazel-gazelle/internal/language/go/gen_std_package_list.a: The system cannot find the path specified.
GoLink: error running subcommand: exit status 2
Target //:gazelle failed to build
INFO: Elapsed time: 2.381s, Critical Path: 0.21s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
I’ve created a repo the the bare minimum of code and files to reproduce this in https://github.com/filipesilva/gazelle-windows.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (10 by maintainers)
Commits related to this issue
- link: take absolute path of main file Windows has trouble with long paths. Other paths to .a files are absolutized already. Related bazelbuild/bazel-gazelle#321 — committed to jayconrod/rules_go by deleted user 6 years ago
- Make gazelle rule work on Windows The script produced by the gazelle rule tries to set GOROOT to the SDK used by rules_go. This depends on runfiles. With this change, the script will read the MANIFES... — committed to jayconrod/bazel-gazelle by deleted user 6 years ago
- Make gazelle rule work on Windows (#323) The script produced by the gazelle rule tries to set GOROOT to the SDK used by rules_go. This depends on runfiles. With this change, the script will read th... — committed to bazelbuild/bazel-gazelle by jayconrod 6 years ago
- link: take absolute path of main file (#1727) Windows has trouble with long paths. Other paths to .a files are absolutized already. Related bazelbuild/bazel-gazelle#321 — committed to bazelbuild/rules_go by jayconrod 6 years ago
- Fixes for gazelle rule * find_runfile is new function used to locate runfiles. This is used to locate the go tool and the gazelle executable. * BUILD_WORKSPACE_DIRECTORY is used instead of derefere... — committed to jayconrod/bazel-gazelle by deleted user 6 years ago
- Fixes for gazelle rule (#324) * find_runfile is new function used to locate runfiles. This is used to locate the go tool and the gazelle executable. * BUILD_WORKSPACE_DIRECTORY is used instead of... — committed to bazelbuild/bazel-gazelle by jayconrod 6 years ago
- link: take absolute path of main file (#1727) Windows has trouble with long paths. Other paths to .a files are absolutized already. Related bazelbuild/bazel-gazelle#321 — committed to bazelbuild/rules_go by jayconrod 6 years ago
- link: take absolute path of main file (#1727) Windows has trouble with long paths. Other paths to .a files are absolutized already. Related bazelbuild/bazel-gazelle#321 — committed to bazelbuild/rules_go by jayconrod 6 years ago
- link: take absolute path of main file (#1727) Windows has trouble with long paths. Other paths to .a files are absolutized already. Related bazelbuild/bazel-gazelle#321 — committed to bazelbuild/rules_go by jayconrod 6 years ago
Indeed, just realized the fix https://github.com/bazelbuild/bazel/commit/7aaa34a1ff518146dd972810445a3d8ced93aa27 is not included in 0.16.1 I’ll tell our CI team to upgrade bazel to 0.17.1 ASAP
@jayconrod tried with your commit:
Finishes successfully!
I think the other missing executables were just because
native.sh_binary
was not being used.I also tried it on another repository (the main one where this came up, https://github.com/bazelbuild/rules_typescript), and it also seems to have run successfully:
Great work!