[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1005794: snibbetracker: reproducible-builds: Build path embedded in debug symbols



Source: snibbetracker
Severity: normal
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org

Different build paths trigger reproducibility issues with binaries such
as /usr/bin/snibbetracker and relevent debugging symbols.

For two builds done with reprotest, the debug symbols contain the
different build paths:

  0  (line_strp)     (offset: 0x0): /tmp/reprotest.lNSnkN/const_build_path/snibbetracker/src
vs.
  0  (line_strp)     (offset: 0x0): /tmp/reprotest.lNSnkN/build-experiment-1/snibbetracker/src


The attached patch fixes this by passing -ffile-prefix-map in
debian/Makefile to avoid embedding the build path into the binaries.


Another option might be to pass COMPILER_FLAGS=$(CFLAGS) to use the
default flags from debhelper/dpkg-buildflags, which includes
-ffile-prefix-map, and/or explore patching the upstream
Makefile to accept variables passed to it...


With this patch applied, snibbetracker should build reproducibly on
tests.reproducible-builds.org!


Thanks for maintaining snibbetracker!


live well,
  vagrant
From d2cb9d8738ad25dcbbe9a0cb2dd8906d86e558e5 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Tue, 15 Feb 2022 02:05:07 +0000
Subject: [PATCH] debian/Makefile: Pass -ffile-prefix-map to remove build
 directory from binaries.

Without this, building the package in a different directory results in
different binaries.

https://reproducible-builds.org/docs/build-path/
---
 debian/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/Makefile b/debian/Makefile
index f053e39..33ccea1 100644
--- a/debian/Makefile
+++ b/debian/Makefile
@@ -14,7 +14,7 @@ INCLUDE_PATHS = -I/usr/include/cjson
 LIBRARY_PATHS = -L/usr/lib/x86_64-linux-gnu
 
 # Compiler flags
-COMPILER_FLAGS = -Wall -std=c99 -Wno-unused-function -g
+COMPILER_FLAGS = -Wall -std=c99 -Wno-unused-function -g -ffile-prefix-map=$(CURDIR)=.
 
 # Linker flags
 LINKER_FLAGS = -lSDL2main -lSDL2 -lm -lcjson -luuid
-- 
2.34.1

Attachment: signature.asc
Description: PGP signature


Reply to: