build failure: no such attribute 'exec_tools' in 'genrule' rule
Closed this issue · 8 comments
Hello, I followed the instructions in README to install gematria, but the build failed for an issue: no such attribute 'exec_tools' in 'genrule' rule. Below are the details.
This is the version of bazelisk:
(env) [gematria]$ ../bazelisk-linux-amd64 version
Bazelisk version: v1.19.0
WARNING: Output base '/data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86' is on NFS. This may lead to surprising failures and undetermined behavior.
Build label: 7.1.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Mar 21 18:08:37 2024 (1711044517)
Build timestamp: 1711044517
Build timestamp as int: 1711044517
And this is the build:
(env) [gematria]$ ../bazelisk-linux-amd64 build ...
WARNING: Output base '/data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86' is on NFS. This may lead to surprising failures and undetermined behavior.
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 https://github.com/bazelbuild/bazel/issues/18958.
DEBUG: Rule 'com_google_protobuf' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "a74f54b724bdc2fe0bfc271f4dc0ceb159805625" and dropping ["tag"]
DEBUG: Repository com_google_protobuf instantiated at:
/data/nfs_home/hrong1/gematria/WORKSPACE:16:15: in <toplevel>
Repository rule git_repository defined at:
/data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86/external/bazel_tools/tools/build_defs/repo/git.bzl:189:33: in <toplevel>
ERROR: /data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86/external/com_google_protobuf/python/BUILD.bazel:123:13: @@com_google_protobuf//python:aarch64_test_genrule: no such attribute 'exec_tools' in 'genrule' rule (did you mean 'executable'?)
ERROR: /data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86/external/com_google_protobuf/python/BUILD.bazel:131:12: @@com_google_protobuf//python:x86_64_test_genrule: no such attribute 'exec_tools' in 'genrule' rule (did you mean 'executable'?)
ERROR: /data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86/external/com_google_protobuf/python/BUILD.bazel:17:11: errors encountered resolving select() keys for @@com_google_protobuf//python:protobuf_python
ERROR: Analysis of target '//gematria/proto:canonicalized_instruction_py_pb2' failed; build aborted: Analysis failed
INFO: Elapsed time: 123.120s, Critical Path: 0.03s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
FAILED:
Fetching repository @@pybind11; Cloning tags/v2.10.3 of https://github.com/pybind/pybind11.git
Fetching repository @@pybind11_abseil_repo; Cloning 1caf1890443e8e303bf88850d3c27d5422903168 of https://github.com/pybind/pybind11_abseil.git
Fetching repository @@sonnet_repo; Cloning cd5b5fa48e15e4d020f744968f5209949ebe750f of https://github.com/deepmind/sonnet.git
Fetching repository @@graph_nets_repo; Cloning adf25162ba21bb0ae176c35483a74fb0c9dff576 of https://github.com/deepmind/graph_nets.git
Fetching repository @@rules_license~; starting
Fetching repository @@protobuf~; starting
Fetching repository @@rules_java~; starting
Fetching repository @@apple_support~; starting
Anyone has any idea? Thanks!
Hello,
tl;dr: please use Bazel 6 to build the project.
longer: the attribute names of some core rules changed between Bazel 6 and Bazel 7 (and one of them is genrule()
that causes the BUILD failures). We will migrate to the latest version eventually, but until then I'd recommend to install the latest version of Bazel 6.x and use that.
Hope this helps.
Thanks for the fast response, Ondrej. Let me try bazel 6.
Hongbo
I tried bazel 6.0. This time build seems to pass, but test fails:
(env) [gematria]$ ../bazel-6.0.0-pre.20221020.1-linux-x86_64 build ...
WARNING: Output base '/data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86' is on NFS. This may lead to surprising failures and undetermined behavior.
DEBUG: Rule 'com_google_pybind11_protobuf' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1686916296 +0000"
...
INFO: Build completed successfully, 6557 total actions
(env) [gematria]$ ../bazel-6.0.0-pre.20221020.1-linux-x86_64 test ...
WARNING: Output base '/data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86' is on NFS. This may lead to surprising failures and undetermined behavior.
ERROR: Skipping '...': error loading package under directory '': error loading package 'bazel-gematria/external/com_google_absl/absl/algorithm': Label '//absl:copts/configure_copts.bzl' is invalid because 'absl' is not a package; perhaps you meant to put the colon here: '//:absl/copts/configure_copts.bzl'?
ERROR: error loading package under directory '': error loading package 'bazel-gematria/external/com_google_absl/absl/algorithm': Label '//absl:copts/configure_copts.bzl' is invalid because 'absl' is not a package; perhaps you meant to put the colon here: '//:absl/copts/configure_copts.bzl'?
INFO: Elapsed time: 0.585s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (6 packages loaded)
currently loading: bazel-gematria/external/com_google_absl/absl/algorithm ... (22 packages)
ERROR: Couldn't start the build. Unable to run tests
Any idea? Thanks!
Maybe try Bazel 6.4.0? That's what I'm using in the provided docker container, and it works as expected.
Thanks for the suggestion. I tried bazel with USE_BAZEL_VERSION=6.4.0. Build works, but test fails for a different issue this time:
bash-5.1$ env USE_BAZEL_VERSION=6.4.0 ../bazelisk-linux-amd64 test ...
WARNING: Output base '/data/nfs_home/hrong1/.cache/bazel/_bazel_hrong1/fe3956cd0667122177c09d0692bd5c86' is on NFS. This may lead to surprising failures and undetermined behavior.
ERROR: error loading package under directory '': error loading package 'bazel-gematria/external/com_github_google_benchmark/tools': Unable to find package for @tools_pip_deps//:requirements.bzl: The repository '@tools_pip_deps' could not be resolved: Repository '@tools_pip_deps' is not defined.
INFO: Elapsed time: 0.752s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (31 packages loaded)
currently loading: bazel-gematria/external/com_github_google_benchmark/tools
ERROR: Couldn't start the build. Unable to run tests
Any idea?
Another issue happens when building TFLite:
mkdir /tmp/tflite && cd /tmp/tflite
curl https://raw.githubusercontent.com/google/ml-compiler-opt/main/buildbot/build_tflite.sh | bash
...
Call Stack (most recent call first):
/tmp/tflite/tensorflow/src/tensorflow-build/gemmlowp/contrib/CMakeLists.txt:10 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at CMakeLists.txt:167 (find_library):
Could not find PTHREADPOOL_LIB using the following names: pthreadpool
-- Configuring incomplete, errors occurred!
Based on #112 it seems like you got the Bazel build working? Mind sharing what you ended up doing to get that fixed in case others end up running into the same issue?
The CMake error that occurred while building TFLite is due to not having the libpthreadpool
package installed. On Debian based distributions, you should just need to install libpthreadpool-dev
in order to get everything going.
Thanks, Aiden. I'm able to build gematria and tflite with the following configuration:
OS: WSL Ubuntu 22.04.4 LTS
bazel: 6.4.0
Packages:
sudo apt-get -y install libpthreadpool0 libpthreadpool-dev
vi requirements.in:
tensorflow-probability==0.23.0
tensorflow==2.15.1; sys_platform=='linux'
Building TFLite: llvm-project needs be located outside the gematria code directory.
All tests passed except a gematria test failure (issue 112) and a llvm-cm test failure(issue 114).