Hasty Briefsbeta

Reproducible C++ builds by logging Git hashes

9 days ago
  • #C++
  • #Reproducible Builds
  • #Version Control
  • The author discusses the challenge of tracking which version of a program produced specific outputs, especially during rapid development.
  • Proposes using git commit hashes to identify the exact code version used to generate outputs, ensuring reproducibility.
  • Details a method to embed the git commit hash into C++ programs at compile time using a custom script and CMake integration.
  • Addresses the issue of uncommitted code by appending '-dirty' to the hash and providing a warning when running uncommitted changes.
  • Suggests potential improvements like tracking dirty files, filtering relevant source changes, and including richer build information.