Reputation: 210745
How do I get MSVC to build reproducibly with debug symbols (/Zi
or /Z7
)?
/Brepro
clearly doesn't work:
> echo int main() { return 0; } > temp.cpp
> cl /nologo /Brepro /Zi temp.cpp && certutil -hashfile temp.exe MD5 > NUL
MD5 hash of temp.exe:
d7fc95fa40dd28f458f059172ebe9451
CertUtil: -hashfile command completed successfully.
> cl /nologo /Brepro /Zi temp.cpp && certutil -hashfile temp.exe MD5 > NUL
MD5 hash of temp.exe:
56b71b75d746449eac6be9cb085edbd8
CertUtil: -hashfile command completed successfully.
Upvotes: 2
Views: 47
Reputation: 210745
It seems passing /Debug:FastLink
to the linker does the job for the final executable (I tested on MSVC 19.43.34808), but it only solves half the problem, because the compiler still produces nondeterministic object files, so it doesn't help for caching the object files etc.
If anyone has a complete solution, please post it.
Upvotes: 0