Repository: spack/spack

Issue:
Installation issue: GlobalArrays fails with GCC 10
<!-- Thanks for taking the time to report this build failure. To proceed with the report please:

1. Title the issue "Installation issue: <name-of-the-package>".
2. Provide the information required below.

We encourage you to try, as much as possible, to reduce your problem to the minimal example that still reproduces the issue. That would help us a lot in fixing it quickly and effectively! -->

This is the same problem that shows up in #19964 . The new gfortran checker doesn't like the code and causes it to fail.

### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install globalarrays %gcc@10.2.0
...
==> globalarrays: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j8'

9 errors found in build log:
     1122
     1123       29 |       if (f2c_inform_base(MT_BYTE, byte_mb(1), byte_mb(2)) .eq.
     1124          |                                   2
     1125       30 |      $    MA_FALSE) return
     1126       31 |       if (f2c_inform_base(MT_INT, int_mb(1), int_mb(2)) .eq.
     1127          |                                  1
  >> 1128    Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(8)/CHARACTER(*)).
     1129    ma/maf.F:33:34:
     1130
     1131       29 |       if (f2c_inform_base(MT_BYTE, byte_mb(1), byte_mb(2)) .eq.
     1132          |                                   2
     1133    ......
     1134       33 |       if (f2c_inform_base(MT_LOG, log_mb(1), log_mb(2)) .eq.
     1135          |                                  1
  >> 1136    Error: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(8)/CHARACTER(*)).
     1137    ma/maf.F:35:35:
     1138
     1139       29 |       if (f2c_inform_base(MT_BYTE, byte_mb(1), byte_mb(2)) .eq.
     1140          |                                   2
     1141    ......
     1142       35 |       if (f2c_inform_base(MT_REAL, real_mb(1), real_mb(2)) .eq.
     1143          |                                   1
  >> 1144    Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/CHARACTER(*)).
     1145    ma/maf.F:37:34:
     1146
     1147       29 |       if (f2c_inform_base(MT_BYTE, byte_mb(1), byte_mb(2)) .eq.
     1148          |                                   2
     1149    ......
     1150       37 |       if (f2c_inform_base(MT_DBL, dbl_mb(1), dbl_mb(2)) .eq.
     1151          |                                  1
  >> 1152    Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/CHARACTER(*)).
     1153    ma/maf.F:39:35:
     1154
     1155       29 |       if (f2c_inform_base(MT_BYTE, byte_mb(1), byte_mb(2)) .eq.
     1156          |                                   2
     1157    ......
     1158       39 |       if (f2c_inform_base(MT_SCPL, scpl_mb(1), scpl_mb(2)) .eq.
     1159          |                                   1
  >> 1160    Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(4)/CHARACTER(*)).
     1161    ma/maf.F:41:35:
     1162
     1163       29 |       if (f2c_inform_base(MT_BYTE, byte_mb(1), byte_mb(2)) .eq.
     1164          |                                   2
     1165    ......
     1166       41 |       if (f2c_inform_base(MT_DCPL, dcpl_mb(1), dcpl_mb(2)) .eq.
     1167          |                                   1
  >> 1168    Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(8)/CHARACTER(*)).
  >> 1169    make[2]: *** [ma/maf.lo] Error 1
     1170    make[2]: *** Waiting for unfinished jobs....
     1171    libtool: compile:  /home/cloud/spack/opt/spack/linux-tlinux2-x86_64/gcc-10.2.0/mpich-3.3.2-skhpv7jel3lmvjflvyq5gldiknkljsac/bin/mpif77 -fdefault-integer-8 -fno-aggressi
             ve-loop-optimizations -c LinAlg/lapack+blas/gal_dgemv.f -o LinAlg/lapack+blas/gal_dgemv.o
     1172    make[2]: Leaving directory `/tmp/cloud/spack-stage/spack-stage-globalarrays-5.7-2dp4x45wegtg7tlnjmoz6scbbvsbqxi2/spack-src'
  >> 1173    make[1]: *** [all-recursive] Error 1
     1174    make[1]: Leaving directory `/tmp/cloud/spack-stage/spack-stage-globalarrays-5.7-2dp4x45wegtg7tlnjmoz6scbbvsbqxi2/spack-src'
  >> 1175    make: *** [all] Error 2
```

### Information on your system

<!-- Please include the output of `spack debug report` -->
$ spack debug report
* **Spack:** 0.15.4-1979-423e80a
* **Python:** 3.8.5
* **Platform:** linux-tlinux2-x86_64
<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

<!-- Please upload the following files. They should be present in the stage directory of the failing build. Also upload any config.log or similar file if one exists. -->
[spack-build-out.txt](https://github.com/spack/spack/files/5558356/spack-build-out.txt)
[spack-build-env.txt](https://github.com/spack/spack/files/5558357/spack-build-env.txt)

<!-- Some packages have maintainers who have volunteered to debug build failures. Run `spack maintainers <name-of-the-package>` and @mention them here if they exist. -->

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [x] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/globalarrays/package.py b/var/spack/repos/builtin/packages/globalarrays/package.py
--- a/var/spack/repos/builtin/packages/globalarrays/package.py
+++ b/var/spack/repos/builtin/packages/globalarrays/package.py
@@ -2,20 +2,24 @@
 # Spack Project Developers. See the top-level COPYRIGHT file for details.
 #
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
-
-from spack import *
+import os.path
 
 
 class Globalarrays(AutotoolsPackage):
     """Global Arrays (GA) is a Partitioned Global Address Space (PGAS)
-    programming model. It provides primitives for one-sided communication
-    (Get, Put, Accumulate) and Atomic Operations (read increment).
-    It supports blocking and non-blocking primtives, and supports location
-    consistency."""
+    programming model.
+
+    It provides primitives for one-sided communication (Get, Put, Accumulate)
+    and Atomic Operations (read increment). It supports blocking and
+    non-blocking primtives, and supports location consistency.
+    """
 
     homepage = "http://hpc.pnl.gov/globalarrays/"
     url = "https://github.com/GlobalArrays/ga/releases/download/v5.7/ga-5.7.tar.gz"
 
+    version('5.8',   sha256='64df7d1ea4053d24d84ca361e67a6f51c7b17ed7d626cb18a9fbc759f4a078ac')
+    version('5.7.2', sha256='8cd0fcfd85bc7f9c168c831616f66f1e8b9b2ca31dc7dd93cc55b27cc7fe7069')
+    version('5.7.1', sha256='aa4c6038d792cabf1766e264320da58a555da81a3a36be32b7c4d3e71c08ffa9')
     version('5.7',   sha256='3ed1ab47adfda7bceb7beca12fc05a2e1631732f0e55bbaf9036dad4e3da4774')
     version('5.6.5', sha256='17a7111dfe67d44cf0888c7b79abd48bf4968874f26b3f16cce9fd04e2c72bb9')
     version('5.6.4', sha256='3daf742053502755c0b581041a56f8f7086af05980c7146d194b0fd6526ee14f')
@@ -24,39 +28,38 @@ class Globalarrays(AutotoolsPackage):
     version('5.6.1', sha256='b324deed49f930f55203e1d18294ce07dd02680b9ac0728ebc54f94a12557ebc')
     version('5.6',   sha256='a228dfbae9a6cfaae34694d7e56f589ac758e959b58f4bc49e6ef44058096767')
 
-    variant('int64', default=False, description='Compile with 64 bit indices support')
-    variant('blas', default=False, description='Enable BLAS')
-    variant('lapack', default=False, description='Enable LAPACK')
     variant('scalapack', default=False, description='Enable SCALAPACK')
     variant('armci', values=('mpi-ts', 'mpi-pr', 'mpi3', 'openib', 'ofi'),
             default='mpi-ts', description='ARMCI runtime')
 
     depends_on('mpi')
-    depends_on('blas', when='+blas')
-    depends_on('lapack', when='+lapack')
+    depends_on('blas')
+    depends_on('lapack')
+
     depends_on('scalapack', when='+scalapack')
 
-    conflicts('+lapack', when='~blas')
-    conflicts('+scalapack', when='~blas')
-    conflicts('+scalapack', when='~lapack')
+    # See release https://github.com/GlobalArrays/ga/releases/tag/v5.7.1
+    conflicts('%gcc@10:', when='@5.7')
+    conflicts('%gcc@10:', when='@:5.6.5')
 
-    def configure_args(self):
-        args = ['--with-mpi']
+    @property
+    def build_directory(self):
+        return os.path.join(str(self.stage.source_path), '..', 'spack-build')
 
-        if '+blas' in self.spec:
-            if '+int64' in self.spec:
-                args.append('--with-blas8')
-            else:
-                args.append('--with-blas')
+    def configure_args(self):
+        blas_flags = self.spec['blas'].libs.ld_flags
+        lapack_libs = self.spec['lapack'].libs.ld_flags
 
-        if '+lapack' in self.spec:
-            args.append('--with-lapack')
+        args = [
+            '--enable-shared',
+            '--with-mpi',
+            '--with-blas={0}'.format(blas_flags),
+            '--with-lapack={0}'.format(lapack_libs),
+        ]
 
         if '+scalapack' in self.spec:
-            if '+int64' in self.spec:
-                args.append('--with-scalapack8')
-            else:
-                args.append('--with-scalapack')
+            scalapack_libs = self.spec['scalapack'].libs.ld_flags
+            args.append('--with-scalapack={0}'.format(scalapack_libs))
 
         args.append('--with-' + self.spec.variants['armci'].value)
 


Test patch: