bazelisk | A user-friendly launcher for Bazel
kandi X-RAY | bazelisk Summary
kandi X-RAY | bazelisk Summary
Bazelisk is a wrapper for Bazel written in Go. It automatically picks a good version of Bazel given your current working directory, downloads it from the official server (if required) and then transparently passes through all command-line arguments to the real Bazel binary. You can call it just like you would call Bazel.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bazelisk
bazelisk Key Features
bazelisk Examples and Code Snippets
def retrieve_bazel_version():
"""Retrieve installed bazel version (or bazelisk).
Returns:
The bazel version detected.
"""
bazel_executable = which('bazel')
if bazel_executable is None:
bazel_executable = which('bazelisk')
if ba
Community Discussions
Trending Discussions on bazelisk
QUESTION
I apologise if the title is a bit vague - I didn't know how else to phrase it.
I am quite new to Bazel but one thing that I don't quite understand is why my program fails to find the resource files I specify using the data attribute for the cc_binary rule
For context I am trying to follow Lazy Foo's SDL2 tutorials and I have a directory structure somewhat like this
...ANSWER
Answered 2022-Apr-11 at 19:07Use the C++ runfiles library to find them. Add the dependency in your BUILD file:
QUESTION
I am trying to use Bazel to rebuild Tensorflow with compiler flags, but have been getting errors.
In the documentation explaining how to build Tensorflow from the source, they say that Bazelisk will download the correct version for Tensorflow... but when I was getting the errors, I decided to check the Bazel version and it said 4.2.2 (which is the latest version). The tested builds the Bazel version is only 3.7.2 for 2.7 version of Tensorflow (which is what I am using)...
Is there a way to use Bazelisk to install version 3.7.2? Or do I have to manually download Bazel and add it to the path?
- If so, how do I do it? The way I installed it before was just downloading and running the
.exe
file from the website... and there wasn't any opportunity to enter a version for Bazel... - If not, how do I uninstall Bazelisk? I tried looking for a way to uninstall, but couldn't find anything...
ANSWER
Answered 2021-Dec-08 at 08:05Bazelisk will look in the WORKSPACE
root for a file named .bazelversion
(see here). This file is supposed to contain the Bazel version number you want to use.
There are also other options to tell Bazelisk which version to use: How does Bazelisk know which Bazel version to run?
To use for instance Bazel 0.26.1 you can Bazelisk this way:
QUESTION
I'm running Bazel (via Bazelisk) in CI and struggling to get reasonable output from builds. I'd like to see the result of all tests and/or targets in the output (even if they were completed by the cache) so developers can be sure the thing they've written is being tested.
The most obvious thing would be to set the --show_task_finish
flag, but unfortunately that flag doesn't seem to work. I haven't found any flag that will reliably print out the results of tests or targets. I unfortunately cannot print stdout/stderr from tests that pass as they generate too much output.
For example, some slightly redacted output I encountered recently is nearly completely useless if I want to be sure a specific target was tested:
...ANSWER
Answered 2021-Sep-28 at 21:46It looks like with --test_summary=detailed
, Bazel prints information only about failed tests: https://docs.bazel.build/versions/main/command-line-reference.html#flag--test_summary
Using the default value of short
for --test_summary
gives all the targets:
QUESTION
I am trying to build Hello World example of Mediapipe in C++. These are my exports in .bash_profile:
...ANSWER
Answered 2021-Sep-21 at 15:57mediapipe depends on an old version of abseil c++ that does not include a commit necessary to work on newer libstdc++
versions. So, com_google_absl
in the mediapipe WORKSPACE needs an update.
QUESTION
I am trying to build the pip package for a certain 2.x version detailed here.
After running:
...ANSWER
Answered 2021-Sep-20 at 15:08It could be either because python
is not installed, or it is not linked to /usr/bin/python
. The latter can be fixed by sudo ln -s /usr/bin/python3 /usr/bin/python
.
QUESTION
I'm runnig Bazel remote cache from https://github.com/buchgr/bazel-remote inside docker, by runnig the following commands to start the http and grpc server:
...ANSWER
Answered 2021-Aug-10 at 20:43For grpcs, your problem is the hostname the client is using doesn't match the certificate. When I connect to localhost
(like those directions default to), it works:
QUESTION
I'm trying to build the TensorFlow Lite C library on MacOS 11.4. I need the built library to be able to run on MacOS 10.13 or newer. However, something in the build toolchain sets the target OS to 11.3, so that the full compile commands printed by -s
look like this
ANSWER
Answered 2021-Jul-02 at 15:37The way that works is Bazel command line option --macos_minimum_os
(or related --macos_minimum_os
).
It's right there in the documentation if you know what to search for, but apparently not discoverable by Google. I found it by reading Bazel source.
QUESTION
I'm trying to build an app on Ubuntu 20.04, where python3 points to Python3.8, and I'm building aganist Python3.6
I have the following runtime in the same directory of WORKSPACE.
...ANSWER
Answered 2021-May-15 at 02:49py_runtime
usually must be used with py_runtime_pair
and toolchain
. See the example in the py_runtime_pair
documentation. That example, slightly modified to apply to the OP would look like:
QUESTION
There is simple cgo project available on this page. It relies on pre-built c shared library and it works great when using go build
, with minor changes to make it buildable.
I wanted to use Bazel for the same thing.
Used source code is same as on this github link, without using hello.c file. With all said, final code looked like below.
...ANSWER
Answered 2021-Mar-03 at 00:05are c libraries built automatically? My assumption is that those are not.
Why? Tests from the offical repo shows, that it is done automatically
is it possible to use cc_library rule to build shared library that can be used in cgo? if so, how to connect those?
See example from here
QUESTION
I've been able to make a fair amount of progress in trying to add Bazel build files to enable the building of the gennorm2 tool in ICU. Here is my work-in-progress PR using the Bazel target //icu4c/source/tools/gennorm2
.
I'm currently getting stuck when running bazelisk build //icu4c/source/tools/gennorm2 --verbose_failures --sandbox_debug
with these errors.
They reference functions defined in urename.h
. As I understand it, urename.h
is also used to rename certain functions by appending a suffix with the version number (_68
), but I defined a preprocessor constant U_DISABLE_RENAMING
to disable that specific behavior. This only had the effect of changing the names of the undefined function names in the error output, but otherwise not changing it (ex: errors now complain of u_errorName
instead of u_errorName_68
).
The part that puzzles me is why the error output claims that these symbols are not found. As you can see, the target //icu4c/source/tools/gennorm2
depends on //icu4c/source/common:platform
, which in turn depends on //icu4c/source/common:headers
, which includes the field hdrs = glob(["unicode/*.h", "unicode/*.h",])
, which should be matching
/icu4c/source/common/unicode/urename.h
.
In case it helps, this is the verbose log output when running make VERBOSE=1
using the current autotools-based configure + make build on a fresh checkout of ICU.
ANSWER
Answered 2021-Feb-11 at 17:51A teammate was able to take a look and help me reason through the errors and ultimately fix them.
The first thing is to acknowledge that it is indeed a linker error, which can see by noticing the error message references the linker program ld
.
This is important because we previously spent time in the wrong place by debugging the compile configs as if the problem happened during the compile phase before the linker phase. (But I learned about one way to debug compile problems is taking the raw GCC command given by --verbose_failures --sandbox_debug
and replacing -c
with -E
and changing the argument of -o
to a .txt file in /tmp to save the output what the compiler sees for that file after all the includes are recursively inlined). This means that my attempts to solve the problem by specifying preprocessor defines for the compile-phase were misguided.
The project's documentation on dependencies revealed that I had mis-specified a dependency on one of the targets to specify only the headers (//icu4c/source/common:headers
) instead of the relevant definitions and headers (//icu4c/source/common:platform
).
After doing that, we solved another problem that was small and interesting. The gennorm2
target depends on code to get the current year (ex: for printing out help messages that include the copyright statement with the year range). As an i18n library, ICU has code to get that, somewhere in //icu4c/source/i18n:icu4ci18n
. This creates an excessive amount of code dependencies for an isolated use case (and will cause problems for follow-on work), so we replaced the block of code in gennorm2
calling those calendar year fns (ucal_open
, ucal_getNow
, ucal_setMillis
, ucal_get
, ucal_close
) with the libc date library function to give us the year as a number, and added linkopts = ["-ldl"]
to link in the dl
date library.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bazelisk
Install it as the bazel binary in your PATH (e.g. copy it to /usr/local/bin/bazel). Never worry about upgrading Bazel to the latest version again.
Check it into your repository and recommend users to build your software via ./bazelisk build //my:software. That way, even someone who has never used Bazel or doesn't have it installed can build your software.
As a company using Bazel or as a project owner, add a .bazelversion file to your repository. This will tell Bazelisk to use the exact version specified in the file when running in your workspace. The fact that it's versioned inside your repository will then allow for atomic upgrades of Bazel including all necessary changes. If you install Bazelisk as bazel on your CI machines, too, you can even test Bazel upgrades via a normal presubmit / pull request. It will also ensure that users will not try to build your project with an incompatible version of Bazel, which is often a cause for frustration and failing builds. (But see the note below about ensuring your developers install Bazelisk.)
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page