How to achieve reproducible builds?


I have been trying to get some reproducibility into my builds. In particular I’ve been looking for ways to scrub the binaries to ensure they do not contain paths to directories from the system building the code. I have been focusing on one of my dependencies so far. In particular nccl, but the same problem appears to extend to anything using cuda kernels, such as tensorflow.

For C/C++ code the typical approach to this would be to specify a flag such as -ffile-prefix-map as documented here, however when trying to specify this option for nvcc as such: -Xcompiler '-ffile-prefix-map=...', I get an error about an unsupported option.

Given that nvcc is using gcc 7 under the covers, it is not that surprising that the option fails to work, however I’m left without no clear path forward. How can I scrub the binaries of irrelevant paths?