Questions tagged [bazel-rules]
274 questions
0
votes
0 answers
Building uWSGI with bazel
I have a simple example package served with uwsgi, that I'm trying to switch from building with makefile rules to bazel.
The WORKSPACE file that, in addition to loading rules_python and other default stuff (registering toolchains) also gets uwsgi as…

legend855
- 45
- 7
0
votes
1 answer
How to simulate generating a source-file in a Bazel action?
Suppose I am writing a custom Bazel rule for foo-compiler.
The user provides a list of source-files to the rule:
foo_library(
name = "hello",
srcs = [ "A.foo", "B.foo" ],
)
To build this without Bazel, the steps would be:
Create a config file…

sdgfsdh
- 33,689
- 26
- 132
- 245
0
votes
1 answer
Using data dependency for bazel ctx.action.run_shell custom rule
I am looking at emit_rule example in bazel source tree:
https://github.com/bazelbuild/examples/blob/5a8696429e36090a75eb6fee4ef4e91a3413ef13/rules/shell_command/rules.bzl
I want to add a data dependency to the custom rule. My understanding of…

edc
- 99
- 1
- 8
0
votes
0 answers
Using conan in Bazel for linux but not for windows
I have a system that is built using Bazel and is using OpenCV as a 3rd party package.
When building on Linux I want to use a prebuilt package using conan, and when using Windows I want to use a locally compiled version, and not use conan.
What I…

La bla bla
- 8,558
- 13
- 60
- 109
0
votes
1 answer
How to wrap a rule in Bazel?
I use bazel configure_make rule to build 3rd party lib. This lib requires specifying paths to compiler in its configure options (or it uses default compiler, like /usr/bin/gcc, that is definitely wrong for cross-compilation).
I want to make my BUILD…

user19185854
- 11
- 3
0
votes
0 answers
Error when generating compile commands for tensorflow using bazel
I am trying to generate compile commands for TensorFlow as described in this article. However, when I run ./create_compile_commands.sh //tensorflow/tools/pip_package:build_pip_package, I get the following error:
INFO: Options provided by the…

Nima shiri
- 73
- 7
0
votes
1 answer
"expect_failure" attributes for bazel rules
I want to define an "expect_failure" boolean attribute for a bazel rule set that I'm devising, so I can properly write tests for my tool chain. However:
ERROR: /blah/blah.bzl:7:26: cannot add attribute: There is already a built-in attribute…

Jonathan Mayer
- 132
- 1
- 5
0
votes
1 answer
Bazel unable to install_pkgs in an image
I am trying to add some packages to distroless debian-11 python image (gcr.io/distroless/python3-debian11:debug). Bazel build is succeeding but when I run the generate image, the debian pacakges were not present.
In case if you like to clone for…

BhanuKiran
- 2,631
- 3
- 20
- 36
0
votes
1 answer
How to use rules_webtesting?
I want to use https://github.com/bazelbuild/rules_webtesting. I am using Bazel 5.2.0.
The whole project can be found here.
My WORKSPACE.bazel file looks like this:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
…

Vertexwahn
- 7,709
- 6
- 64
- 90
0
votes
1 answer
linking existed c++ static libaray in Bazel failed
I am writing a OpenGL programe on windows.
I want to link precompiled GLEW32.lib, but failed and failed for a couple of hours.
In WORKSPACE, a http_archive uses to download GLEW32.lib
http_archive(
name = "glew",
build_file =…

zichao liu
- 311
- 1
- 6
0
votes
0 answers
NameError with extend_path using Bazel
I am trying to make a python program using bazel. When running the following snippet of code:
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
I am given the following error:
NameError: name '__path__' is not defined
0
votes
1 answer
Bazel - What is the relation between hdrs vs includes on a cc_library to generate gcc command with -I instead of -isystem or -iquote?
Looks like there is a relation between creating a cc_library on a BUILD file using hdrs and includes to generate the gcc command with -isystem, -iquote and -I.
Official Bazel doc
To explain my problem better, I have this example.
I have a Bazel…

waas1919
- 2,365
- 7
- 44
- 76
0
votes
1 answer
How to add non-bazel project as a build target for current bazel project?
Background:
I have a C++ header-only library eg : mpack
mpack uses cmake build system. However, I want to use some of its functions in my project (my_project) which uses bazel build system.
I was following the steps…

Jarvis
- 71
- 3
0
votes
0 answers
undefined: gomock.AssignableToTypeOf
I'm getting this error: undefined: gomock.AssignableToTypeOf
It is occurring while using function gomock.AssignableToTypeOf of package github.com/golang/mock"
This starts occurring when I have Updated versions in the WORKSPACE file of Project, and…

Gagan Kalra
- 65
- 9
0
votes
2 answers
Why container_layer is not getting added in the container_image?
I have the following bazel definition:
docker/project/BUILD.bazel
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@io_bazel_rules_docker//docker/package_managers:download_pkgs.bzl",…

Vishrant
- 15,456
- 11
- 71
- 120