Questions tagged [bazel]
Bazel is a build tool that builds code quickly and reliably. It is used to build the majority of Google's software, and thus it has been designed to handle build problems present in Google's development.
2,997
questions
0
votes
0
answers
18
views
In Bazel, with a `configure_make` rule, how can you deliver `.la` files?
Still working on a rule building xmlsec1, I'm trying to define .la files to be part of my build artifacts:
configure_make(
name="xmlsec1",
lib_name="xmlsec1",
...
0
votes
1
answer
24
views
How to make gopls recognize external github imports
I recently started to work on a Go project.
When I use gopls with Coc, all external imports are not recognized such as "github.com/prometheus/client_golang/prometheus". It complains it could ...
0
votes
1
answer
22
views
Is there any way to print all macros that are defined when using bazel build?
i am using bazel build to build tensorflow, and I want to know every defined macro
I tried bazel build --copt -dM , but not effective
0
votes
0
answers
18
views
Can you create a config_setting for an environment variable specified with action_env?
I'm trying to select between the development and distribution provisioning profiles for my iOS application built with Bazel.
Right now I'm hacking this with a config_setting based on the compilation ...
0
votes
0
answers
21
views
Avoid transitive dependency on python typing backport?
I work on a lib that only supports python 3.8 and up. Therefore, the built-in typing module is always present. However, my lib depends on another lib (raydp) which depends on this backport of typing ...
-1
votes
0
answers
20
views
How to build Tensorflow 2.9 with GPU capabilities with python 3.8 using docker container based on Ubunto
this is the first time I need to build TensorFlow from a source. I am using the documentation so I follow these steps:
1) docker pull tensorflow/tensorflow:devel-gpu
2) docker run --gpus all -it -w /...
0
votes
0
answers
18
views
How to make Bazel correctly cache dependencies built by itself?
I have a (relatively small) Bazel rule for some configure/make based project, say xmlsec1 - you can take any other, the important thing seems to be the external tooling behind foreign_cc:
xmlsec1....
1
vote
1
answer
19
views
Why does bazel's rules_foreign_cc make not find/create the artifacts?
I want to create a make rule from rules_foreign_cc.
But even the minimal example below is causing issues for me.
With the following setup:
.
├── BUILD (empty)
├── hello
│ ├── BUILD.bazel
│ ├── ...
0
votes
0
answers
11
views
Bazel: The following packages have unmet depencies: node-browserslist: depends: nodejs:any, unable to correct problems, you have held broken packages
I am trying to install Bazel on linux (so that I can use the "bazel build" command with some tensorflow libraries) by running
sudo apt install bazel-bootstrap
However, I am getting the ...
0
votes
0
answers
22
views
Bazel build of JAX fails with missing dependency declarations
I am trying build cuda-enabled JAX from source on a cluster with CentOS version7. In the jax home directory, I run:
python build/build.py --enable_cuda --cuda_path=$CUDA_HOME --cudnn_path=$CUDNN_HOME
...
0
votes
2
answers
20
views
Is there a way to instruct bazel to list all the test targets it has found without building or testing them?
I have 200 subdirectories and I need to find how many how many has test targes and only build them instead of building all. is there a way?
Is there a way to instruct bazel to list all the test ...
0
votes
0
answers
21
views
Bazel C++ code coverage with a custom coverage tool (Squish Coco)
I couldn't find anything in the official documentation on this. We're using Squish Coco for code coverage and can't use lcov for certification reasons, which is the only tool supported by bazel ...
0
votes
0
answers
39
views
C++ Tensorflow Lite undefined referance
I'm trying to build a project using Tensorflow Lite on my debian 11 machine, however it says I'm getting an undefined reference on some functions.
Here is the code I'm trying to run:
// Works
std::...
0
votes
0
answers
18
views
can anyone explain what bazel coverage report details are?
can anyone explain what DA, LH and LF means in this report and what are each numbers?
bazel-out/_coverage/_coverage_report.dat
TN:
SF:src/services/guava/keys/keys.go
DA:16,1
DA:17,1
DA:18,1
DA:19,1
DA:...
0
votes
0
answers
22
views
What's the intended way to get artifacts created with Bazel / configure_make with the original file permissions?
I have a Bazel configure_make rule building OpenSSL and it looks like this:
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
filegroup(name="all_srcs", ...
1
vote
0
answers
26
views
bazel cgo links to incorrect .so file path
I'm using bazel cgo to add dependency on .so file. lld on the generated binary file show dependency on
bazel-out/k8-fastbuild-ST-<some-hash>/bin/_solib_k8/<some-path>/<my-library>.so ...
0
votes
0
answers
31
views
Bazel project how to copy candidate directories during build stage
I have a cpp project with the later file struct
MyProject
WORKSPACE
-directory_a
—mylib.cpp
—interface.h
—BUILD
-directory_b
—mylib.cpp
—interface.h
—BUILD
—directoryC
—main.cpp
—BUILD
In main.cpp ...
1
vote
0
answers
28
views
Using Bazel monorepo, not able to generate coverage for Kotlin apps
My Bazel monorepo, has apps in Kotlin and Golang. In the earlier versions (For Go/Kotlin Bazel rules), the support for code coverage was not there but in the later rules-versions it's supported as per ...
0
votes
0
answers
51
views
How to add all requirements.txt dependencies to py_library in Bazel BUILD file @rules_python
When using Bazel @rules_python there's is this handy target generator helper pip_parse, which generates library targets for every dependency in requirements.txt, which is nice:
load("@...
0
votes
2
answers
32
views
drake bazel test failure in solvers:csdp_solver_test
I followed these instrcutions:
cd /path/to/drake
bazel build //... # Build the entire project.
bazel test //... # Build and test the entire project.
But, I got the ...
2
votes
1
answer
40
views
Change test execution directory in Bazel?
I have a simple Bazel project layout like this:
.
├── foo
│ ├── BUILD.bazel
│ ├── testdata
│ │ └── a.txt
│ └── test.sh
└── WORKSPACE
The test checks that a.txt exists:
foo/test.sh
#!/bin/...
0
votes
0
answers
31
views
After compiling a subgraph with tfcompile, how do I invoke the graph in a c++ file without bazel?
The Problem
I am using aot compilation, and want to minimize the use of bazel. I compiled the tfcompile binary in bazel, and created the appropriate subgraphs, and called the tfcompile binary to ...
0
votes
1
answer
34
views
With Bazel how do I make part of one genrules' source files (e.g. header files) available to another genrule?
Maybe this is a no-brainer and I just didn't get the concept yet.
I have a genrule, basically wrapping an existing make/config workflow to integrate it into a Bazel-based build configuration. In my ...
0
votes
0
answers
37
views
How can I cross compile from linux to windows with clang-cl and windows and bazel?
I'm trying to cross compile a bazel based application from linux to windows, but I can't find the right command line arguments to pass it.
Here's the command line that I've tried:
bazel build --...
0
votes
0
answers
69
views
How to fix `ld: warning: -undefined dynamic_lookup may not work with chained fixups`on macOS M1?
I get always the linker warning
ld: warning: -undefined dynamic_lookup may not work with chained fixups
when building my C++ project with Bazel.
bazel clean && bazel test --config=macos //...
...
0
votes
0
answers
35
views
Include a header file from a third party package to a C++ code in my project
I am trying to include a header file from a third party package to a C++ code in my project. This is how I structured it:
main_repo/
- third_party/some_lib/
- BUILD
- header_file.h
...
1
vote
1
answer
27
views
bazel running out of memory and crashing when running coverage [duplicate]
When running Bazel coverage on service code, it is crashing on Jenkins pods and also local mac. I want to know does Bazel provide any run efficiency flags to be used in these cases where time does not ...
0
votes
1
answer
34
views
How does bazel define C++ macros based on platform
I have a code snippet which supports a few macros based on compilation platform.
For example, if _mm_crc32_u32 is supported then define macro A.
For cmake, check_cxx_source_compiles seems to fit my ...
1
vote
2
answers
72
views
docker containers choosing different networks despite never setting any
I'm having a horrible time with setting up my Docker configuration for my go service. Below is an overview of my setup
go_binary(
name = "main_arm64",
embed = [":server_lib"...
0
votes
1
answer
34
views
With bazel why do I keep fetching wrong build artifacts from the remote cache despite using --define or --action_env?
From what I read (documentation seems to be quite sparse) you can use the --define and --action_env arguments to let Bazel build artifacts with a different 'configuration' and thus (as I would expect) ...
0
votes
1
answer
27
views
How can I optionally override repository dependencies in Bazel?
Is it possible to optionally load a file like "WORKSPACE.user.bazel" from my main "WORKSPACE.bazel" file but only if that file exists?
I'd like to override certain dependencies ...
0
votes
0
answers
38
views
Dockerfile and multiple images (for github codespace)
I am trying to set up a .devcontainer.json file to use in Github Codespace. What I want is to have a container which has the basic python image, plus the bazel image so that I can use bazel without ...
-1
votes
0
answers
61
views
Simple home.html serving with bazel jinja2 and fastapi with uvicorn
This is my folder structure -
src
└-python
└- app
└-templates
└-home.html
└-BUILD
└-main.py
└-run.py
└-BUILD
└-templates
...
0
votes
1
answer
58
views
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3D5919B448457EE0
Err:3 https://storage.googleapis.com/bazel-apt stable InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3D5919B448457EE0
I don't find bazel on ...
1
vote
0
answers
27
views
bazel coverage lcov fails to aggregate coverage reports files with multiple modes set and atomic
Team,
Trying to figure out how can I set covermode when running bazel coverage?.
how can mode (-covermode) (applicable to test not coverage ) be forced set such that mode is unique across reports for ...
1
vote
0
answers
32
views
bzlmod: dealing with external dependencies with no MODULE.bazel
I would like to use bzlmod as I am in the process of splitting a project into different modules and thought it would be a great way to solve the transitive dependencies.
However, not all project have ...
0
votes
1
answer
24
views
proto import file not found (project was managed by bazel), How can I set the import path correctly?
I use bazel to manage my project and I want to generate protobuf files by bazel build. Here is my file path tree:
There are two problems:
How to make geometry.proto import matrix.proto (in the same ...
0
votes
0
answers
52
views
Code coverage for Python using Bazel 6.0.0
I want to generate a code coverage report using Bazel for a Python project (my environment: macOS Ventura, M1 arm64, Python 3.10, Bazel 6.0).
The documentation states that for this task Bazel 6.0 and ...
0
votes
1
answer
34
views
Bazel rules with unknown output filenames
I have a command that compiles and runs a program, but the intermediate files are randomly named (but contained within a directory). E.g.
build foo.src bar.src -o output_dir
run output_dir
Bazel ...
0
votes
0
answers
41
views
glog symbols different in different machines
I'm using bazel to import third-party libraries, which includes glog.
The workspace looks like
def glog_workspace():
http_archive(
name = "com_google_glog",
sha256 = &...
1
vote
0
answers
42
views
Fixing includes with Bazel
I am trying to fix includes with a local copy of openssl with bazel 5.0 on Mac using the clang compiler.
The file structure is as follows.
WORKSPACE
external
openssl
libcrypto.a
libssl.a
...
0
votes
0
answers
64
views
Stuck at Building Android App using Bazel
I am following the guide to build android using Bazel (https://bazel.build/start/android-app) but unfortunately I am stuck at excuting build command.
I am running in windows 10, tried Bazel versions 6....
0
votes
1
answer
54
views
bazel genrule cmd that needs a filename
I am trying to run objcopy --redefine-syms=filename command in Bazel genrule.
My idea is: first create the filename using echo command in the first genrule, and use the filename in objcopy command in ...
0
votes
1
answer
28
views
VSCode keeps trying to use GOROOT despite being a go module
I've created a new Go project and am trying to use VSCode. I have a go.mod in the parent directory with the following:
module main
go 1.19
I created the project with Bazel and Gazelle, and can ...
0
votes
1
answer
32
views
Bazel test size: Local dev box vs CI?
I have some tests that give me on my local workstation the following Bazel WARNING:
WARNING: //okapi/rendering/sensor:film_test: Test execution time
(25.1s excluding execution overhead) outside of ...
1
vote
2
answers
76
views
What's the difference between Bazel's py_library and py_binary rules
Bazel's documentation explains how to use each, but I don't understand the difference in their nature. Aren't all python files executables anyway? What difference does it make to specify it is a ...
0
votes
0
answers
22
views
How to create a WAR in Bazel?
I have a Java project that has multiple subprojects. It currently uses gradle however we are now trying to move to Bazel.
How can I create a WAR file using Bazel build?
Could not find any example ...
2
votes
2
answers
81
views
How to use bazel for google test
I'm trying to use bazel for my project.
I'm following the tutorial (http://google.github.io/googletest/quickstart-bazel.html).
~/gtest-playground$ ls -lR
.:
total 8
-rw-rw-r-- 1 name name 296 Jan 1 ...
0
votes
0
answers
61
views
Dynamically linking against standard library MinGW
one thing I haven't been able to work out running with bazel is using libstd dynamically
that is, using
libstdc++-6.dll
I have to manually copy this into the bazel-bin in order to use it. I was hoping ...
0
votes
0
answers
49
views
How can I access the Bazel Cache Directory in a .bzl file?
For some background, my specific use case is actually in Rules Python's compile_pip_requirements rule. I do not want to use the default caching location for pip packages, so I am passing args to pip ...