3 ms·
__FILE__ is pain of my existence, recently contributed this code to run/build ds3os using nix instead of docker, where I hit issues with __FILE__ https://githu
by Cloudef 3y ago
__FILE__ is pain of my existence, recently contributed this code to run/build ds3os using nix instead of docker, where I hit issues with __FILE__
https://github.com/TLeonardUK/ds3os/blob/main/default.nix#L41-L45 https://github.com/TLeonardUK/ds3os/blob/main/default.nix#L4...
- yosefk 3y agoFor unwanted values of __FILE__, you can "refix" these to something reproducible after the build (of the libraries or object files or the final binaries, whichever is easier with the given build flow), if that's your problem (better yet is to remap the path prefix at build time and then "refix" to where the source code really is, but if you don't want that but rather want to remove irrelevant absolute paths and replace them with something deterministic, you can do that, too)
- Cloudef 3y agoYeah, nix's remove-references-to does exactly that, it replaces the prefix with something deterministic (bunch of zeroes IIRC). I know about the gcc (and recently clang's) options to map the prefix, but the command line is annoying to use. Wish there was simply -relative-prefix or something and it would be the default. The nice thing about nix is that it will detect any references to /nix/store path that shouldn't be there and fail the build, so you immediately know if there is reproducibility problem related to the paths.