Repository: spack/spack

Issue:
Installation issue: cmake@2.9.6 failed to built with libuv@1.25.0
### Steps to reproduce the issue

```console
$ spack uninstall -y --all --dependents cmake; spack uninstall -y --all --dependents libuv; spack spec cmake@3.9.6 %gcc@4.8.5; spack install cmake@3.9.6 %gcc@4.8.5
...
Input spec
--------------------------------
cmake@3.9.6%gcc@4.8.5

Concretized
--------------------------------
cmake@3.9.6%gcc@4.8.5~doc+ncurses+openssl~ownlibs patches=dd3a40d4d92f6b2158b87d6fb354c277947c776424aa03f6dc8096cf3135f5d0 ~qt arch=linux-centos7-x86_64
    ^bzip2@1.0.6%gcc@4.8.5+shared arch=linux-centos7-x86_64
        ^diffutils@3.7%gcc@4.8.5 arch=linux-centos7-x86_64
    ^curl@7.63.0%gcc@4.8.5~darwinssl~libssh~libssh2~nghttp2 arch=linux-centos7-x86_64
        ^openssl@1.1.1a%gcc@4.8.5+systemcerts arch=linux-centos7-x86_64
            ^perl@5.26.2%gcc@4.8.5+cpanm patches=0eac10ed90aeb0459ad8851f88081d439a4e41978e586ec743069e8b059370ac +shared+threads arch=linux-centos7-x86_64
                ^gdbm@1.18.1%gcc@4.8.5 arch=linux-centos7-x86_64
                    ^readline@7.0%gcc@4.8.5 arch=linux-centos7-x86_64
                        ^ncurses@6.1%gcc@4.8.5~symlinks~termlib arch=linux-centos7-x86_64
                            ^pkgconf@1.5.4%gcc@4.8.5 arch=linux-centos7-x86_64
            ^zlib@1.2.11%gcc@4.8.5+optimize+pic+shared arch=linux-centos7-x86_64
    ^expat@2.2.5%gcc@4.8.5+libbsd arch=linux-centos7-x86_64
        ^libbsd@0.9.1%gcc@4.8.5 arch=linux-centos7-x86_64
    ^libarchive@3.3.2%gcc@4.8.5 arch=linux-centos7-x86_64
        ^libxml2@2.9.8%gcc@4.8.5~python arch=linux-centos7-x86_64
            ^libiconv@1.15%gcc@4.8.5 arch=linux-centos7-x86_64
            ^xz@5.2.4%gcc@4.8.5 arch=linux-centos7-x86_64
        ^lz4@1.8.1.2%gcc@4.8.5 arch=linux-centos7-x86_64
        ^lzo@2.09%gcc@4.8.5 arch=linux-centos7-x86_64
        ^nettle@3.4%gcc@4.8.5 arch=linux-centos7-x86_64
            ^gmp@6.1.2%gcc@4.8.5 arch=linux-centos7-x86_64
                ^autoconf@2.69%gcc@4.8.5 arch=linux-centos7-x86_64
                ^automake@1.13.4%gcc@4.8.5 arch=linux-centos7-x86_64
                ^libtool@2.4.2%gcc@4.8.5 arch=linux-centos7-x86_64
                ^m4@1.4.16%gcc@4.8.5 patches=c0a408fbffb7255fcc75e26bd8edab116fc81d216bfd18b473668b7739a4158e +sigsegv arch=linux-centos7-x86_64
    ^libuv@1.25.0%gcc@4.8.5 arch=linux-centos7-x86_64
    ^rhash@1.3.5%gcc@4.8.5 arch=linux-centos7-x86_64
...
==> Installing cmake
==> Searching for binary cache of cmake
==> Finding buildcaches on http://spack.pi.sjtu.edu.cn/mirror
==> Warning: Spack will not check SSL certificates. You need to update your Python to enable certificate verification.
==> No binary for cmake found: installing from source
==> Using cached archive: /lustre/home/acct-hpc/hpc-jianwen/spack/var/spack/cache/cmake/cmake-3.9.6.tar.gz
==> Staging archive: /lustre/home/acct-hpc/hpc-jianwen/spack/var/spack/stage/cmake-3.9.6-r6762pdebxxpmt5aglerfqhykilfmw25/cmake-3.9.6.tar.gz
==> Created stage in /lustre/home/acct-hpc/hpc-jianwen/spack/var/spack/stage/cmake-3.9.6-r6762pdebxxpmt5aglerfqhykilfmw25
==> Applied patch /lustre/home/acct-hpc/hpc-jianwen/spack/var/spack/repos/builtin/packages/cmake/nag-response-files.patch
==> Building cmake [Package]
==> Executing phase: 'bootstrap'
==> Error: ProcessError: Command exited with status 11:
    './bootstrap' '--prefix=/lustre/home/acct-hpc/hpc-jianwen/spack/opt/linux-centos7-x86_64/gcc-4.8.5/cmake-3.9.6-r6762pdebxxpmt5aglerfqhykilfmw25' '--parallel=4' '--system-libs' '--no-system-jsoncpp' '--no-qt-gui' '--' '-DCMAKE_USE_OPENSSL=ON'

2 errors found in build log:
     309    -- Found LibRHash: /lustre/home/acct-hpc/hpc-jianwen/spack/opt/linux-centos7-x86_64/gcc-4.8.5/rhash-1.3.5-g3ow7eczn5aw6axlv6yfdlj4yfe7odgf/lib/librhash.a
     310    -- Found ZLIB: /lustre/home/acct-hpc/hpc-jianwen/spack/opt/linux-centos7-x86_64/gcc-4.8.5/zlib-1.2.11-64vg6e4evdrlqgx7iicwhu2hs7lv6gpz/lib/libz.so (found version "1.2.11")
     311    -- Found CURL: /lustre/home/acct-hpc/hpc-jianwen/spack/opt/linux-centos7-x86_64/gcc-4.8.5/curl-7.63.0-7aotrrisqeid7qk6ujyho26l7r2q43ry/lib/libcurl.so (found version "7.63.0")
     312    -- Found EXPAT: /lustre/home/acct-hpc/hpc-jianwen/spack/opt/linux-centos7-x86_64/gcc-4.8.5/expat-2.2.5-cn2qjequsqaizlcxsvr74gq4rntgl5zn/lib/libexpat.so (found version "2.2.5")
     313    -- Found LibArchive: /lustre/home/acct-hpc/hpc-jianwen/spack/opt/linux-centos7-x86_64/gcc-4.8.5/libarchive-3.3.2-vwxg2vdq2m5ui5xwbl3fe2aoewv5lgm3/lib/libarchive.so (found suitable version "3.3.2", minimum required is "3.0.0")
     314    -- Could NOT find LibUV: Found unsuitable version "", but required is at least "1.0.0" (found /lustre/home/acct-hpc/hpc-jianwen/spack/opt/linux-centos7-x86_64/gcc-4.8.5/libuv-1.25.0-vmzhod62e32ovhdwnzf733soavisxyqm/lib/libuv.
            so)
  >> 315    CMake Error at CMakeLists.txt:552 (message):
     316      CMAKE_USE_SYSTEM_LIBUV is ON but a libuv is not found!
     317    Call Stack (most recent call first):
     318      CMakeLists.txt:686 (CMAKE_BUILD_UTILITIES)
     319
     320
     321    -- Configuring incomplete, errors occurred!
     322    See also "/tmp/hpc-jianwen/spack-stage/spack-stage-hknYC4/cmake-3.9.6/CMakeFiles/CMakeOutput.log".
     323    See also "/tmp/hpc-jianwen/spack-stage/spack-stage-hknYC4/cmake-3.9.6/CMakeFiles/CMakeError.log".
     324    ---------------------------------------------
  >> 325    Error when bootstrapping CMake:
     326    Problem while running initial CMake
     327    ---------------------------------------------
```

