Repository: spack/spack

Issue:
Installation issue:  pdf2svg
```
==> Installing pdf2svg
==> Searching for binary cache of pdf2svg
==> Finding buildcaches in build_cache
==> No binary for pdf2svg found: installing from source


1 error found in build log:
     23    checking for style of include used by make... GNU
     24    checking dependency style of blahblah/lib/spack/env/gcc/gcc... gcc3
     25    checking for an ANSI C-conforming const... yes
     26    checking for pkg-config... /bin/pkg-config
     27    checking pkg-config is at least version 0.9.0... yes
     28    checking for CAIRO... no
  >> 29    configure: error: Package requirements (cairo >= 1.2.6) were not met:
     30
     31    Package xdmcp was not found in the pkg-config search path.
     32    Perhaps you should add the directory containing `xdmcp.pc'
     33    to the PKG_CONFIG_PATH environment variable
     34    Package 'xdmcp', required by 'XCB', not found
```
Cairo is built, listed in the build package, and is definitely already installed.
Packages is not picking it up
```console
$ spack spec pdf2svg
Input spec
--------------------------------
pdf2svg

Concretized
--------------------------------
pdf2svg@0.2.3%gcc@5.4.0 arch=linux-centos7-x86_64
    ^cairo@1.14.12%gcc@5.4.0+X arch=linux-centos7-x86_64
        ^fontconfig@2.12.3%gcc@5.4.0 arch=linux-centos7-x86_64
            ^font-util@1.3.1%gcc@5.4.0 arch=linux-centos7-x86_64
                ^pkgconf@1.4.2%gcc@5.4.0 arch=linux-centos7-x86_64
                ^util-macros@1.19.1%gcc@5.4.0 arch=linux-centos7-x86_64
            ^freetype@2.9.1%gcc@5.4.0 arch=linux-centos7-x86_64
                ^bzip2@1.0.6%gcc@5.4.0+shared arch=linux-centos7-x86_64
                    ^diffutils@3.6%gcc@5.4.0 arch=linux-centos7-x86_64
                ^libpng@1.6.34%gcc@5.4.0 arch=linux-centos7-x86_64
                    ^zlib@1.2.11%gcc@5.4.0+optimize+pic+shared arch=linux-centos7-x86_64
            ^gperf@3.0.4%gcc@5.4.0 arch=linux-centos7-x86_64
            ^libxml2@2.9.8%gcc@5.4.0~python arch=linux-centos7-x86_64
                ^xz@5.2.4%gcc@5.4.0 arch=linux-centos7-x86_64
        ^glib@2.56.2%gcc@5.4.0~libmount patches=c325997b72a205ad1638bb3e3ba0e5b73e3d32ce63b2d0d3282f3e3a2ff4663c tracing= arch=linux-centos7-x86_64
            ^gettext@0.19.8.1%gcc@5.4.0+bzip2+curses+git~libunistring+libxml2 patches=9acdb4e73f67c241b5ef32505c9ddf7cf6884ca8ea661692f21dca28483b04b8 +tar+xz arch=linux-centos7-x86_64
                ^ncurses@6.1%gcc@5.4.0~symlinks~termlib arch=linux-centos7-x86_64
                ^tar@1.30%gcc@5.4.0 arch=linux-centos7-x86_64
            ^libffi@3.2.1%gcc@5.4.0 arch=linux-centos7-x86_64
            ^pcre@8.42%gcc@5.4.0~jit+utf arch=linux-centos7-x86_64
            ^perl@5.26.2%gcc@5.4.0+cpanm patches=0eac10ed90aeb0459ad8851f88081d439a4e41978e586ec743069e8b059370ac +shared+threads arch=linux-centos7-x86_64
                ^gdbm@1.14.1%gcc@5.4.0 arch=linux-centos7-x86_64
                    ^readline@7.0%gcc@5.4.0 arch=linux-centos7-x86_64
            ^python@2.7.15%gcc@5.4.0+dbm~optimizations patches=123082ab3483ded78e86d7c809e98a804b3465b4683c96bd79a2fd799f572244 +pic+pythoncmd+shared~tk~ucs4 arch=linux-centos7-x86_64
                ^openssl@1.0.2o%gcc@5.4.0+systemcerts arch=linux-centos7-x86_64
                ^sqlite@3.23.1%gcc@5.4.0~functions arch=linux-centos7-x86_64
        ^libx11@1.6.5%gcc@5.4.0 arch=linux-centos7-x86_64
            ^inputproto@2.3.2%gcc@5.4.0 arch=linux-centos7-x86_64
            ^kbproto@1.0.7%gcc@5.4.0 arch=linux-centos7-x86_64
            ^libxcb@1.13%gcc@5.4.0 arch=linux-centos7-x86_64
                ^libpthread-stubs@0.4%gcc@5.4.0 arch=linux-centos7-x86_64
                ^libxau@1.0.8%gcc@5.4.0 arch=linux-centos7-x86_64
                    ^xproto@7.0.31%gcc@5.4.0 arch=linux-centos7-x86_64
                ^libxdmcp@1.1.2%gcc@5.4.0 arch=linux-centos7-x86_64
                ^xcb-proto@1.13%gcc@5.4.0 arch=linux-centos7-x86_64
            ^xextproto@7.3.0%gcc@5.4.0 arch=linux-centos7-x86_64
            ^xtrans@1.3.5%gcc@5.4.0 arch=linux-centos7-x86_64
        ^libxext@1.3.3%gcc@5.4.0 arch=linux-centos7-x86_64
        ^libxrender@0.9.10%gcc@5.4.0 arch=linux-centos7-x86_64
            ^renderproto@0.11.1%gcc@5.4.0 arch=linux-centos7-x86_64
        ^pixman@0.34.0%gcc@5.4.0 arch=linux-centos7-x86_64
    ^poppler@0.65.0%gcc@5.4.0 build_type=RelWithDebInfo ~cairo~cms~glib~gobject~iconv~jpeg~libcurl~openjpeg~png~qt5~tiff~zlib arch=linux-centos7-x86_64
        ^cmake@3.12.3%gcc@5.4.0~doc+ncurses+openssl+ownlibs patches=dd3a40d4d92f6b2158b87d6fb354c277947c776424aa03f6dc8096cf3135f5d0 ~qt arch=linux-centos7-x86_64
        ^poppler-data@0.4.9%gcc@5.4.0 build_type=RelWithDebInfo arch=linux-centos7-x86_64
```


Discussion:
The issue is the dependency type. Let me see if I can fix this real quick.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/pdf2svg/package.py b/var/spack/repos/builtin/packages/pdf2svg/package.py
--- a/var/spack/repos/builtin/packages/pdf2svg/package.py
+++ b/var/spack/repos/builtin/packages/pdf2svg/package.py
@@ -15,5 +15,11 @@ class Pdf2svg(AutotoolsPackage):
     version('0.2.3', 'd398b3b1c1979f554596238a44f12123')
     version('0.2.2', 'f7e0d2213f9e1422cee9421e18f72553')
 
-    depends_on('cairo', type='run')
-    depends_on('poppler', type='run')
+    depends_on('pkgconfig@0.9.0:', type='build')
+    depends_on('cairo@1.2.6:')
+    depends_on('poppler@0.5.4:+glib')
+
+    # Note: the latest version of poppler requires glib 2.41+,
+    # but pdf2svg uses g_type_init, which is deprecated in glib 2.36+.
+    # At some point, we will need to force pdf2svg to use older
+    # versions of poppler and glib.
diff --git a/var/spack/repos/builtin/packages/poppler/package.py b/var/spack/repos/builtin/packages/poppler/package.py
--- a/var/spack/repos/builtin/packages/poppler/package.py
+++ b/var/spack/repos/builtin/packages/poppler/package.py
@@ -10,21 +10,22 @@ class Poppler(CMakePackage):
     """Poppler is a PDF rendering library based on the xpdf-3.0 code base."""
 
     homepage = "https://poppler.freedesktop.org"
-    url      = "https://poppler.freedesktop.org/poppler-0.72.0.tar.xz"
+    url      = "https://poppler.freedesktop.org/poppler-0.77.0.tar.xz"
     list_url = "https://poppler.freedesktop.org/releases.html"
 
+    version('0.77.0', sha256='7267eb4cbccd64a58244b8211603c1c1b6bf32c7f6a4ced2642865346102f36b')
     version('0.72.0', sha256='c1747eb8f26e9e753c4001ed951db2896edc1021b6d0f547a0bd2a27c30ada51')
     version('0.65.0', 'b9a0af02e43deb26265f130343e90d78')
     version('0.64.0', 'f7f687ebb60004f8ad61994575018044')
 
     variant('cms',      default=False, description='Use color management system')
+    variant('cpp',      default=False, description='Compile poppler cpp wrapper')
     variant('glib',     default=False, description='Compile poppler glib wrapper')
     variant('gobject',  default=False, description='Generate GObject introspection')
     variant('libcurl',  default=False, description='Build libcurl based HTTP support')
     variant('openjpeg', default=False, description='Use libopenjpeg for JPX streams')
     variant('qt5',      default=False, description='Compile poppler qt5 wrapper')
     variant('zlib',     default=False, description='Build with zlib')
-    variant('cairo',    default=False, description='Search for Cairo package')
     variant('iconv',    default=False, description='Search for Iconv package')
     variant('jpeg',     default=False, description='Search for JPEG package')
     variant('png',      default=False, description='Search for PNG package')
@@ -37,13 +38,13 @@ class Poppler(CMakePackage):
     depends_on('freetype')
 
     depends_on('lcms', when='+cms')
-    depends_on('glib', when='+glib')
+    depends_on('glib@2.41:', when='+glib')
     depends_on('gobject-introspection', when='+gobject')
     depends_on('curl', when='+libcurl')
     depends_on('openjpeg', when='+openjpeg')
     depends_on('qt@5.0:5.999', when='+qt5')
     depends_on('zlib', when='+zlib')
-    depends_on('cairo', when='+cairo')
+    depends_on('cairo@1.10.0:', when='+glib')
     depends_on('libiconv', when='+iconv')
     depends_on('jpeg', when='+jpeg')
     depends_on('libpng', when='+png')
@@ -72,10 +73,23 @@ def cmake_args(self):
         else:
             args.append('-DENABLE_CMS=none')
 
+        if '+cpp' in spec:
+            args.append('-DENABLE_CPP=ON')
+        else:
+            args.append('-DENABLE_CPP=OFF')
+
         if '+glib' in spec:
-            args.append('-DENABLE_GLIB=ON')
+            args.extend([
+                '-DENABLE_GLIB=ON',
+                '-DWITH_GLIB=ON',
+                '-DWITH_Cairo=ON',
+            ])
         else:
-            args.append('-DENABLE_GLIB=OFF')
+            args.extend([
+                '-DENABLE_GLIB=OFF',
+                '-DWITH_GLIB=OFF',
+                '-DWITH_Cairo=OFF',
+            ])
 
         if '+gobject' in spec:
             args.append('-DENABLE_GOBJECT_INTROSPECTION=ON')
@@ -102,11 +116,6 @@ def cmake_args(self):
         else:
             args.append('-DENABLE_ZLIB=OFF')
 
-        if '+cairo' in spec:
-            args.append('-DWITH_Cairo=ON')
-        else:
-            args.append('-DWITH_Cairo=OFF')
-
         if '+iconv' in spec:
             args.append('-DWITH_Iconv=ON')
         else:


Test patch: