fix(bazel): test/BUILD.bazel uses darwin_x86_64 instead of darwin condition, breaking //test:butil_unittests on Apple Silicon (darwin_arm64)

未关闭 适合新手
#3,763 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp

调研方向

阅读 test/BUILD.bazel 第 133–139 行附近的内容,并将 Darwin 条件与根目录 BUILD.bazel 中的示例进行比较。在 Apple Silicon 上运行 bazel test //test:butil_unittests,以复现仅限 Linux 的源文件编译失败。当 Darwin 条件在 Intel 和 Apple Silicon macOS 上都排除这些源文件时,即为完成。

由索引模型根据 Issue 内容生成。

描述

Describe the bug

In test/BUILD.bazel (lines 133–139), TEST_BUTIL_SOURCES excludes the Linux-only unit test sources (test_file_util_linux.cc and proc_maps_linux_unittest.cc) using @bazel_tools//tools/osx:darwin_x86_64:

] + select({
    "@bazel_tools//tools/osx:darwin_x86_64": [],
    "//conditions:default": [
        "test_file_util_linux.cc",
        "proc_maps_linux_unittest.cc",
    ],
})

Unlike the root BUILD.bazel (which uses @bazel_tools//src/conditions:darwin at lines 93, 284, and 398 to match both Intel and Apple Silicon macOS), @bazel_tools//tools/osx:darwin_x86_64 only matches Intel macOS (x86_64).

On Apple Silicon (darwin_arm64), running bazel test //test:butil_unittests falls through to "//conditions:default" and attempts to compile test_file_util_linux.cc and proc_maps_linux_unittest.cc (failing on Linux-only headers such as <sys/vfs.h>).

Expected behaviour

test/BUILD.bazel should use @bazel_tools//src/conditions:darwin (consistent with the root BUILD.bazel) so bazel test //test:butil_unittests excludes the Linux-only source files on both darwin_x86_64 and darwin_arm64.

主要语言
C++
星标
17.6k
派生
4.2k
平均合并
3 天 17 小时
30 天内合并 PR
72

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/brpc 的其他 Issue

查看 apache/brpc 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。