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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

Compile tensorflow 2.14 with clang16.0.2, cannot link the standard C++ library

I am trying to build the most simple tensorflow 2.14(CPU only) with clang 16.0.2(from the official repo) based on docker and ubuntu 22.04. I have successfully built tensorflow r2.12 and r2.13 but not ...
Xuxinyi's user avatar
  • 43
0 votes
0 answers
64 views

Building OpenCV with Bazel rules_foreign_cc

I want to integrate OpenCV in my Bazel workspace through rules_foreign_cc and I found this other stack overflow thread that discusses the general setup very well. I followed the setup resulting in a ...
user1638795's user avatar
0 votes
0 answers
17 views

How to use Bazel to build ELF file for linux?

I'm new to Bazel, but I want to use Bazel to build my python codes to an ELF file (currently I'm building it to .par file). The purpose is to build an ELF file so that we can launch the program by ...
Ames ISU's user avatar
  • 199
1 vote
0 answers
21 views

Is there a way to find out which actions constitute a cache hit or miss?

I am trying to gain insights into which actions constitute a cache hit or miss during a bazel build. Not only that, but also whether they are "remote cache hit", "local", "...
JustARandomProgrammer's user avatar
0 votes
0 answers
38 views

Bazel test with expect_failure = True and "bazel cquery //..." failure

I use Bazel and bazel_skylib for test. There are a few targets that should fail and I test it with expect_failure = True and all work correctly. Also, the target that fails is marked tags=["...
Denis Zheltikov's user avatar
0 votes
1 answer
18 views

Can I create a BUILD file that can reference and run several tests?

I have a python project with unit tests (unittest module) organized like this: ./WORKSPACE ./test/topic_a/BUILD ./test/topic_a/class_name_a_test.py ./test/topic_b/BUILD ./test/topic_b/...
gph's user avatar
  • 1,127
0 votes
1 answer
35 views

How to add Bigtable dependency in golang using Bazel

I have simple go program where I want to import and use bigtable sdk. database.go import ( "context" "cloud.google.com/go/bigtable ) func (s *Store) readRow(ctx context.Context) { ...
user825828's user avatar
0 votes
1 answer
125 views

Link errors when trying to create a c++ binary depending on ITK libraries using bazel (undefined references)

So I'm working on a project where I have the following, simplified structure ./ ┗━ utils ┗━ BUILD ┗━ tool1 ┗━ BUILD ┗━ itk.BUILD ┗━ WORKSPACE in essence i'm trying to build a binary tool1 that ...
xoreaxeax's user avatar
0 votes
1 answer
48 views

How can I fix a build error with @bazel_tools//tools/android:databinding_annotation_processor

I downloaded the Bazel "Build an Android App" tutorial from: https://bazel.build/start/android-app and modified the targetSdkVersion to 33 and it built fine with Bazel. I then switched the ...
Maruchan's user avatar
0 votes
0 answers
31 views

bazel build error "Server terminated abruptly (error code: 2, error message: Stream removed)"

"build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="C:\Users\foem9\AppData\Local\Programs\Python\Python39\python.exe" mediapipe\examples\desktop\hello_world&...
foem 954's user avatar
-1 votes
0 answers
27 views

How can i control the "whole-archive" config when Build with Bazel?

When use cc_shared_library rule which deps two targets a and b, the Bazel default export all symbols from a and b, which is not what i need. The problem is that if i export all symbols there will be a ...
cppsohard's user avatar
0 votes
0 answers
12 views

Bazel `cmake` cannot download repo itself but manually retrying outside works?

I am trying to build a repo that is a CMake project, but I use Bazel. To do this, I use rules_foreign_cc and specify the BUILD file for the repo as follows: load("@rules_foreign_cc//foreign_cc:...
Victor M's user avatar
  • 690
0 votes
0 answers
30 views

how can i make the android sdk a first class dependency in bazel?

I dislike having to download and maintain the Android SDK outside of my Bazel workspace. It seems like it could and should be a first class dependency within Bazel itself, managed in WORKSPACE (or ...
Brian's user avatar
  • 161
0 votes
0 answers
21 views

IF(<variable>) definition

I am trying to understand what this code means in the following cmake file: if(_ONNXRUNTIME_EMBEDDED) set(ONNXRUNTIME_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../include/onnxruntime/core/session) set(...
Victor M's user avatar
  • 690
0 votes
0 answers
20 views

Passing command line result into BUILD file

I am trying to build an external repo by defining a custom BUILD file that uses the cmake rule. As a part of this, I need to pass in an environment variable that contains the location of another ...
Victor M's user avatar
  • 690
0 votes
0 answers
32 views

How to create `py_extension`s with common shared libraries containing singleton variables using Bazel?

I am trying to use Bazel to create two native Python modules that share a large set of existing libraries (LLVM and MLIR) -- including static variables that must be singletons across the two ...
ingomueller.net's user avatar
1 vote
1 answer
24 views

What does 'tests too big' warning in bazel mean?

I frequently get this message while running bazel test //... There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these ...
pdeva's user avatar
  • 44k
0 votes
0 answers
23 views

Adding Conda Python libraries to cc_binary in Bazel to embed Python via Pybind11?

I am trying to embed Python into a C++ application using Pybind11. I have added Pybind11 into my Bazel distribution, similar to what is described here in the Pybind11 Bazel repo. My project is ...
Victor M's user avatar
  • 690
0 votes
1 answer
18 views

How to patch additional build commands to third party CMake-only library built within BAZEL project?

I want to use one third party library in my bazel project. As of today, library is buildable only with CMake system. I am fetching the source code of the library via http_archive rule, and building it ...
ladybugbyte's user avatar
0 votes
0 answers
24 views

How to configure eslint in Bazel environment for typescript project

Tried configuring as below: load("@npm//eslint:index.bzl", "eslint_test") eslint_test( name = "eslint", config = "//ui/web:.eslintrc.js", ) Ran command: bazel ...
Mithun Shreevatsa's user avatar
0 votes
0 answers
34 views

Undefined symbol: `stdout` with picolibc - despite the symbol being defined in my startup code (only with LTO)

I'm trying to convert an embedded project from CMake (via a brief detour to meson) to Bazel. We are using the llvm-embedded toolchain which uses picolibc. I manually setup the toolchain more or less ...
burnpanck's user avatar
  • 2,007
-2 votes
0 answers
64 views

library 'ssl' not found

ld: library 'ssl' not found clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command '/usr/bin/clang' failed with exit code 1 -------------------------------...
Rohit Singh's user avatar
0 votes
1 answer
39 views

Proto import from another project in Bazel

My directory structure is as follows: ├── proto │   ├── BUILD │   └── hello.proto ├── src │   ├── BUILD │   └── outer.proto └── WORKSPACE The proto/hello.proto file: syntax = "proto3"; ...
tinkerbeast's user avatar
  • 2,029
0 votes
0 answers
35 views

http_archive: Build file is not a regular file

Source Code: https://github.com/abitofhelp/hellobzlmod.git Hello, I am fairly new to Bazel & Gazelle and am creating a simple proof-of-concept app. It is the ubiquitous "hello world" ...
A Bit of Help's user avatar
0 votes
1 answer
40 views

Bazel re-export headers in a cc_library from it's dependencies to pass `layering_check`

I'm trying to Bazel-wrap a vendor-provided SDK for an embedded project. Part of that SDK includes a hardware abstraction layer (HAL), which has a set of identically named C headers and sources, ...
burnpanck's user avatar
  • 2,007
1 vote
0 answers
96 views

Building PyTorch as a submodule of larger project with Bazel results in invalid file paths

I have a project I need to build using Bazel, and I need the PyTorch libraries for C++. After a lot of trial and error, I've resorted to including PyTorch's source as a submodule. This is because I ...
Victor M's user avatar
  • 690
0 votes
0 answers
28 views

Can I set value of an outgoing bazel transition based on properties of the dep?

I would like to propagate a custom build setting from a set of bazel targets to some of their transitive dependencies. In other words, I would like a target to say "use X variant of Y library&...
PeculiarOrbit's user avatar
0 votes
1 answer
33 views

Is there a simple way to package up everything bazel builds?

I have a Bazel project with a mix of C++, Java and Python and I want to package up everything that gets built "properly" (currently I'm scp-ing the bazel-bin directory around). What is the ...
digitalPhonix's user avatar
0 votes
0 answers
25 views

Trying to call bazel within CMake in execute process

I am trying to call bazel inside my cmake file in a execute process like so: execute_process( COMMAND ${BAZEL} run ${TENSORFLOW_PATH} -- --common_tflite_path=${...
ben user 10's user avatar
0 votes
1 answer
86 views

How to configure a header based on the sources that include it in bazel?

I want to have a target that has such defines attribute that changes based on the current package I'm in. Something along the lines: A.BUILD: cc_library( name = "A", hdrs = ["...
cppbest's user avatar
  • 79
0 votes
1 answer
46 views

how to check if bazel installed in my machine?

I have installed bazel on Ubuntu and I am writing a bash script that contains a function that checks if bazel is already installed or not. I do not know how to invoke this. Can someone help on that? ...
ic_Engineer's user avatar
0 votes
0 answers
16 views

External repo cannot find SDL.h in Bazel

I am trying to run a successful build on my project using Bazel. Currently, I have the following external libraries I define in the following BUILD file: load("@rules_cc//cc:defs.bzl", "...
Victor M's user avatar
  • 690
0 votes
1 answer
30 views

no such target '//external:protocol_compiler': target 'protocol_compiler' not declared when I use bzlmod to compile proto

MODULE.bazel module( name = "proto_test" ) bazel_dep(name = "grpc", version = "1.41.0", repo_name = "com_github_grpc_grpc") BUILD: load("@...
hole's user avatar
  • 31
0 votes
0 answers
21 views

How to add Bazel BUILD rules for open telemetry protos?

I am trying to add BUILD rules for Open telemetry logs and metrics protos. I am not too familiar with Bazel, hence struggling to figure out how to add relevant http_archive() and load dependencies for ...
Tarak Mehta's user avatar
3 votes
1 answer
93 views

Bazel unable to build go targets (version 1.21) due to new workspace mode

What version of rules_go are you using? 0.42.0 What version of gazelle are you using? 0.33.0 What version of Bazel are you using? 6.4.0 Does this issue reproduce with the latest releases of all the ...
John Jackson's user avatar
0 votes
0 answers
40 views

Using Bazel module extensions in BUILD files?

I am trying to add Github repo dependencies, which aren't Bazel projects themselves, to a Bazel build by following this doc. How does one use module extensions in Bazel to link external Github repos? ...
Victor M's user avatar
  • 690
0 votes
0 answers
60 views

How to avoid rebuilding while using bazel transitions to build multiple targets each with different configurations at once?

I need to build multiple targets with one invocation each with different target architectures. I am using bazel transitions. It works as expected. When try to build the same targets individually with ...
Dhanalakshmi Durairaj's user avatar
0 votes
0 answers
40 views

How to use copt, per_file_copt and action_env in bazel transitions?

I am struggling to configure copt, per_file_copt and action_action in transitions. I try to configure action_env, copt and per_file_copt in .bzl file as follows: def _impl(settings, attr): _ignore = (...
Dhanalakshmi Durairaj's user avatar
0 votes
0 answers
73 views

Bazel builds defaulting to Visual C++ instead of mysy2 mingw64 (windows 11)

I am trying to build with Bazel and would like to force the build to use mingw gcc/g++ compiler, but Bazel defaults to using Visual C++ to compile protobuf files though I do not have VC installed. I ...
Rohit Mundat's user avatar
0 votes
0 answers
39 views

How can I do memory profiling and debugging on my macos m2 max with clang/llvm on bazel?

I can't use Valgrind and gperftools tools because of the macOS arm architecture. Unfortunately I can't find errors due to segment and memory leaks because I can't debug and memory profiling. I also ...
BURAK ŞENTÜRKK's user avatar
0 votes
0 answers
56 views

import matplotlib.pyplot as plt generating tkinter failure when used with bazel

I am trying to use matplotlib in a python script with Bazel. When doing import matplotlib.pyplot as plt I get the error File "/home/usr/.cache/bazel/_bazel_usr/5d92cd43b40817a708cea90464c6d466/...
roschach's user avatar
  • 8,590
0 votes
0 answers
34 views

Bazel oci_pull fails on 401 for Beam Python SDK

I want to build an Apache Beam SDK image like this: oci_image( name = "move_data_worker_image", base = "@beam_python", entrypoint = [ "/opt/apache/beam/...
Tony Liao's user avatar
0 votes
0 answers
18 views

Prevent Bazel dependency tracking through a select

I want bazel query 'deps(//MyLib)' to be empty when my_setting is not set given the following build file: name = "my_setting", values = { "a": "b" }, ) cc_library( name =...
Andreas Pasternak's user avatar
0 votes
1 answer
65 views

Reference environment variables in Bazel oci_image entrypoint

I'm trying to build a Docker image using Bazel's rules_oci like this: oci_image( name = "move_data_image", base = "@python_base", entrypoint = [ "/opt/python/dataflow/...
Tony Liao's user avatar
0 votes
1 answer
45 views

If I want to compile a dynamic library through gcc, do I need to use - static? What is the difference between with '-static' and without '-static'

What is the difference between with -static and without -static when I use gcc to compile a shared library with -static I got an error /usr/sbin/ld.gold: error: /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/...
geek123's user avatar
  • 19
0 votes
0 answers
77 views

Android kernel 5.15/6.1 for emulator

I'm struggling with making the Linux kernel for the android emulator. I'm working on Android 14/kernel 6.1 now, but the same issues occur with Android 13/kernel 5.15. My aim is to add few kernel ...
Kaskader's user avatar
  • 191
0 votes
1 answer
64 views

if some .c file include other .c file, what can i do to build a shared_library? There is no hdrs in the rules of cc_binary

My project was compiled with cmake before, i want to use bazel to rebuild my project, but some error occurred. There is a .c file containing the following code #define XXX #include "ABC.c" #...
geek123's user avatar
  • 19
0 votes
0 answers
46 views

import CMake project to Bazel project

I have project in Bazel wchich required https://github.com/Kistler-Group/sdbus-cpp/tree/master (dbus,CMake,Bazel,linux) to work, but this library is written using CMake, how can I attach it to my ...
Mateusz Krajewski's user avatar
1 vote
0 answers
46 views

Use bazel to build the project If multiple modules have dependencies on each other, is there a way to compile them separatel?

This project was previously built using CMake. Currently, I am rebuilding the project through bazel. There are multiple modules that have dependencies on each other. Is there a way to compile it into ...
geek123's user avatar
  • 19
0 votes
0 answers
31 views

java.lang.UnsatisfiedLinkError: com.google.devtools.build.lib.unix.ProcessUtils.getpid

I am facing below issue with Bazel Info command -> $bazel info ...
rishi007bansod's user avatar

1
2 3 4 5
66