Questions tagged [bazel-rules]
274 questions
0
votes
1 answer
Bazel - depend on generated outputs
I have a yaml file in a Bazel monorepo that has constants I'd like to use in several languages. This is kind of like how protobuffs are created and used.
How can I parse this yaml file at build time and depend on the outputs?
For instance:
item1:…

Nick
- 5,108
- 2
- 25
- 58
0
votes
1 answer
how to use binary in python test in bazel
I want to test cc_binay in bazel with py_test rule, how can I access the cc_binary in python file?
My bazel BUILD file is:
py_test(
name = 'simple_test',
size = 'small',
srcs = ['simple_test.py'],
data = [':simple'], # the tested…
0
votes
2 answers
bazel logging inside of a BUILD file
Hi I want to see what is being passed to a rule that is defined in a rules.bzl file. So I would like to add just a logging statement inside of either the BUILD file or the rules.bzl file just to see what parameter was passed. I realize there is a…

uh_big_mike_boi
- 3,350
- 4
- 33
- 64
0
votes
1 answer
Bazel: why lint failed for variable reference?
I had this genrule in BUILD file, but bazel build failed for the error of:
in cmd attribute of genrule rule //example:create_version_pom: $(BUILD_TAG) not defined
genrule(
name = "create_version_pom",
srcs = ["pom_template.xml"],
outs…

Frank
- 1,315
- 7
- 24
- 43
0
votes
1 answer
Building Go with Bazel could not resolve a repository
I am following the steps from "Building Go Services With Bazel" youtube and created a simple project with dependency that fails to build with an error:
ERROR: /builds/mvfwd/issue-bazel-go/cmd/BUILD.bazel:3:11: no such package…

mvfwd
- 141
- 2
- 9
0
votes
3 answers
bazel, python rules, created files how to get them
How can I access files that my python is creating?
so inside a python i got something like:
from pathlib import Path
p = Path('my_file.txt')
p.write_text('testing')
print("Testing done")
then when i do bazel run my_file i can see in terminal text…

Niewasz Biznes
- 105
- 10
0
votes
1 answer
how to get each rule's time cost in bazel build
I want to get the time every rule costs when executing a bazel build.
I found aspect in bazel,use that feature I can print each rule's finish time in log file.
However I found aspect of a rule executing after the rule executing, with that I can't…

lzf
- 13
- 2
0
votes
1 answer
How to reuse deps for different tests in Bazel?
I am using Bazel to compile scala.
Right now, my scala_test looks like
scala_test {
name = "sample",
srcs = [
"a.scala",
"b.scala",
"c.scala",
"d.scala",
],
deps = [
…

mundaneL
- 21
- 7
0
votes
0 answers
Error in fail: Auto-Configuration Error: Cannot find Java binary
I m trying to run handtracking example in the mediapipe package
and when I run the building command using bazel I get the error below
ERROR: C:/users/admin/_bazel_admin/hfz472l7/external/local_jdk/BUILD.bazel:3:10: in fail_rule rule…

fatima
- 23
- 5
0
votes
1 answer
bazel with go:embed directive SIGSEGV
I am embeddingsrcs into a go_library to boostrap an embed.FS variable. It took some time to sort this out (see bazel go_embed_data "could not embed").
The new problem I have is I am receiving a SIGSEGV during runtime I'm seeing unexpected fault…

a11hard
- 1,904
- 4
- 19
- 41
0
votes
0 answers
Set -dynlink in Bazel go rules
When building a go binary using Bazel I'm trying to figure out how to set -dynlink flag
I've checked most of the available options but unsure if it is possible.
It seems to be available here

a11hard
- 1,904
- 4
- 19
- 41
0
votes
1 answer
Bazel, how to add Python library built in C++ into Python Binary?
I have a C++ Library with Python Bindings built as follows, and a Python Binary that needs to import the libPerceptionPybind.so that is generated.
package(default_visibility = ["//visibility:public"])
load("@pip_pybind//:requirements.bzl",…

raaj
- 2,869
- 4
- 38
- 58
0
votes
1 answer
Have rules_cc use latest version of GCC
I am using Bazel to build my project. One of the dependencies is Abseil, which in turn depends on rules_cc.
I notice that when I have multiple versions of GCC installed, rules_cc may be directing Bazel to use an older version of GCC even though I…

Jack Humphries
- 13,056
- 14
- 84
- 125
0
votes
1 answer
Import cmocka library in Bazel Build
I'm using cmocka with Bazel and I want to import cmocka library in my test files (for c embedded code) like but I'm always getting: cmocka.h: No such file or directory.
my Build is:
cc_library(
name = "mock",
srcs =…

Nesmo07
- 15
- 3
0
votes
1 answer
Use of current toolchain in bazel rule
I've use the below bazel rule to build static libraries with bazel:
def _cc_static_library_impl(ctx):
cc_deps = [dep[CcInfo] for dep in ctx.attr.deps]
libraries = []
for cc_dep in cc_deps:
for link_input in…

user2672165
- 2,986
- 19
- 27