Bazel --compile_one_dependency incorrectly requires Antithesis-only libvoidstar

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • 9.1.0-rc0, 9.1.0-rc1022
    • Affects Version/s: None
    • Component/s: Bazel, Build
    • None
    • DevProd Build
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Overview

      A normal local MongoDB C++ unittest build can fail because the Antithesis-only libvoidstar shared library is required during Bazel repository setup, even when //bazel/config:use_libvoidstar is false/default. This blocks the --compile_one_dependency workflow for non-Antithesis builds.

      Steps to Reproduce

      Run a normal local build such as:

      bazel build src/mongo/db/service_entry_point_shard_role_test.cpp --compile_one_dependency
      

      With no libvoidstar.so installed, the build fails with:

      Error in fail: libvoidstar was requested, but it was not found. Checked: /usr/lib/libvoidstar.so, /usr/lib64/libvoidstar.so, /usr/local/lib/libvoidstar.so. Install libvoidstar or set --repo_env=LIBVOIDSTAR_PATH=/absolute/path/to/libvoidstar.so.
      ERROR: no such package '@@_main~_repo_rules~libvoidstar//': libvoidstar was requested, but it was not found.
      

      Actual Behavior

      • libvoidstar is not part of the MongoDB toolchain, but a normal local build requires it.
      • Passing -//bazel/config:use_libvoidstar=False, -config=dbg, or setting MONGO_BAZEL_USE_HERMETIC_CONTAINER=0 does not avoid the repository setup failure.
      • Building the explicit test target without --compile_one_dependency can complete, indicating that the option causes additional repository/toolchain evaluation.

      Expected Behavior

      Normal non-Antithesis builds should not require libvoidstar when use_libvoidstar is false. The library should only be required when an Antithesis build explicitly enables --//bazel/config:use_libvoidstar=True.

      Investigation

      • SERVER-132885 added hermetic-container support and an unconditional @libvoidstar repository declaration in MODULE.bazel.
      • The setup_libvoidstar repository rule currently fails while setting up the external repository if the library is absent, before the configuration select can prevent use of the library.
      • The failure is reproducible in the repository rule at bazel/repository_rules/libvoidstar.bzl.

      Proposed Fix

      Make the repository rule setup non-fatal when libvoidstar is absent and use_libvoidstar is false, while preserving a clear failure if an Antithesis build enables the library without providing it. Add regression coverage for the --compile_one_dependency path and verify the normal build and formatting checks.

      Impact

      This prevents developers from compiling individual C++ unittest dependencies through the standard Bazel workflow unless they install or locate an Antithesis-only library.

            Assignee:
            Unassigned
            Reporter:
            Daniel Moody
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: