Boris Kolpackov: > Ximin Luo <infini...@pwned.gg> writes: > >> -I to an absolute path is not that common for system / distro-built >> stuff. > > Ok, thanks for clarifying. > > >> In the cases that it occurs, indeed it could and should be fixed >> by the package buildsystem, e.g. by stripping a prefix when they >> add -I flags to CFLAGS. But that's a separate issue from what >> we're talking about here. > > I believe it is the same issue: any package that blindly embeds > information about how it was built into the result of the build > does not care about reproducible builds. >
I don't think that's realistic position to take, and it seems like a fairly arbitrary assertion made merely to "brush this issue under the carpet". I think this because of the "implicit contract" of how CFLAGS is generally used: CFLAGS (and other flags) is a way to pass information from multiple layers of programs down to GCC. It is necessary to "blindly embed" it if you want to save it *at all*, otherwise you are forced to violate the separation-of-concerns between layers in your buildsystem stack. - Program A sets CFLAGS += --flags_A, then calls program B - Program B sets CFLAGS += --flags_B, then calls program C - Program C sets CFLAGS += --flags_C, then calls Make - Make reads CFLAGS then calls $(CC) $(CFLAGS) [etc] In general, you are not supposed to edit what was already in CFLAGS, you are supposed to append to it. That is why it's good practise to add "--no" options for various command-line flags in gcc (and other tools). So each program X has its own flags_X that it is "responsible for". If all programs in the stack makes sure their own flags_X contain reproducible values, then the whole build will be reproducible even when recording CFLAGS. However, this breaks in the case of -f*-prefix-map. If Program A sets this flag in flags_A, then this interferes with Program C, even though flags_C was fully reproducible. Note that program B and C don't even know that they are being used with GCC, and so really have no business filtering -f*-prefix-map out of the CFLAGS that program A already set. My proposal would allow all the flags_{A,B,C} to be reproducible, and avoid different programs having to embed layer-violating logic into themselves. > If others do agree that this should be "fixed" in GCC, then I > would suggest that you add a separate option for the environment > variable case (e.g., -ffile-prefix-map-env) and sidestep the > whole "how to portably distinguish a path from an environment > variable" issue. > That would also be fine for me sure. X -- GPG: ed25519/56034877E1F87C35 GPG: rsa4096/1318EFAC5FBBDBCE https://github.com/infinity0/pubkeys.git