### Platform and user environment

```commandline
$ uname -a 
Linux mu05.pi.sjtu.edu.cn 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -d
Description:    CentOS Linux release 7.5.1804 (Core)
``` 

### Additional information

`git bisect` shows that #10423 introduces this issue in which `libuv` was bump from v1.9.0 to v1.25.0. 

A workaround is to built cmake@3.9.6 with libuv@1.9.0 dependency.

```
spack install cmake@3.9.6 %gcc@4.8.5 ^libuv@1.9.0
```



Discussion:
Can you please add this `libuv` version restriction to `cmake/package.py` and submit a PR?
I'm seeing something similar : 

```
[sajid@xrmlite ~]$ spack install cmake%intel@19.0.1
...
==> libuv is already installed in /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/libuv-1.25.0-kp26wv6mvblqba7gxl4zfuas3pc572jv
==> rhash is already installed in /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/rhash-1.3.5-t73c6ev2gjxlv6zpjlsjhoryr4qq76n7
==> Installing cmake
==> Searching for binary cache of cmake
==> Warning: No Spack mirrors are currently configured
==> No binary for cmake found: installing from source
==> Using cached archive: /home/sajid/packages/spack/var/spack/cache/cmake/cmake-3.10.2.tar.gz
==> Staging archive: /home/sajid/packages/spack/var/spack/stage/cmake-3.10.2-howq7th5hxdcg6ftm7qb6hegs5pf4q32/cmake-3.10.2.tar.gz
==> Created stage in /home/sajid/packages/spack/var/spack/stage/cmake-3.10.2-howq7th5hxdcg6ftm7qb6hegs5pf4q32
==> Applied patch /home/sajid/packages/spack/var/spack/repos/builtin/packages/cmake/nag-response-files.patch
==> Building cmake [Package]
==> Executing phase: 'bootstrap'
==> Error: ProcessError: Command exited with status 11:
    './bootstrap' '--prefix=/home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/cmake-3.10.2-howq7th5hxdcg6ftm7qb6hegs5pf4q32' '--parallel=32' '--system-libs' '--no-system-jsoncpp' '--no-qt-gui' '--' '-DCMAKE_USE_OPENSSL=ON'

2 errors found in build log:
     320    -- Found LibRHash: /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/rhash-1.3.5-t73c6ev2gjxlv6zpjlsjhoryr4qq76n7/lib/librhash.a
     321    -- Found ZLIB: /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/zlib-1.2.11-lvdjmg6cogzd4kufqoaunmmwoiv2cg4n/lib/libz.so (found version "1.
            2.11")
     322    -- Found CURL: /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/curl-7.63.0-4jkkfwzbkh3f3lfd7h2wpfx2na5xmy5d/lib/libcurl.so (found version
            "7.63.0")
     323    -- Found EXPAT: /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/expat-2.2.5-sp5b5tzstalfathmwbctnzrt5tsgp5g5/lib/libexpat.so (found versio
            n "2.2.5")
     324    -- Found LibArchive: /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.0.1/libarchive-3.3.2-2sna7tvleos7ginpudykpnh7zmolakuy/lib/libarchive.so (
            found suitable version "3.3.2", minimum required is "3.0.0")
     325    -- Could NOT find LibUV: Found unsuitable version "", but required is at least "1.0.0" (found /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/intel-19.
            0.1/libuv-1.25.0-kp26wv6mvblqba7gxl4zfuas3pc572jv/lib/libuv.so)
  >> 326    CMake Error at CMakeLists.txt:531 (message):
     327      CMAKE_USE_SYSTEM_LIBUV is ON but a libuv is not found!
     328    Call Stack (most recent call first):
     329      CMakeLists.txt:662 (CMAKE_BUILD_UTILITIES)
     330
     331
     332    -- Configuring incomplete, errors occurred!
     333    See also "/tmp/sajid/spack-stage/spack-stage-OUp2g_/cmake-3.10.2/CMakeFiles/CMakeOutput.log".
     334    See also "/tmp/sajid/spack-stage/spack-stage-OUp2g_/cmake-3.10.2/CMakeFiles/CMakeError.log".
     335    ---------------------------------------------
  >> 336    Error when bootstrapping CMake:
     337    Problem while running initial CMake
     338    ---------------------------------------------

See build log for details:
  /home/sajid/packages/spack/var/spack/stage/cmake-3.10.2-howq7th5hxdcg6ftm7qb6hegs5pf4q32/cmake-3.10.2/spack-build.out
```
@s-sajid-ali I cannot reproduce this issue on `cmake@3.13.4` against `intel@19.0.2`. I'll confirm from which version of cmake this issue occurs then submit a RP.

```
  % spack spec cmake %intel@19.0.2                                                                                                                                                                                                      !5081
Input spec
--------------------------------
cmake%intel@19.0.2

Concretized
--------------------------------
cmake@3.13.4%intel@19.0.2~doc+ncurses+openssl~ownlibs~qt arch=linux-centos7-x86_64
    ^bzip2@1.0.6%intel@19.0.2+shared arch=linux-centos7-x86_64
        ^diffutils@3.7%intel@19.0.2 arch=linux-centos7-x86_64
    ^curl@7.63.0%intel@19.0.2~darwinssl~libssh~libssh2~nghttp2 arch=linux-centos7-x86_64
        ^openssl@1.1.1a%intel@19.0.2+systemcerts arch=linux-centos7-x86_64
            ^perl@5.26.2%intel@19.0.2+cpanm patches=0eac10ed90aeb0459ad8851f88081d439a4e41978e586ec743069e8b059370ac +shared+threads arch=linux-centos7-x86_64
                ^gdbm@1.18.1%intel@19.0.2 arch=linux-centos7-x86_64
                    ^readline@7.0%intel@19.0.2 arch=linux-centos7-x86_64
                        ^ncurses@6.1%intel@19.0.2~symlinks~termlib arch=linux-centos7-x86_64
                            ^pkgconf@1.5.4%intel@19.0.2 arch=linux-centos7-x86_64
            ^zlib@1.2.11%intel@19.0.2+optimize+pic+shared arch=linux-centos7-x86_64
    ^expat@2.2.5%intel@19.0.2+libbsd arch=linux-centos7-x86_64
        ^libbsd@0.9.1%intel@19.0.2 arch=linux-centos7-x86_64
    ^libarchive@3.3.2%intel@19.0.2 arch=linux-centos7-x86_64
        ^libxml2@2.9.8%intel@19.0.2~python arch=linux-centos7-x86_64
            ^libiconv@1.15%intel@19.0.2 arch=linux-centos7-x86_64
            ^xz@5.2.4%intel@19.0.2 arch=linux-centos7-x86_64
        ^lz4@1.8.1.2%intel@19.0.2 arch=linux-centos7-x86_64
        ^lzo@2.09%intel@19.0.2 arch=linux-centos7-x86_64
        ^nettle@3.4%intel@19.0.2 arch=linux-centos7-x86_64
            ^gmp@6.1.2%intel@19.0.2 arch=linux-centos7-x86_64
                ^autoconf@2.69%intel@19.0.2 arch=linux-centos7-x86_64
                ^automake@1.13.4%intel@19.0.2 arch=linux-centos7-x86_64
                ^libtool@2.4.2%intel@19.0.2 arch=linux-centos7-x86_64
                ^m4@1.4.16%intel@19.0.2 patches=c0a408fbffb7255fcc75e26bd8edab116fc81d216bfd18b473668b7739a4158e +sigsegv arch=linux-centos7-x86_64
    ^libuv@1.25.0%intel@19.0.2 arch=linux-centos7-x86_64
    ^rhash@1.3.5%intel@19.0.2 arch=linux-centos7-x86_64
```

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py
--- a/var/spack/repos/builtin/packages/cmake/package.py
+++ b/var/spack/repos/builtin/packages/cmake/package.py
@@ -69,8 +69,9 @@ class Cmake(Package):
     depends_on('bzip2',          when='~ownlibs')
     depends_on('xz',             when='~ownlibs')
     depends_on('libarchive',     when='~ownlibs')
