berkeleygw: fix build (no change to attribute spec.compiler_flags) (#34019)

This commit is contained in:
Bernhard Kaindl 2022-11-22 15:13:56 +01:00 committed by GitHub
parent 69987fd323
commit bcc0fda4e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,9 +121,11 @@ def build(self, spec, prefix):
if "+mpi" in spec: if "+mpi" in spec:
paraflags.append("-DMPI") paraflags.append("-DMPI")
# We need to copy fflags in case we append to it (#34019):
fflags = spec.compiler_flags["fflags"][:]
if "+openmp" in spec: if "+openmp" in spec:
paraflags.append("-DOMP") paraflags.append("-DOMP")
spec.compiler_flags["fflags"].append(self.compiler.openmp_flag) fflags.append(self.compiler.openmp_flag)
buildopts.append("C_PARAFLAG=-DPARA") buildopts.append("C_PARAFLAG=-DPARA")
buildopts.append("PARAFLAG=%s" % " ".join(paraflags)) buildopts.append("PARAFLAG=%s" % " ".join(paraflags))
@ -138,7 +140,7 @@ def build(self, spec, prefix):
buildopts.append("LINK=%s" % spec["mpi"].mpifc) buildopts.append("LINK=%s" % spec["mpi"].mpifc)
buildopts.append("C_LINK=%s" % spec["mpi"].mpicxx) buildopts.append("C_LINK=%s" % spec["mpi"].mpicxx)
buildopts.append("FOPTS=%s" % " ".join(spec.compiler_flags["fflags"])) buildopts.append("FOPTS=%s" % " ".join(fflags))
buildopts.append("C_OPTS=%s" % " ".join(spec.compiler_flags["cflags"])) buildopts.append("C_OPTS=%s" % " ".join(spec.compiler_flags["cflags"]))
mathflags = [] mathflags = []
@ -163,7 +165,7 @@ def build(self, spec, prefix):
buildopts.append("CC_COMP=%s" % spec["mpi"].mpicxx) buildopts.append("CC_COMP=%s" % spec["mpi"].mpicxx)
buildopts.append("BLACSDIR=%s" % spec["scalapack"].libs) buildopts.append("BLACSDIR=%s" % spec["scalapack"].libs)
buildopts.append("BLACS=%s" % spec["scalapack"].libs.ld_flags) buildopts.append("BLACS=%s" % spec["scalapack"].libs.ld_flags)
buildopts.append("FOPTS=%s" % " ".join(spec.compiler_flags["fflags"])) buildopts.append("FOPTS=%s" % " ".join(fflags))
elif spec.satisfies("%gcc"): elif spec.satisfies("%gcc"):
c_flags = "-std=c99" c_flags = "-std=c99"
cxx_flags = "-std=c++0x" cxx_flags = "-std=c++0x"
@ -178,7 +180,7 @@ def build(self, spec, prefix):
buildopts.append("FCPP=cpp -C -nostdinc") buildopts.append("FCPP=cpp -C -nostdinc")
buildopts.append("C_COMP=%s %s" % (spec["mpi"].mpicc, c_flags)) buildopts.append("C_COMP=%s %s" % (spec["mpi"].mpicc, c_flags))
buildopts.append("CC_COMP=%s %s" % (spec["mpi"].mpicxx, cxx_flags)) buildopts.append("CC_COMP=%s %s" % (spec["mpi"].mpicxx, cxx_flags))
buildopts.append("FOPTS=%s" % " ".join(spec.compiler_flags["fflags"])) buildopts.append("FOPTS=%s" % " ".join(fflags))
elif spec.satisfies("%fj"): elif spec.satisfies("%fj"):
c_flags = "-std=c99" c_flags = "-std=c99"
cxx_flags = "-std=c++0x" cxx_flags = "-std=c++0x"
@ -189,9 +191,7 @@ def build(self, spec, prefix):
buildopts.append("FCPP=cpp -C -nostdinc") buildopts.append("FCPP=cpp -C -nostdinc")
buildopts.append("C_COMP=%s %s" % (spec["mpi"].mpicc, c_flags)) buildopts.append("C_COMP=%s %s" % (spec["mpi"].mpicc, c_flags))
buildopts.append("CC_COMP=%s %s" % (spec["mpi"].mpicxx, cxx_flags)) buildopts.append("CC_COMP=%s %s" % (spec["mpi"].mpicxx, cxx_flags))
buildopts.append( buildopts.append("FOPTS=-Kfast -Knotemparraystack %s" % " ".join(fflags))
"FOPTS=-Kfast -Knotemparraystack %s" % " ".join(spec.compiler_flags["fflags"])
)
else: else:
raise InstallError( raise InstallError(
"Spack does not yet have support for building " "Spack does not yet have support for building "