rsync --exclude build drops src/.../index/build/; anchor the exclude as /build
PitfallVerified 8 Oct 2026Holds project: dftracer-utils
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
On the remote copy, cmake --preset tests ends with CMake Error at cmake/modules/LibraryHelpers.cmake:273 (add_library): Cannot find source file: .../src/dftracer/utils/index/build/chunk_indexer.cpp and CMake Generate step failed.
Cause#
An unanchored --exclude build matches every path component named build, including the source directory src/dftracer/utils/index/build/.
Fix#
Anchor the excludes to the transfer root: rsync -a --exclude=/build --exclude=/.git --exclude=/.cpmsource --exclude=/.venv ./ host:dir/. Check one deep file after the copy before starting a long build.
Evidence#
After switching to --exclude=/build, test -f src/dftracer/utils/index/build/chunk_indexer.cpp on the remote succeeded and the configure and build ran.
Also found by searching
- Cannot find source file src/dftracer/utils/index/build/chunk_indexer.cpp after rsync
- CMake Generate step failed on the remote copy
- rsync --exclude build also skips source directories named build