bazel - Windows 10 上的 pkg_rules 问题
问题描述
我想用rules_pkg
我有以下设置:Windows 10 x64(版本 2004,Bazel 3.7.0,Visual Studio 16 2019,MSYS2 x86_64)
我的最小设置如下所示:
工作空间.bazel
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# rules_pkg
http_archive(
name = "rules_pkg",
sha256 = "6b5969a7acd7b60c02f816773b06fcf32fbe8ba0c7919ccdc2df4f8fb923804a",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.3.0/rules_pkg-0.3.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.3.0/rules_pkg-0.3.0.tar.gz",
],
)
构建.bazel
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
cc_binary(
name = "HelloWorld",
srcs = ["main.cpp"],
)
pkg_tar(
name = "deploy_HelloWorld",
srcs = [
":HelloWorld",
],
extension = "tar.gz",
)
主文件
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
}
当我尝试构建时,bazel build //...
我得到:
PS G:\dev\BazelDemos\HelloWorld> bazel build //...
INFO: Analyzed 2 targets (20 packages loaded, 143 targets configured).
INFO: Found 2 targets...
ERROR: G:/dev/bazeldemos/helloworld/BUILD.bazel:8:8: PackageTar deploy_HelloWorld.tar.gz failed (Exit 9009): build_tar.exe failed: error executing command bazel-out/host/bin/external/bazel_tools/tools/build_defs/pkg/build_tar.exe --flagfile bazel-out/x64_windows-fastbuild/bin/deploy_HelloWorld.args
INFO: Elapsed time: 0.642s, Critical Path: 0.29s
INFO: 8 processes: 7 internal, 1 local.
FAILED: Build did NOT complete successfully
我可以在其他两台具有相同/相似设置的 Windows 10 机器上毫无问题地构建。有任何想法吗?
更多设置细节:
Path
包含C:\msys64\usr\bin
. BAZEL_SH
设置为C:\msys64\usr\bin\bash.exe
。
解决方案
Python3 未安装在我的 Path 变量中。退出 9009 通常是指批处理脚本未能调用特定命令而触发的错误。
推荐阅读
- ios - 如何使用 AVFoundation 切换相机
- excel - Excel 中 INDIRECT() 的替代方法
- python - 在 travis-ci 等 CI 平台中测试代码时,如何在没有浏览器或网络访问的情况下对 selenium 代码进行单元测试?
- java - java.lang.NoSuchMethodError: javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String;
- java - 没有验证证明无法创建 PhoneAuthCredential?
- paypal - 目前,有哪些解决方案可用于使用 PayPal 进行 SPLIT 付款?
- python - 在 Python 中转储 json 文件时如何跳过或修改字段?
- java - 从 IntentService 发送通知不起作用?
- python - 如何使用 Scrapy 和 Splash 爬取 LeetCode
- android - 如何在后端验证请求