-    depends_on('libuv@1.0.0:',   when='@3.7.0:3.10.3~ownlibs')
-    depends_on('libuv@1.10.0:',  when='@3.11.0:~ownlibs')
+    depends_on('libuv@1.0.0:1.10.99',   when='@3.7.0:3.10.3~ownlibs')
+    depends_on('libuv@1.10.0:1.10.99',  when='@3.11.0:3.11.99~ownlibs')
+    depends_on('libuv@1.10.0:',  when='@3.12.0:~ownlibs')
     depends_on('rhash',          when='@3.8.0:~ownlibs')
     depends_on('qt',             when='+qt')
     depends_on('python@2.7.11:', when='+doc', type='build')
diff --git a/var/spack/repos/builtin/packages/libuv/package.py b/var/spack/repos/builtin/packages/libuv/package.py
--- a/var/spack/repos/builtin/packages/libuv/package.py
+++ b/var/spack/repos/builtin/packages/libuv/package.py
@@ -12,6 +12,7 @@ class Libuv(AutotoolsPackage):
     url      = "https://github.com/libuv/libuv/archive/v1.9.0.tar.gz"
 
     version('1.25.0', '31a1873ebceacae42573bac8ec5da687')
+    version('1.10.0', 'f7a12f3a8ee021c20cfbc9af4cc5b793')
     version('1.9.0',  '14737f9c76123a19a290dabb7d1cd04c')
 
     depends_on('automake', type='build')


Test patch: