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.

From the Documentation: Overview:

What is Bazel?

Bazel is an open-source build and test tool similar to Make, Maven, and Gradle. It uses a human-readable, high-level build language. Bazel supports projects in multiple languages and builds outputs for multiple platforms. Bazel supports large codebases across multiple repositories, and large numbers of users.

Why should I use Bazel?

Bazel offers the following advantages:

  • High-level build language. Bazel uses an abstract, human-readable language to describe the build properties of your project at a high semantical level. Unlike other tools, Bazel operates on the concepts of libraries, binaries, scripts, and data sets, shielding you from the complexity of writing individual calls to tools such as compilers and linkers.

  • Bazel is fast and reliable. Bazel caches all previously done work and tracks changes to both file content and build commands. This way, Bazel knows when something needs to be rebuilt, and rebuilds only that. To further speed up your builds, you can set up your project to build in a highly parallel and incremental fashion.

  • Bazel is multi-platform. Bazel runs on Linux, macOS, and Windows. Bazel can build binaries and deployable packages for multiple platforms, including desktop, server, and mobile, from the same project.

  • Bazel scales. Bazel maintains agility while handling builds with 100k+ source files. It works with multiple repositories and user bases in the tens of thousands.

  • Bazel is extensible. Many languages are supported, and you can extend Bazel to support any other language or framework.


Resource


Presentation


Community


Related Plugins

3196 questions
22
votes
3 answers

Given a tensor flow model graph, how to find the input node and output node names

I use custom model for classification in Tensor flow Camera Demo. I generated a .pb file (serialized protobuf file) and I could display the huge graph it contains. To convert this graph to a optimized graph, as given in…
Santle Camilus
  • 945
  • 2
  • 12
  • 20
22
votes
2 answers

How do I check Bazel version?

I am trying to find out which version of Bazel I currently have on my computer to install TensorFlow from source (it requires version 0.1.4) evan@evan-box:~/Apps/tensorflow$ bazel --version Unknown Bazel startup option: '--version'. For more info,…
Evan Pu
  • 2,099
  • 5
  • 21
  • 36
20
votes
1 answer

how to use clang++ instead g++ in Bazel

I want to use clang++ instead g++ to compile my c++ files while g++ is the system's default compiler. I have tried sudo update-alternatives --install c++ c++ /home/guo/bin/clang++ 100 and set CC environment. But they doesn't work. Bazel still uses…
Lanting Guo
  • 795
  • 3
  • 7
  • 21
20
votes
1 answer

How to build a shared library for TensorFlow on Travis-CI

I'm assisting in building a Ruby-wrapper for TensorFlow. Obviously. we'd want to setup automatic test of the project and so I'm currently trying struggling to configure Travis-CI to build the project and run tests like I can on my own machine (OSX…
ChrHansen
  • 1,502
  • 1
  • 14
  • 22
18
votes
3 answers

How to use select to properly detect whether I am building C++ code in Windows or Linux?

I am writing a sample C++ project that uses Bazel to serve as an example idiom for other collaborators to follow. Here is the repository: https://github.com/thinlizzy/bazelexample I am interested to know if I am doing it 'right', more specifically…
thinlizzy
  • 668
  • 8
  • 13
18
votes
2 answers

Why can't brew find a specific known formula?

I'm trying to install bazel on my mac (10.11.5). I can see that it is available through brew: http://braumeister.org/formula/bazel But when I run "brew install bazel", I get this: Error: No available formula for bazel Searching…
anonymouse
  • 639
  • 1
  • 8
  • 18
18
votes
4 answers

Is there a way to force Bazel to run tests serially

By default, Bazel runs tests in a parallel fashion to speed things up. However, I have a resource (GPU) that can't handle parallel jobs due to the GPU memory limit. Is there a way to force Bazel to run tests in a serial, i.e., non-parallel way?…
Shanqing Cai
  • 3,756
  • 3
  • 23
  • 36
18
votes
2 answers

Running a Tensorflow model on Android

I'm trying to figure out the workflow for training and deploying a Tensorflow model on Android. I'm aware of the other questions similar to this one on StackOverflow, but none of them seem to address the problems I've run into. After studying the…
amm
  • 343
  • 3
  • 11
17
votes
1 answer

Bazel Key Expired Error when sudo apt-get update Ubuntu 16.04

I am getting the following error when I do Command: sudo apt-get update Error: Err:10 http://storage.googleapis.com/bazel-apt stable InRelease The following signatures were invalid: KEYEXPIRED 1527185977 KEYEXPIRED 1527185977 KEYEXPIRED…
Manasvini Ganesh
  • 483
  • 5
  • 16
17
votes
4 answers

How to write files to current directory instead of bazel-out

I have the following directory structure: my_dir | --> src | | | --> foo.cc | --> BUILD | --> WORKSPACE | --> bazel-out/ (symlink) | | ... src/BUILD contains the following code: cc_binary( name = "foo", srcs =…
Ani Kristo
  • 335
  • 1
  • 2
  • 9
17
votes
5 answers

How to use Bazel to build project uses OpenCV

What is the best way to build C++ code that uses the OpenCV library using Bazel? I.e., what would the BUILD rules look like? How should be the WORKSPACE and BUILD files look like in order to compile the following code using bazel: #include…
John Zhang
  • 518
  • 1
  • 5
  • 12
16
votes
4 answers

Bazel: How do you get the path to a generated file?

In Bazel, given a build target, how would a script (which is running outside of Bazel) get the path to the generated file? Scenario: I'm using Bazel to do the build, and then when it's done, I want to copy the result to a server. I just need to know…
Mike Morearty
  • 9,953
  • 5
  • 31
  • 35
16
votes
1 answer

Bazel: copy multiple files to binary directory

I need to copy some files to binary directory while preserving their names. What I've got so far: filegroup( name = "resources", srcs = glob(["resources/*.*"]), ) genrule( name = "copy_resources", srcs =…
Sergey Ch.
  • 628
  • 1
  • 7
  • 17
16
votes
4 answers

Decrease bazel memory usage

I'm using bazel on a computer with 4 GB RAM (to compile the tensorflow project). Bazel does however not take into account the amount of memory I have and spawns too many jobs causing my machine to swap and leading to a longer build time. I already…
panmari
  • 3,627
  • 3
  • 28
  • 48
15
votes
1 answer

How to build TensorFlow Lite as a static library and link to it from a separate (CMake) project?

I've successfully built a simple C++ app running TF Lite model by adding my sources to tensorflow/lite/examples, similarly to what the official C++ TF guide suggests for full TF. Now I want to build it as a separate project (shared library) linking…
Andrii Zymohliad
  • 1,237
  • 1
  • 11
  • 17