Repository navigation
Description
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
baekhyunwook commentedon Dec 11, 2024
Thanks for sharing the issue with us!
I guess it is due to the default value change for
--enable_workspaceintroduced from Bazel 8 (released in 2024 Dec).Vanir is currently using
WORKSPACE.bazelso the flag should be set toTrue.Could you retry running Vanir with
--enable_workspace=True'? (or simply addingcommon --enable_workspace=trueto.bazelrc).mathieu001 commentedon Dec 11, 2024
Thank you so much for your reply!
I added
--enable_workspace=Trueand 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
baekhyunwook commentedon Dec 11, 2024
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
bazelcommand in the tutorial withbazelisk. E.g.,baekhyunwook commentedon Dec 11, 2024
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.
[-]Fails to build detector_runner[/-][+]Fails to build detector_runner with Bazel >= 8[/+]mathieu001 commentedon Dec 11, 2024
Thanks! It's indeed a compatibility issue. I have managed to build the detector successfully after downgrading Bazel to 7.3.1.
doryiii commentedon Aug 17, 2025
This has now been fixed.
Merge pull request google#6 from node0/tag-with-commit-id