Repository: spack/spack

Issue:
vt won't build without zlib 
### Steps to reproduce the issue

```console
$ spack install vt
==> Installing vt
==> Searching for binary cache of vt
==> Warning: No Spack mirrors are currently configured
==> No binary for vt found: installing from source
==> Using cached archive: /opt/htcf/spack/var/spack/cache/vt/vt-0.577.tar.gz
==> Staging archive: /opt/htcf/spack/var/spack/stage/vt-0.577-lzxiaaae27jvn4j7tykxi7zu6lg3yrmx/0.577.tar.gz
==> Created stage in /opt/htcf/spack/var/spack/stage/vt-0.577-lzxiaaae27jvn4j7tykxi7zu6lg3yrmx
==> No patches needed for vt
==> Building vt [MakefilePackage]
==> Executing phase: 'edit'
==> Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j24'

35 errors found in build log:
     35     gcc -g -Wall -O2 -I.  -c -o knetfile.o knetfile.c
     36     gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c dnbeta.c -o dnbeta.o
     37     gcc -g -Wall -O2 -I.  -c -o kstring.o kstring.c
     38     In file included from hts_utils.h:43:0,
     39                      from bcf_ordered_writer.h:39,
     40                      from bcf_ordered_writer.cpp:24:
  >> 41     ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     42      #include <zlib.h>
     43               ^~~~~~~~
     44     compilation terminated.
     45     In file included from hts_utils.h:43:0,
     46                      from bcf_genotyping_buffered_reader.h:30,
     47                      from bcf_genotyping_buffered_reader.cpp:24:
  >> 48     ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     49      #include <zlib.h>
     50               ^~~~~~~~
     51     compilation terminated.
     52     Makefile:137: recipe for target 'bcf_ordered_writer.o' failed
  >> 53     make: *** [bcf_ordered_writer.o] Error 1
     54     make: *** Waiting for unfinished jobs....
     55     gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c i1mach.c -o i1mach.o
     56     Makefile:137: recipe for target 'bcf_genotyping_buffered_reader.o' failed
  >> 57     make: *** [bcf_genotyping_buffered_reader.o] Error 1
     58     gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c pnbinom.c -o pnbinom.o
     59     In file included from hts_utils.h:43:0,
     60                      from bcf_ordered_reader.h:40,
     61                      from annotate_indels.h:28,
     62                      from annotate_indels.cpp:24:
  >> 63     ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     64      #include <zlib.h>
     65               ^~~~~~~~
     66     compilation terminated.
     67     In file included from hts_utils.h:43:0,
     68                      from candidate_motif_picker.h:36,
     69                      from candidate_motif_picker.cpp:24:
  >> 70     ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     71      #include <zlib.h>
     72               ^~~~~~~~
     73     compilation terminated.
     74     In file included from hts_utils.h:43:0,
     75                      from candidate_region_extractor.h:36,
     76                      from candidate_region_extractor.cpp:24:
  >> 77     ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     78      #include <zlib.h>
     79               ^~~~~~~~
     80     compilation terminated.
     81     In file included from hts_utils.h:43:0,
     82                      from bcf_ordered_reader.h:40,
     83                      from cat.h:27,
     84                      from cat.cpp:24:
  >> 85     ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     86      #include <zlib.h>
     87               ^~~~~~~~
     88     compilation terminated.
     89     In file included from hts_utils.h:43:0,
     90                      from augmented_bam_record.h:37,
     91                      from augmented_bam_record.cpp:24:
  >> 92     ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     93      #include <zlib.h>
     94               ^~~~~~~~
     95     compilation terminated.
     96     Makefile:137: recipe for target 'annotate_indels.o' failed
  >> 97     make: *** [annotate_indels.o] Error 1
     98     gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_context.o -c pcre2_context.c
     99     In file included from hts_utils.h:43:0,
     100                     from bcf_ordered_reader.h:40,
     101                     from bcf_ordered_reader.cpp:24:
  >> 102    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     103     #include <zlib.h>
     104              ^~~~~~~~
     105    compilation terminated.
     106    Makefile:137: recipe for target 'candidate_motif_picker.o' failed
  >> 107    make: *** [candidate_motif_picker.o] Error 1
     108    Makefile:137: recipe for target 'candidate_region_extractor.o' failed
  >> 109    make: *** [candidate_region_extractor.o] Error 1
     110    echo '/* Empty config.h generated by Makefile */' > config.h
     111    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_dfa_match.o -c pcre2_dfa_match.c
     112    Makefile:137: recipe for target 'augmented_bam_record.o' failed
  >> 113    make: *** [augmented_bam_record.o] Error 1
     114    Makefile:137: recipe for target 'cat.o' failed
  >> 115    make: *** [cat.o] Error 1
     116    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_error.o -c pcre2_error.c
     117    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_jit_compile.o -c pcre2_jit_compile.c
     118    Makefile:137: recipe for target 'bcf_ordered_reader.o' failed
  >> 119    make: *** [bcf_ordered_reader.o] Error 1
     120    echo '#define HTS_VERSION "1.2.1"' > version.h
     121    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c qlnorm.c -o qlnorm.o
     122    In file included from hts_utils.h:43:0,
     123                     from genome_interval.h:36,
     124                     from bcf_synced_reader.h:40,
     125                     from annotate_dbsnp_rsid.h:32,
     126                     from annotate_dbsnp_rsid.cpp:24:
  >> 127    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     128     #include <zlib.h>
     129              ^~~~~~~~
     130    compilation terminated.
     131    In file included from hts_utils.h:43:0,
     132                     from genome_interval.h:36,
     133                     from bam_ordered_reader.h:32,
     134                     from bam_ordered_reader.cpp:24:
  >> 135    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     136     #include <zlib.h>
     137              ^~~~~~~~
     138    compilation terminated.
     139    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_maketables.o -c pcre2_maketables.c
     140    In file included from hts_utils.h:43:0,
     141                     from genome_interval.h:36,
     142                     from bcf_synced_reader.h:40,
     143                     from annotate_1000g.h:32,
     144                     from annotate_1000g.cpp:24:
  >> 145    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     146     #include <zlib.h>
     147              ^~~~~~~~
     148    compilation terminated.
     149    In file included from hts_utils.h:43:0,
     150                     from genome_interval.h:36,
     151                     from bcf_synced_reader.h:40,
     152                     from bcf_synced_reader.cpp:24:
  >> 153    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     154     #include <zlib.h>
     155              ^~~~~~~~
     156    compilation terminated.
     157    In file included from hts_utils.h:43:0,
     158                     from bcf_ordered_reader.h:40,
     159                     from annotate_variants.h:41,
     160                     from annotate_variants.cpp:24:
  >> 161    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     162     #include <zlib.h>
     163              ^~~~~~~~
     164    compilation terminated.
     165    Makefile:137: recipe for target 'annotate_dbsnp_rsid.o' failed
  >> 166    make: *** [annotate_dbsnp_rsid.o] Error 1
     167    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_match.o -c pcre2_match.c
     168    Makefile:137: recipe for target 'bam_ordered_reader.o' failed
  >> 169    make: *** [bam_ordered_reader.o] Error 1
     170    gcc -g -Wall -O2 -I.  -c -o bgzf.o bgzf.c
     171    In file included from hts_utils.h:43:0,
     172                     from bcf_ordered_reader.h:40,
     173                     from annotate_regions.h:41,
     174                     from annotate_regions.cpp:24:
  >> 175    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     176     #include <zlib.h>
     177              ^~~~~~~~
     178    compilation terminated.
     179    Makefile:137: recipe for target 'annotate_1000g.o' failed
  >> 180    make: *** [annotate_1000g.o] Error 1
     181    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c rgeom.c -o rgeom.o
     182    Makefile:137: recipe for target 'bcf_synced_reader.o' failed
  >> 183    make: *** [bcf_synced_reader.o] Error 1
     184    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c bessel_i.c -o bessel_i.o
     185    Makefile:137: recipe for target 'annotate_variants.o' failed
  >> 186    make: *** [annotate_variants.o] Error 1
     187    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c dnbinom.c -o dnbinom.o
     188    Makefile:137: recipe for target 'annotate_regions.o' failed
  >> 189    make: *** [annotate_regions.o] Error 1
     190    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c imax2.c -o imax2.o
     191    In file included from hts_utils.h:43:0,
     192                     from program.h:33,
     193                     from align.h:27,
     194                     from align.cpp:24:
  >> 195    ./lib/htslib/htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     196     #include <zlib.h>
     197              ^~~~~~~~
     198    compilation terminated.
     199    Makefile:137: recipe for target 'align.o' failed
  >> 200    make: *** [align.o] Error 1
     201    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c pnchisq.c -o pnchisq.o
     202    In file included from bgzf.c:39:0:
  >> 203    htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     204     #include <zlib.h>
     205              ^~~~~~~~
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
     206    compilation terminated.
     207    gcc -g -Wall -O2 -I.  -c -o faidx.o faidx.c
     208    Makefile:134: recipe for target 'bgzf.o' failed
  >> 209    make[1]: *** [bgzf.o] Error 1
     210    make[1]: *** Waiting for unfinished jobs....
     211    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c qlogis.c -o qlogis.o
     212    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_match_data.o -c pcre2_match_data.c
     213    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_newline.o -c pcre2_newline.c
     214    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_ord2utf.o -c pcre2_ord2utf.c
     215    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c rhyper.c -o rhyper.o
     216    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c bessel_j.c -o bessel_j.o
     217    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c dnchisq.c -o dnchisq.o
     218    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c imin2.c -o imin2.o
     219    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c pnf.c -o pnf.o
     220    In file included from faidx.c:34:0:
  >> 221    htslib/bgzf.h:34:10: fatal error: zlib.h: No such file or directory
     222     #include <zlib.h>
     223              ^~~~~~~~
     224    compilation terminated.
     225    Makefile:134: recipe for target 'faidx.o' failed
  >> 226    make[1]: *** [faidx.o] Error 1
     227    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c qnbeta.c -o qnbeta.o
     228    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c rlnorm.c -o rlnorm.o
     229    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_pattern_info.o -c pcre2_pattern_info.c
     230    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_string_utils.o -c pcre2_string_utils.c
     231    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c bessel_k.c -o bessel_k.o
     232    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c dnf.c -o dnf.o

     ...

     247      return log(gammafn(p) * (gammafn(q) / gammafn(p + q)));
     248      ^~~~~~
     249    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_ucd.o -c pcre2_ucd.c
     250    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_valid_utf.o -c pcre2_valid_utf.c
     251    make[1]: Leaving directory '/tmp/support/spack-stage/spack-stage-nS2VZp/vt-0.577/lib/htslib'
     252    Makefile:123: recipe for target 'lib/htslib/libhts.a' failed
  >> 253    make: *** [lib/htslib/libhts.a] Error 1
     254    gcc -g -O3 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -I. -o pcre2_xclass.o -c pcre2_xclass.c
     255    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c dnorm.c -o dnorm.o
     256    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c lgamma.c -o lgamma.o
     257    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c pnt.c -o pnt.o
     258    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c qnchisq.c -o qnchisq.o
     259    gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -IRmath -DNDEBUG -c rmultinom.c -o rmultinom.o
```

### Platform and user environment

Please report your OS here:
```commandline
$ uname -a 
Linux n220 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -d
Description:	Ubuntu 18.04.1 LTS
``` 


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/vt/package.py b/var/spack/repos/builtin/packages/vt/package.py
--- a/var/spack/repos/builtin/packages/vt/package.py
+++ b/var/spack/repos/builtin/packages/vt/package.py
@@ -14,6 +14,8 @@ class Vt(MakefilePackage):
 
     version('0.577',  '59807456022bcecf978314c93254fe15')
 
+    depends_on('zlib')
+
     def install(self, spec, spack):
         mkdirp(prefix.bin)
         install('vt', prefix.bin)


Test patch: