Skip to content

Conversation

@smcallis
Copy link
Contributor

@smcallis smcallis commented Oct 4, 2025

Enables ASAN builds with e.g. bazel -c opt --config=asan

@jmr jmr changed the title Add config for ASAN builds with bazel. .bazelrc: Add ASan config Oct 5, 2025
Copy link
Member

@jmr jmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this to bazel.yml would be good, too, but can also be done separately.

src/.bazelrc Outdated
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -D_GLIBCXX_SANITIZE_VECTOR
build:asan --copt -O1
build:asan --copt -g
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of these seem orthogonal and part of -c dbg.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can theoretically use this with -c opt or -c fastbuild too, it's probably wise to override them because if you have e.g. -O3 on and the compiler elides problematic reads/writes then you'll get false negatives.

Enables ASAN builds with e.g. bazel -c opt --config=asan <targets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants