Bazel build with LLVM_ENABLE_ASSERTIONS

I am trying to figure out how to enable LLVM assertions with Bazel. After having spent some time reading through the Bazel files I still have not figured it out. If anybody could give me a hint, then that would be appreciated :slight_smile:

Add --copt=-UNDEBUG on the command line?

Oh, is it as simple as just changing whether NDEBUG is defined or not? I was of the impression that LLVM assertions were separated from the normal C assertions. Thanks.

There are a few settings in LLVM that can have different default in an asset build and CMake generates indeed some config.h files: https://github.com/llvm/llvm-project/tree/main/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config
This hasn’t been setup in Bazel and they are hardcoded here, but assertions are just regular ones.

1 Like