Skip to content

Fails to build detector_runner with Bazel >= 8 #6

Closed

Description

@mathieu001

I have installed all the prerequisite tools mentioned in the Quick Start. Then I downloaded the latest Vanir and go to the Vanir directory. But I can't build the detector_runner correctly.

user@dev-machine:~/workspace/AOSP/sources/Android/vanir$ bazel build //:detector_runner
ERROR: Error computing the main repository mapping: error loading package 'external': Both --enable_bzlmod and --enable_workspace are disabled, but one of them must be enabled to fetch external dependencies.
Computing main repo mapping:

Then I checked .bazelrc and found '--enable_bzlmod' is False by default. I tried to change this it True but I got more errors when trying to build detector_runner. So how to build detector_runner? Any comments will be appreciated.

user@dev-machine:~/workspace/AOSP/sources/Android/vanir$ bazel build //:detector_runner
Starting local Bazel server and connecting to it...
WARNING: --enable_bzlmod is set, but no MODULE.bazel file was found at the workspace root. Bazel will create an empty MODULE.bazel file. Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. For more details, please refer to bazelbuild/bazel#18958.
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_android' found. This will result in a failure if there's a reference to those rules or symbols.
WARNING: Target pattern parsing failed.
ERROR: Skipping '//:detector_runner': error loading package '': Unable to find package for @@[unknown repo 'vanir_deps' requested from @@]//:requirements.bzl: The repository '@@[unknown repo 'vanir_deps' requested from @@]' could not be resolved: No repository visible as '@vanir_deps' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration.
ERROR: error loading package '': Unable to find package for @@[unknown repo 'vanir_deps' requested from @@]//:requirements.bzl: The repository '@@[unknown repo 'vanir_deps' requested from @@]' could not be resolved: No repository visible as '@vanir_deps' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration.
INFO: Elapsed time: 9.092s
INFO: 0 processes.
ERROR: Build did NOT complete successfully

Activity

  1. baekhyunwook commented on Dec 11, 2024

    @baekhyunwook
    Collaborator

    Thanks for sharing the issue with us!
    I guess it is due to the default value change for --enable_workspace introduced from Bazel 8 (released in 2024 Dec).

    Vanir is currently using WORKSPACE.bazel so the flag should be set to True.
    Could you retry running Vanir with --enable_workspace=True'? (or simply adding common --enable_workspace=true to .bazelrc).

  2. mathieu001 commented on Dec 11, 2024

    @mathieu001
    Author

    Thank you so much for your reply!
    I added --enable_workspace=True and got another error. Would you please help to have a look at it?

    si@dev-machine:~/workspace/AOSP/sources/Android/vanir$ git diff
    diff --git a/.bazelrc b/.bazelrc
    index 30a9cb4..0ee46f1 100644
    --- a/.bazelrc
    +++ b/.bazelrc
    @@ -5,5 +5,5 @@

    https://developers.google.com/open-source/licenses/bsd

    -common --enable_bzlmod=False
    +common --enable_bzlmod=False --enable_workspace=True
    build --cxxopt=-std=c++17 --cxxopt=-fexceptions --cxxopt=-Wno-nonnull --cxxopt=-Wno-sign-compare --cxxopt=-Wno-parentheses --cxxopt=-Wno-deprecated-declarations
    si@dev-machine:~/workspace/AOSP/sources/Android/vanir$ bazel build //:detector_runner
    WARNING: WORKSPACE support will be removed in Bazel 9 (late 2025), please migrate to Bzlmod, see https://bazel.build/external/migration.
    ERROR: /home/si/.cache/bazel/_bazel_si/14e04dbb2f510a16757e9795958221ee/external/rules_python/python/private/reexports.bzl:58:19: name 'PyInfo' is not defined (did you mean 'CcInfo'?)
    ERROR: /home/si/.cache/bazel/_bazel_si/14e04dbb2f510a16757e9795958221ee/external/rules_python/python/private/reexports.bzl:61:26: name 'PyRuntimeInfo' is not defined
    ERROR: Error computing the main repository mapping: at /home/si/.cache/bazel/_bazel_si/14e04dbb2f510a16757e9795958221ee/external/rules_python/python/pip.bzl:18:6: at /home/si/.cache/bazel/_bazel_si/14e04dbb2f510a16757e9795958221ee/external/rules_python/python/pip_install/requirements.bzl:3:6: at /home/si/.cache/bazel/_bazel_si/14e04dbb2f510a16757e9795958221ee/external/rules_python/python/defs.bzl:21:5: compilation of module 'python/private/reexports.bzl' failed
    Computing main repo mapping:
    Fetching repository @@python3_9; starting
    Fetching repository @@bazel_skylib; starting

  3. baekhyunwook commented on Dec 11, 2024

    @baekhyunwook
    Collaborator

    OK. I could reproduce your error after upgrading by Bazel to 8,
    and it looks the Bazel 8, which was released yesterday, is causing a non-trivial compatibility issue.
    I think this would take some time for us to fix.

    Meanwhile, I would recommend you (and others) to try with Bazel 7.4.1 or lower.

    If downgrading Bazel is complicated in your env,
    I would recommend to try bazelisk .
    Once the bazelisk is installed, you can replace the bazel command in the tutorial with bazelisk. E.g.,

    export USE_BAZEL_VERSION=7.4.1
    bazelisk build //:detector_runner
    bazelisk test --test_output=all //...
    
  4. pinned this issue on Dec 11, 2024
  5. baekhyunwook commented on Dec 11, 2024

    @baekhyunwook
    Collaborator

    I will pin this issue until our team resolve this compatibility issue as it can affect other users trying Vanir with the recently released Bazel 8. @doryiii @jwdunlap for viz.

  6. changed the title [-]Fails to build detector_runner[/-] [+]Fails to build detector_runner with Bazel >= 8[/+] on Dec 11, 2024
  7. mathieu001 commented on Dec 11, 2024

    @mathieu001
    Author

    Thanks! It's indeed a compatibility issue. I have managed to build the detector successfully after downgrading Bazel to 7.3.1.

  8. doryiii commented on Aug 17, 2025

    @doryiii
    Collaborator

    This has now been fixed.

  9. added a commit that references this issue on Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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