A collection of C++/Java opensource projects with BUILD files so they can be easily built with bazel.
To try:
$ git clone https://github.com/mzhaom/trunk && cd trunk
$ git submodule update --init third_party/abseil third_party/protobuf \
third_party/grpc third_party/gtest/github third_party/glog/upstream \
third_party/gflags/upstream third_party/gperftools/upstream \
third_party/libunwind/upstream
$ bazel build //examples/...Building with google/tcmalloc as the allocator additionally needs:
$ git submodule update --init third_party/tcmalloc third_party/re2
$ bazel build --config=tcmalloc //examples:helloNote that --config=tcmalloc is incompatible with //examples/asan:leak,
which links gperftools' heap checker and so brings its own allocator.
Building the folly stack additionally needs:
$ git submodule update --init third_party/folly/upstream \
third_party/fizz/upstream third_party/wangle/upstream \
third_party/proxygen/upstream
$ bazel build @proxygen//:proxygenCurrently C++ projects can be only built on Linux x64 system.
- Bazel — the version in
.bazelversionis what the tree is built and tested with; use bazelisk or run./install-bazel.sh, which reads that file. - A C++20 compiler (gcc >= 11 or clang; gcc 13 is what this is tested
with). Pass
--config=clangto build with a downloaded clang release instead of the system compiler. python3-dev. protobuf builds its python runtime against the system python, so the interpreter headers have to be present:sudo apt-get install python3-dev.
Dependencies are materialized in the tree as git submodules under
third_party/ rather than being downloaded as opaque archives. Bazel 9
dropped WORKSPACE, so this is expressed in MODULE.bazel
with local_path_override: every module listed with an override resolves to
the checked out submodule, never to an archive from the Bazel Central
Registry. Only rule sets and the leaf dependencies of the vendored modules
still come from the registry.
Projects that ship no Bazel build of their own (currently folly, fizz,
wangle and proxygen) are pulled from a fork under
github.com/bazelment whose bazel-<tag>
branch carries the upstream release tag plus the Bazel overlay and patches.
Those four are version locked to each other and have to be bumped as a set.
WORKSPACE.legacy is the pre-bzlmod setup, kept for reference while the
remaining third_party projects are ported.
-
googletest (and googlemock)
-
gperftools heap-checker, heap-profiler and cpu-profiler. Its tcmalloc is superseded here by google/tcmalloc below.
-
google/tcmalloc: the maintained successor to gperftools' allocator, selected by
--config=tcmalloc. -
libevent: version 1
-
folly and the libraries built on it: fizz, wangle and proxygen.
-
A selection of boost modules, mostly for building folly.