Bazel compilation database generation testing
- Need a linux machine. Mine is Ubuntu 22.04
- clang compiler toolchain. I am using version clang-16. Verified that this is an issue with clang-14 as well.
- bazel. You can install bazel using following
-
sudo wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-$([ $(uname -m) = "aarch64" ] && echo "arm64" || echo "amd64")
-
sudo chmod +x /usr/local/bin/bazel
git clone https://github.com/stonebrakert6/echo_bazel && cd echo_bazel
./setup_clang.sh <PATH_TO_CLANG_LLVM_DIRECTORY>
e.g ./setup_clang.sh /home/stonebrakert6/build/llvm
bazel build --verbose_failures --subcommands //main/...
./bazel-bin/main/a.out
bazel run :refresh_compile_commands
cp compile_commands.json `bazel info output_base`
clangd --log=verbose --check=external/com_google_tcmalloc/tcmalloc/tcmalloc.cc