3 ms·
The code has to be changed so that things like system specific paths, time of compilation, hardware, etc. Don’t cause the compiled program to be unique to that
by twisrkrr 5y ago
The code has to be changed so that things like system specific paths, time of compilation, hardware, etc. Don’t cause the compiled program to be unique to that computer (meaning compiling the same code on a different computer will give you a file that still works but has a different md5 hash)
By being able to reproduce the file completely, down to identical md5 hashes, you know you have the same file the creator has, and know with certainty that the file has not been tampered with
- secondcoming 5y agoDoes this mean that the code cannot be built with CPU specific optimisations (march option with gcc)
- Avamander 5y agoPretty much. But hopefully x86_64 feature levels will provide the benefits of native builds to a reasonable extent.
- Denvercoder9 5y agoThe software doesn't suddenly become incompatible with CPU-specific optimisations (or many other compiler flags that change its output), but if you do so, you won't be able to reproduce the distribution binaries. Distributions don't enable CPU-specific optimisations anyway, since they want to be usable on more than one CPU model.
- pas 5y agoLikely it means that with the same input arguments the end result is bit-by-bit identical. (As I understand the problems were hard to control output elements. So it was not enough to se the same args, set the same time, and use the same path and filesystem, because there were things that happened at different speeds, so they ended up happening at relative different elapsed times, so the outputs contained different timestamps, etc.)
- clhodapp 5y agoNo, just that you need to avoid naively conflating the machine that is doing the compilation with the one that optimization is being performed for. Concretely, you would need to keep track of and reproduce e.g. the march flag value as a part of your build input. If you wanted to optimize for multiple architectures, that would mean separate builds or a larger binary with function multi-versioning.
- maartenh 5y agoNixpkgs contains the build / patch instructions for any packages in NixOS. If you want to compile any piece of software available in Nixpkgs, you can override it's attributes (inputs used to build it). One can trivially have an almost identical operation system to your colleagues install, but override just one package to enable optimisations for a certain cpu. This would however imply that you'd lose the transparent binary cache that you could otherwise use. Exactly this method is used to configure the entire operating install! Your OS install is just another package that has some custom inputs set.