Repository: spack/spack

Issue:
autoconf: something in spec.py breaks autoconf
One of my cron jobs tripped an alarm this morning ....

This commit seems to break the build for autoconf on power8/le.

commit 77444dff106524b0b33f664e5fe1f4512ec511d7 (HEAD)
Author: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Date:   Wed Oct 9 23:32:27 2019 +0200

    ArchSpec: fix constraint satisfaction for targets
    fixes #13111

This is on RH 7.3, power8/le, gcc 6.4.0 (from module).
`packages.yaml` just specifies the system perl.

```
packages:
  perl:
    paths:
      perl@5.16.3:  /usr
    buildable:  False
```

```
$ spack spec -I autoconf

 -   autoconf@2.69%gcc@6.4.0 arch=linux-rhel7-power8le
[+]      ^m4@1.4.18%gcc@6.4.0 patches=3877ab548f88597ab2327a2230ee048d2d07ace1062efe81fc92e91b7f39cd00,fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8 +sigsegv arch=linux-rhel7-power8le
[+]          ^libsigsegv@2.12%gcc@6.4.0 arch=linux-rhel7-power8le
[+]      ^perl@5.16.3%gcc@6.4.0+cpanm patches=0eac10ed90aeb0459ad8851f88081d439a4e41978e586ec743069e8b059370ac +shared+threads arch=linux-rhel7-power8le
```

```
$ spack install -v --keep-stage autoconf
...
==> Building autoconf [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> [2019-10-11-15:12:39.631916] '/poscratch/krentel/autoconf/spack-repo/build-stage/autoconf-2.69-3p23h2iucoukymckpcwfgv2up4u66grt/spack-src/configure' '--prefix=/poscratch/krentel/autoconf/install/linux-rhel7-power8le/gcc-6.4.0/autoconf-2.69-3p23h2iucoukymckpcwfgv2up4u66grt'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... /poscratch/krentel/autoconf/spack-repo/build-stage/autoconf-2.69-3p23h2iucoukymckpcwfgv2up4u66grt/spack-src/build-aux/config.guess: unable to guess system type
...
UNAME_MACHINE = ppc64le
UNAME_RELEASE = 3.10.0-514.el7.ppc64le
UNAME_SYSTEM  = Linux
UNAME_VERSION = #1 SMP Wed Oct 19 11:27:06 EDT 2016
configure: error: cannot guess build type; you must specify one
==> Error: ProcessError: Command exited with status 1:
    '/poscratch/krentel/autoconf/spack-repo/build-stage/autoconf-2.69-3p23h2iucoukymckpcwfgv2up4u66grt/spack-src/configure' '--prefix=/poscratch/krentel/autoconf/install/linux-rhel7-power8le/gcc-6.4.0/autoconf-2.69-3p23h2iucoukymckpcwfgv2up4u66grt'

1 error found in build log:
     39    /usr/convex/getsysinfo =
     40    
     41    UNAME_MACHINE = ppc64le
     42    UNAME_RELEASE = 3.10.0-514.el7.ppc64le
     43    UNAME_SYSTEM  = Linux
     44    UNAME_VERSION = #1 SMP Wed Oct 19 11:27:06 EDT 2016
  >> 45    configure: error: cannot guess build type; you must specify one
```

It's kinda strange.  The error message suggests that `config.guess` is
too old to detect ppc64le.  But it's been this way for years, and the
previous commit works.

The above commit does touch on specs and arch.  But I don't see the
mechanics of how that change could produce this failure.

```
$ git diff 7af8c206ace3 77444dff106
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 99246eb..0cde672 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -395,6 +395,10 @@ class ArchSpec(object):
             if not sep and self_target == t_min:
                 return True
 
+            if not sep and self_target != t_min:
+                return False
+
+            # Check against a range
             min_ok = self_target.microarchitecture >= t_min if t_min else True
             max_ok = self_target.microarchitecture <= t_max if t_max else True
```

I tried the patch from #13188, thinking that it might be related, but
that doesn't seem to help.

ping @alalazo



Discussion:

Resolving patch:
diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py
--- a/lib/spack/spack/build_systems/autotools.py
+++ b/lib/spack/spack/build_systems/autotools.py
@@ -87,8 +87,9 @@ def _do_patch_config_guess(self):
         config.guess fails for PPC64LE for version prior to a 2013-06-10
         build date (automake 1.13.4) and for ARM (aarch64)."""
 
-        if not self.patch_config_guess or (not self.spec.satisfies(
-                'target=ppc64le') and not self.spec.satisfies('target=aarch64')
+        if not self.patch_config_guess or (
+                not self.spec.satisfies('target=ppc64le:') and
+                not self.spec.satisfies('target=aarch64:')
         ):
             return
         my_config_guess = None


Test patch: