From bf04551bf57feb5bd503fe2389fc7eb254e581c4 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Karnad <46030335+iamashwin99@users.noreply.github.com> Date: Fri, 21 Apr 2023 03:18:11 +0200 Subject: [PATCH] Fix bigdft-suite compilation (#36612) (from https://github.com/danielecesarini/spack/commit/d20f2841009eb037344e73516d38716769643e4b) --- .../builtin/packages/bigdft-atlab/package.py | 25 ++++++++++--------- .../builtin/packages/bigdft-chess/package.py | 17 +++++++------ .../builtin/packages/bigdft-core/package.py | 20 +++++++-------- .../builtin/packages/bigdft-futile/package.py | 12 ++++----- .../packages/bigdft-libabinit/package.py | 19 ++++++++------ .../packages/bigdft-psolver/package.py | 14 +++++------ .../builtin/packages/bigdft-spred/package.py | 14 +++++------ 7 files changed, 59 insertions(+), 62 deletions(-) diff --git a/var/spack/repos/builtin/packages/bigdft-atlab/package.py b/var/spack/repos/builtin/packages/bigdft-atlab/package.py index 2b988a3005..e44c1d0ee2 100644 --- a/var/spack/repos/builtin/packages/bigdft-atlab/package.py +++ b/var/spack/repos/builtin/packages/bigdft-atlab/package.py @@ -22,32 +22,33 @@ class BigdftAtlab(AutotoolsPackage): variant("openmp", default=True, description="Enable OpenMP support") variant("openbabel", default=False, description="Enable detection of openbabel compilation") + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + depends_on("mpi", when="+mpi") depends_on("openbabel", when="+openbabel") for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]: depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers)) - build_directory = "atlab" - - def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") - - with working_dir(self.build_directory): - autoreconf("-fi") + configure_directory = "atlab" def configure_args(self): spec = self.spec prefix = self.prefix - openmp_flag = [] + fcflags = [] if "+openmp" in spec: - openmp_flag.append(self.compiler.openmp_flag) + fcflags.append(self.compiler.openmp_flag) + + if self.spec.satisfies("%gcc@10:"): + fcflags.append("-fallow-argument-mismatch") args = [ - "FCFLAGS=%s" % " ".join(openmp_flag), - "--with-futile-libs=%s" % spec["bigdft-futile"].prefix.lib, - "--with-futile-incs=%s" % spec["bigdft-futile"].prefix.include, + "FCFLAGS=%s" % " ".join(fcflags), + "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, + "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags + "/futile", "--with-moduledir=%s" % prefix.include, "--prefix=%s" % prefix, "--without-etsf-io", diff --git a/var/spack/repos/builtin/packages/bigdft-chess/package.py b/var/spack/repos/builtin/packages/bigdft-chess/package.py index 011dc18cba..c2731de7b5 100644 --- a/var/spack/repos/builtin/packages/bigdft-chess/package.py +++ b/var/spack/repos/builtin/packages/bigdft-chess/package.py @@ -25,6 +25,10 @@ class BigdftChess(AutotoolsPackage, CudaPackage): variant("ntpoly", default=False, description="Option to use NTPoly") # variant('minpack', default=False, description='Give the link-line for MINPACK') + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + depends_on("python@3.0:", type=("build", "run")) depends_on("blas") @@ -39,13 +43,7 @@ class BigdftChess(AutotoolsPackage, CudaPackage): depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers)) depends_on("bigdft-atlab@{0}".format(vers), when="@{0}".format(vers)) - build_directory = "chess" - - def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") - - with working_dir(self.build_directory): - autoreconf("-fi") + configure_directory = "chess" def configure_args(self): spec = self.spec @@ -61,12 +59,15 @@ def configure_args(self): linalg = [] if "+scalapack" in spec: linalg.append(spec["scalapack"].libs.ld_flags) + linalg.append(spec["lapack"].libs.ld_flags) + linalg.append(spec["blas"].libs.ld_flags) args = [ "FCFLAGS=%s" % " ".join(openmp_flag), + "LDFLAGS=%s" % " ".join(linalg), "--with-ext-linalg=%s" % " ".join(linalg), "--with-pyyaml-path=%s" % pyyaml, - "--with-futile-libs=%s" % spec["bigdft-futile"].prefix.lib, + "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags, "--with-moduledir=%s" % prefix.include, "--prefix=%s" % prefix, diff --git a/var/spack/repos/builtin/packages/bigdft-core/package.py b/var/spack/repos/builtin/packages/bigdft-core/package.py index 3b3e4c943e..40d76442c8 100644 --- a/var/spack/repos/builtin/packages/bigdft-core/package.py +++ b/var/spack/repos/builtin/packages/bigdft-core/package.py @@ -24,6 +24,10 @@ class BigdftCore(AutotoolsPackage, CudaPackage): variant("scalapack", default=True, description="Enable SCALAPACK support") variant("openbabel", default=False, description="Enable detection of openbabel compilation") + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + depends_on("python@3.0:", type=("build", "run")) depends_on("blas") @@ -43,13 +47,7 @@ class BigdftCore(AutotoolsPackage, CudaPackage): depends_on("bigdft-psolver@{0}".format(vers), when="@{0}".format(vers)) depends_on("bigdft-libabinit@{0}".format(vers), when="@{0}".format(vers)) - build_directory = "bigdft" - - def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") - - with working_dir(self.build_directory): - autoreconf("-fi") + configure_directory = "bigdft" def configure_args(self): spec = self.spec @@ -72,13 +70,13 @@ def configure_args(self): "FCFLAGS=%s" % " ".join(openmp_flag), "--with-ext-linalg=%s" % " ".join(linalg), "--with-pyyaml-path=%s" % pyyaml, - "--with-futile-libs=%s" % spec["bigdft-futile"].prefix.lib, + "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags, - "--with-chess-libs=%s" % spec["bigdft-chess"].prefix.lib, + "--with-chess-libs=%s" % spec["bigdft-chess"].libs.ld_flags, "--with-chess-incs=%s" % spec["bigdft-chess"].headers.include_flags, - "--with-psolver-libs=%s" % spec["bigdft-psolver"].prefix.lib, + "--with-psolver-libs=%s" % spec["bigdft-psolver"].libs.ld_flags, "--with-psolver-incs=%s" % spec["bigdft-psolver"].headers.include_flags, - "--with-libABINIT-libs=%s" % spec["bigdft-libabinit"].prefix.lib, + "--with-libABINIT-libs=%s" % spec["bigdft-libabinit"].libs.ld_flags, "--with-libABINIT-incs=%s" % spec["bigdft-libabinit"].headers.include_flags, "--with-libgain-libs=%s" % spec["libgain"].libs.ld_flags, "--with-libgain-incs=%s" % spec["libgain"].headers.include_flags, diff --git a/var/spack/repos/builtin/packages/bigdft-futile/package.py b/var/spack/repos/builtin/packages/bigdft-futile/package.py index 773415649b..5100230881 100644 --- a/var/spack/repos/builtin/packages/bigdft-futile/package.py +++ b/var/spack/repos/builtin/packages/bigdft-futile/package.py @@ -25,6 +25,10 @@ class BigdftFutile(AutotoolsPackage, CudaPackage): variant("mpi", default=True, description="Enable MPI support") variant("openmp", default=True, description="Enable OpenMP support") + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + depends_on("python@3.0:", type=("build", "run")) depends_on("blas") @@ -33,13 +37,7 @@ class BigdftFutile(AutotoolsPackage, CudaPackage): depends_on("py-pyyaml") depends_on("mpi", when="+mpi") - build_directory = "futile" - - def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") - - with working_dir(self.build_directory): - autoreconf("-fi") + configure_directory = "futile" def configure_args(self): spec = self.spec diff --git a/var/spack/repos/builtin/packages/bigdft-libabinit/package.py b/var/spack/repos/builtin/packages/bigdft-libabinit/package.py index a1c442f01c..49a4d2b981 100644 --- a/var/spack/repos/builtin/packages/bigdft-libabinit/package.py +++ b/var/spack/repos/builtin/packages/bigdft-libabinit/package.py @@ -21,6 +21,10 @@ class BigdftLibabinit(AutotoolsPackage): version("1.9.1", sha256="3c334da26d2a201b572579fc1a7f8caad1cbf971e848a3e10d83bc4dc8c82e41") version("1.9.0", sha256="4500e505f5a29d213f678a91d00a10fef9dc00860ea4b3edf9280f33ed0d1ac8") + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + variant("mpi", default=True, description="Enable MPI support") depends_on("python@3.0:", type=("build", "run")) @@ -32,23 +36,22 @@ class BigdftLibabinit(AutotoolsPackage): for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]: depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers)) - build_directory = "libABINIT" - - def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") - - with working_dir(self.build_directory): - autoreconf("-fi") + configure_directory = "libABINIT" def configure_args(self): spec = self.spec prefix = self.prefix + fcflags = [] + if self.spec.satisfies("%gcc@10:"): + fcflags.append("-fallow-argument-mismatch") + args = [ + "FCFLAGS=%s" % " ".join(fcflags), "--with-libxc-libs=%s %s" % (spec["libxc"].libs.ld_flags, spec["libxc"].libs.ld_flags + "f90"), "--with-libxc-incs=%s" % spec["libxc"].headers.include_flags, - "--with-futile-libs=%s" % spec["bigdft-futile"].prefix.lib, + "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags, "--with-moduledir=%s" % prefix.include, "--prefix=%s" % prefix, diff --git a/var/spack/repos/builtin/packages/bigdft-psolver/package.py b/var/spack/repos/builtin/packages/bigdft-psolver/package.py index 28cf5beca7..494d614468 100644 --- a/var/spack/repos/builtin/packages/bigdft-psolver/package.py +++ b/var/spack/repos/builtin/packages/bigdft-psolver/package.py @@ -24,6 +24,10 @@ class BigdftPsolver(AutotoolsPackage, CudaPackage): variant("openmp", default=True, description="Enable OpenMP support") variant("scalapack", default=True, description="Enable SCALAPACK support") + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + depends_on("python@3.0:", type=("build", "run")) depends_on("blas") @@ -36,13 +40,7 @@ class BigdftPsolver(AutotoolsPackage, CudaPackage): depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers)) depends_on("bigdft-atlab@{0}".format(vers), when="@{0}".format(vers)) - build_directory = "psolver" - - def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") - - with working_dir(self.build_directory): - autoreconf("-fi") + configure_directory = "psolver" def configure_args(self): spec = self.spec @@ -65,7 +63,7 @@ def configure_args(self): "FCFLAGS=%s" % " ".join(openmp_flag), "--with-ext-linalg=%s" % " ".join(linalg), "--with-pyyaml-path=%s" % pyyaml, - "--with-futile-libs=%s" % spec["bigdft-futile"].prefix.lib, + "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags, "--with-moduledir=%s" % prefix.include, "--prefix=%s" % prefix, diff --git a/var/spack/repos/builtin/packages/bigdft-spred/package.py b/var/spack/repos/builtin/packages/bigdft-spred/package.py index bcf936f66f..fe9a917d60 100644 --- a/var/spack/repos/builtin/packages/bigdft-spred/package.py +++ b/var/spack/repos/builtin/packages/bigdft-spred/package.py @@ -19,6 +19,10 @@ class BigdftSpred(AutotoolsPackage): version("1.9.1", sha256="3c334da26d2a201b572579fc1a7f8caad1cbf971e848a3e10d83bc4dc8c82e41") version("1.9.0", sha256="4500e505f5a29d213f678a91d00a10fef9dc00860ea4b3edf9280f33ed0d1ac8") + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + variant("mpi", default=True, description="Enable MPI support") variant("openmp", default=True, description="Enable OpenMP support") variant("scalapack", default=True, description="Enable SCALAPACK support") @@ -36,13 +40,7 @@ class BigdftSpred(AutotoolsPackage): depends_on("bigdft-psolver@{0}".format(vers), when="@{0}".format(vers)) depends_on("bigdft-core@{0}".format(vers), when="@{0}".format(vers)) - build_directory = "spred" - - def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") - - with working_dir(self.build_directory): - autoreconf("-fi") + configure_directory = "spred" def configure_args(self): spec = self.spec @@ -65,7 +63,7 @@ def configure_args(self): "FCFLAGS=%s" % " ".join(openmp_flag), "--with-ext-linalg=%s" % " ".join(linalg), "--with-pyyaml-path=%s" % pyyaml, - "--with-futile-libs=%s" % spec["bigdft-futile"].prefix.lib, + "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags, "--with-psolver-libs=%s" % spec["bigdft-psolver"].prefix.lib, "--with-psolver-incs=%s" % spec["bigdft-psolver"].headers.include_flags,