Source: ga
Version: 5.7.2-2
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: usrmerge
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

libglobalarrays-dev gets different -L paths in the ga-config script,
depending on whether the build happens to have been done on a system
where /usr/lib64 exists.

On Debian systems, /usr/lib64 will normally exist on 64-bit systems that
have merged-/usr (via the usrmerge package or debootstrap --merged-usr),
such as systems that were installed with debian-installer as buster or
later, but will not normally exist on traditional non-merged-/usr systems.

This can be seen on the reproducible-builds.org infra, which uses
non-merged-/usr for "build 1" and merged-/usr for "build 2":
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/diffoscope-results/ga.html

If you have sbuild available, an easy way to reproduce this is to build
for amd64 twice, once with --add-depends=usrmerge and once without.

It is never necessary for Debian packages to use -L/usr/lib or -I/usr/include
explicitly, because Debian's compilers have those directories in their
default search paths. Similarly, it is never necessary for Debian packages
for "lib64" architectures like amd64 to use -L/usr/lib64 explicitly.
This means ga can be made reproducible by not specifying /usr, and instead
relying on the armci library being in the default compiler search path.

Please consider the attached patch. It does not eliminate all the unnecessary
-I/usr/include or -L/usr/lib, only the ones that can be a problem for
reproducible builds, and seems like a net simplification for the package
in general.

The changes that result in the ga-config script when applying the patch
look something like this (quoting from diffoscope output):

│ │ │ ├── ./usr/bin/ga-config
│ │ │ │ @@ -263,30 +263,30 @@
│ │ │ │  dep_libs=`$prefix/bin/armci-config --libs`
│ │ │ │  
│ │ │ │  fi
│ │ │ │  
│ │ │ │  
│ │ │ │  f77="mpif90"
│ │ │ │  cc="mpicc"
│ │ │ │ -cppflags="     -I/usr/include -I/usr/include"
│ │ │ │ -network_cppflags=" -I/usr/include"
│ │ │ │ +cppflags="     -I/usr/include"
│ │ │ │ +network_cppflags=""
│ │ │ │  cflags=""
│ │ │ │  fflags=" -fdefault-integer-8"
│ │ │ │  fint="-fdefault-integer-8"
│ │ │ │  blas_size="4"
│ │ │ │  scalapack_size="4"
│ │ │ │  use_blas="1"
│ │ │ │  use_lapack="1"
│ │ │ │  use_scalapack="1"
│ │ │ │  use_peigs="0"
│ │ │ │  use_elpa="0"
│ │ │ │  use_elpa_2015="0"
│ │ │ │  use_elpa_2016="0"
│ │ │ │ -ldflags="     -L/usr/lib64 -L/usr/lib"
│ │ │ │ -network_ldflags=" -L/usr/lib64"
│ │ │ │ +ldflags="     -L/usr/lib"
│ │ │ │ +network_ldflags=""
│ │ │ │  libs="-lga  -lscalapack-openmpi  -lopenblas  -lopenblas $dep_libs"
│ │ │ │  network_libs=" -larmci"
│ │ │ │  flibs=" -L/usr/lib/gcc/x86_64-linux-gnu/10 
-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu 
-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/lib/x86_64-linux-gnu 
-L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib 
-L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. -lgfortran -lm -lquadmath"
│ │ │ │  enable_f77_true=""
│ │ │ │  version="5.7.1"
│ │ │ │  
│ │ │ │  if test "x$enable_f77_true" = x; then :

    smcv
>From 6dda597e304c0db8172bbcf9df519db24b792413 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Sat, 4 Sep 2021 17:05:35 +0100
Subject: [PATCH] d/rules: Don't specify path to armci, for reproducible build

If we build with --with-armci=yes (or equivalently, --with-armci)
instead of --with-armci=/usr, it's assumed to be in the compiler's
default search path, which is always the case on Debian. This avoids
hard-coding unnecessary -L/usr/lib and/or -L/usr/lib64 into ga-config,
which makes the build non-reproducible because it depends on whether
/usr/lib64 happens to exist (which it does on merged-/usr 64-bit
systems, but typically does not on non-merged-/usr).
---
 debian/rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 5bb164f..8de9aa8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,7 +15,7 @@ override_dh_auto_configure:
 		--with-blas4=-lopenblas			\
 		--with-lapack=-lopenblas		\
 		--with-mpi				\
-		--with-armci=/usr
+		--with-armci
 
 override_dh_auto_install:
 	dh_auto_install --destdir=$(CURDIR)/debian/tmp
-- 
2.33.0

Reply via email to