On 2023-02-07 17:50 +0100, Guillem Jover wrote: > On Tue, 2023-02-07 at 16:41:47 +0100, Stéphane Glondu wrote: >> When building packages, a -ffile-prefix-map option is automatically injected >> into CFLAGS. Where does it come from? Since when? > > This is coming from dpkg-buildflags (in this case probably indirectly > via debhelper). AFAICS it was added in dpkg 1.19.1 disabled by default, > and then switched to enabled by default in dpkg 1.20.6 (see #974087). > >> I suspect this was added to improve reproducibility. Ironically, it makes >> packages that capture this variable non reproducible, since the build path >> seems to be randomized (has it always been the case? since when?). It is the >> case of OCaml (see #1030785), and seemingly of R as well (found by grepping >> in my /etc). I wouldn't be surprised other packages are affected as well. > > AFAIR this was considered at the time, yes. If the flag is effectively > not fixing anything for the set of packages involved, and is in fact > actually making them unreproducible when they would not then, you can > disable the fixfilepath feature in the reproducible build flags area, > via DEB_BUILD_MAINT_OPTIONS.
This does not help for packages which capture all build flags and store them in some file in the package (as is the case here). With DEB_BUILD_MAINT_OPTIONS=reproducible=-fixfilepath, dpkg-buildflags falls back to "-fdebug-prefix-map=<BUILDDIR>=.", and you have the same problem. If you disable that as well via DEB_BUILD_MAINT_OPTIONS=reproducible=-fixfilepath,-fixdebugpath, the -dbgsym packages will most likely end up unreproducible. Cheers, Sven