build: per-sanitizer build dirs to avoid reconfigure churn#22
Closed
battlesnake wants to merge 1 commit into
Closed
build: per-sanitizer build dirs to avoid reconfigure churn#22battlesnake wants to merge 1 commit into
battlesnake wants to merge 1 commit into
Conversation
All sanitizer flavors shared one platform build dir (eg 'linux'), so
switching asan<->tsan<->none forced a full CMake reconfigure (and the
occasional stale-mix build failure). Suffix the build dir per sanitizer
('linux-asan', 'linux-tsan', 'linux-ubsan', 'linux-lsan') in the two
funnels that pick it. No sanitizer keeps the old name, so existing
caches stay valid; first build of each flavor after upgrade configures
once into its new dir.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Superseded by #23 — moved off the fork to a branch on this repo, and adds coverage build-dir separation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
All sanitizer flavors write to the same platform build dir (
packages/<pkg>/linux,windows, …).self.sanitizeisn't part of the build path, so switching betweenasan/tsan/ubsan/ none reuses one dir with a different sanitizer than it was configured for.run_config()then sees the sanitizer marker changed and forces a full CMake reconfigure every switch — slow, and occasionally a stale-mix build failure.Fix
Suffix the build dir per sanitizer, reusing the existing CLI short tokens:
--sanitizelinux(unchanged)addresslinux-asanthreadlinux-tsanundefinedlinux-ubsanleaklinux-lsan(and the same for every platform:
windows-asan,android-tsan, …)One
build_dir_suffix()helper, applied in the two places that pick the per-platform name:platform_build_dir_name()anddependency_chain._save_mama_cmake'sget_build_dir_defines(kept in sync per the existing WARNING comment, so dependencymama.cmakeinclude paths match the suffixed dep dirs). No sanitizer ⇒ no suffix ⇒ existing caches stay valid. Each flavor now keeps its own dir +CMakeCache.txt, so switching between already-built flavors no longer reconfigures.Verification
Added
tests/test_build_dir/asserting the per-sanitizer names and that no-sanitizer is unchanged. Full existing suite (85 tests) green.Ran the patched mama against a throwaway CMake project:
build asanthenbuild tsancreate separatelinux-asan/linux-tsandirs with the rightenabled_sanitizers; re-running each already-built flavor skips CMake configure (no churn); plainbuildstill useslinux.Back-compat note
First build of each sanitizer flavor after upgrading mama configures once into its new suffixed dir (the old shared
linuxdir keeps the no-sanitizer build). Expected, one-time.