Button: A fast, correct, and elegantly simple build system.

H. S. Teoh via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Jun 18 16:52:00 PDT 2016


On Sat, Jun 18, 2016 at 08:46:30PM +0000, Jason White via Digitalmars-d-announce wrote:
> On Saturday, 18 June 2016 at 14:23:39 UTC, H. S. Teoh wrote:
> > > Moral of the story is, if you're writing a compiler, for the sake
> > > of build systems everywhere, make the output deterministic! For
> > > consecutive invocations, without changing any source code, I want
> > > the hashes of the binaries to be identical every single time. DMD
> > > doesn't do this and it saddens me greatly.
> > 
> > DMD doesn't? What does it do that isn't deterministic?
> 
> I have no idea. As a simple test, I compiled one my source files to an
> object file, and ran md5sum on it. I did this again and the md5sum is
> different. Looking at a diff of the hexdump isn't very fruitful either
> (for me at least). For reference, I'm on Linux x86_64 with DMD
> v2.071.0.

I did a quick investigation, which found something interesting.  If
compiling straight to executable, the executable is identical each time
with the same md5sum.  However, when compiling to object files, the
md5sum is sometimes the same, sometimes different.  Repeating this
several time reveals that the md5sum changes every second, meaning that
the difference is a timestamp in the object file.

Maybe we could file an enhancement request for this?


T

-- 
Indifference will certainly be the downfall of mankind, but who cares? -- Miquel van Smoorenburg


More information about the Digitalmars-d-announce mailing list