Repository: spack/spack

Issue:
axom ^conduit@0.7.2 build fails: FindConduit.cmake: can't find conduit
`axom@0.4.0` build fails when using `conduit@0.7.2` using:
* `spack@develop` (7febe23ebcb33932661b6736be87969e465f867e from `Wed May 19 14:05:24 2021 -0700`)
* Ubuntu 20.04 GCC 9.3.0
* Ubuntu 18.04 GCC 7.5.0
* RHEL 7 GCC 9.3.0
* RHEL 8 GCC 8.3.1

Concrete spec: [axom.spec.yaml.txt](https://github.com/spack/spack/files/6511719/axom.spec.yaml.txt)
Build log: [axom-build-out.txt](https://github.com/spack/spack/files/6511723/axom-build-out.txt)

Reproduced inside Docker container image `ecpe4s/ubuntu20.04-runner-x86_64:2021-05-15`
```
$> git clone https://github.com/spack/spack
$> (cd spack && git checkout 7febe23ebc)

$> spack mirror add E4S https://cache.e4s.io
$> spack buildcache keys -it
OK

$> spack install --cache-only --only dependencies --include-build-deps -f ./axom.spec.yaml
OK

$> spack install --no-cache -f ./axom.spec.yaml
...
==> Installing axom-0.4.0-3e5ftk6etwk7vhomigezruqdfq5cgibz
==> Ran patch() for axom
==> axom: Executing phase: 'initconfig'
==> axom: Executing phase: 'cmake'
==> Error: ProcessError: Command exited with status 1:
    'cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/axom-0.4.0-3e5ftk6etwk7vhomigezruqdfq5cgibz' '-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=OFF' '-DCMAKE_INSTALL_RPATH:STRING=/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/axom-0.4.0-3e5ftk6etwk7vhomigezruqdfq5cgibz/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/axom-0.4.0-3e5ftk6etwk7vhomigezruqdfq5cgibz/lib64;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/conduit-0.7.2-z57346wkcbktol7blqmmq2lpumvdmrrr/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/hdf5-1.8.22-szvspwn2f255tmyazcdcsyfutiyngszh/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/mpich-3.4.1-frmqmomelxuruw6djdqwxtmdlqn7kb72/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/hwloc-2.4.1-q6hzuh4lmnlthnlqphvvyuk557hej35c/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/libpciaccess-0.16-ux5xkhgfhhmitpkxfuf5h6ooudsiwhd4/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/libxml2-2.9.10-qlt5ajqqmtin3atqcycnv67oex63cvny/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/libiconv-1.16-w6zptbclncs3jsnl3i4qtg72fgheiwdf/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/xz-5.2.5-ynkyqliadxgrqpk4mavevv3onehjrdco/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/zlib-1.2.11-p7dmb5pqi6svirhovljrkp3uyfiytz3m/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/ncurses-6.2-n5vhymfigwg6e45k7thdfyeswuhxojtx/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/libfabric-1.12.1-3g6fqlndfhmx2qqsgbk7ptfe7qv7tb65/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/lua-5.3.5-xgdyl636qj2wrcylr5256xgxsjpmjybv/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/readline-8.1-fvag4vkcyipnv5vihjke24xs4rz26opn/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/raja-0.13.0-l22sfjknjzhqf6vxsr34apzqkmz3zixd/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/camp-0.1.0-cmr4rmbw36urn2b72ghkesab3qepb3iz/lib;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/umpire-4.1.2-ofzdoemhytkqvaq4vaeifnarrdhfo6ep/lib' '-DCMAKE_PREFIX_PATH:STRING=/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/cmake-3.20.2-r5aseli7qzflnjylx6jxh2t7mh56md2t;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/conduit-0.7.2-z57346wkcbktol7blqmmq2lpumvdmrrr;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/hdf5-1.8.22-szvspwn2f255tmyazcdcsyfutiyngszh;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/lua-5.3.5-xgdyl636qj2wrcylr5256xgxsjpmjybv;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/mpich-3.4.1-frmqmomelxuruw6djdqwxtmdlqn7kb72;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/raja-0.13.0-l22sfjknjzhqf6vxsr34apzqkmz3zixd;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/umpire-4.1.2-ofzdoemhytkqvaq4vaeifnarrdhfo6ep' '-C' '/tmp/root/spack-stage/spack-stage-axom-0.4.0-3e5ftk6etwk7vhomigezruqdfq5cgibz/spack-src/0a99730195e0-linux-ubuntu20.04-x86_64-gcc@9.3.0.cmake' '-DENABLE_TESTS=OFF' '-DBUILD_SHARED_LIBS:BOOL=ON' '/tmp/root/spack-stage/spack-stage-axom-0.4.0-3e5ftk6etwk7vhomigezruqdfq5cgibz/spack-src/src'

1 error found in build log:
     89    -- HDF5 Definitions:
     90    -- HDF5 is parallel:  TRUE
     91    -- HDF5 using HDF5_DEFINITIONS + HDF5_INCLUDE_DIRS + HDF5_LIBRARIES
     92    -- HDF5_DEFINITIONS:
     93    -- HDF5_INCLUDE_DIRS: /spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/hdf5-1.8.22-szvspwn2f255tmyazcdcsyfutiyngszh/include;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/zl
           ib-1.2.11-p7dmb5pqi6svirhovljrkp3uyfiytz3m/include
     94    -- HDF5_LIBRARIES:    /spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/hdf5-1.8.22-szvspwn2f255tmyazcdcsyfutiyngszh/lib/libhdf5.a;/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.
           3.0/zlib-1.2.11-p7dmb5pqi6svirhovljrkp3uyfiytz3m/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so
  >> 95    CMake Error at cmake/thirdparty/FindConduit.cmake:24 (MESSAGE):
     96      Could not find Conduit cmake include file
     97      /spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/conduit-0.7.2-z57346wkcbktol7blqmmq2lpumvdmrrr/lib/cmake/ConduitConfig.cmake
     98    Call Stack (most recent call first):
     99      cmake/thirdparty/SetupAxomThirdParty.cmake:90 (include)
     100     cmake/CMakeBasics.cmake:20 (include)
     101     CMakeLists.txt:74 (include)
```

@cyrush @white238 


Discussion:
I'll have a PR up very shortly that should fix this.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/axom/package.py b/var/spack/repos/builtin/packages/axom/package.py
--- a/var/spack/repos/builtin/packages/axom/package.py
+++ b/var/spack/repos/builtin/packages/axom/package.py
@@ -39,6 +39,7 @@ class Axom(CachedCMakePackage, CudaPackage):
 
     version('main', branch='main', submodules=True)
     version('develop', branch='develop', submodules=True)
+    version('0.5.0', tag='v0.5.0', submodules=True)
     version('0.4.0', tag='v0.4.0', submodules=True)
     version('0.3.3', tag='v0.3.3', submodules=True)
     version('0.3.2', tag='v0.3.2', submodules=True)
@@ -95,6 +96,8 @@ class Axom(CachedCMakePackage, CudaPackage):
     depends_on("lua", when="+lua")
 
     depends_on("scr", when="+scr")
+    depends_on("kvtree@master", when="+scr")
+    depends_on("dtcmp", when="+scr")
 
     depends_on("raja~openmp", when="+raja~openmp")
     depends_on("raja+openmp", when="+raja+openmp")
@@ -124,6 +127,20 @@ class Axom(CachedCMakePackage, CudaPackage):
     depends_on("py-shroud", when="+devtools")
     depends_on("llvm+clang@10.0.0", when="+devtools", type='build')
 
+    # Conduit's cmake config files moved and < 0.4.0 can't find it
+    conflicts("conduit@0.7.2:", when="@:0.4.0")
+
+    # Sidre requires conduit_blueprint_mpi.hpp
+    conflicts("conduit@:0.6.0", when="@0.5.0:")
+
+    def flag_handler(self, name, flags):
+        if self.spec.satisfies('%cce') and name == 'fflags':
+            flags.append('-ef')
+
+        if name in ('cflags', 'cxxflags', 'cppflags', 'fflags'):
+            return (None, None, None)  # handled in the cmake cache
+        return (flags, None, None)
+
     def _get_sys_type(self, spec):
         sys_type = spec.architecture
         # if on llnl systems, we can use the SYS_TYPE
@@ -301,7 +318,7 @@ def initconfig_package_entries(self):
         entries.append(cmake_cache_path("CONDUIT_DIR", conduit_dir))
 
         # optional tpls
-        for dep in ('mfem', 'hdf5', 'lua', 'scr', 'raja', 'umpire'):
+        for dep in ('mfem', 'hdf5', 'lua', 'raja', 'umpire'):
             if '+%s' % dep in spec:
                 dep_dir = get_spec_path(spec, dep, path_replacements)
                 entries.append(cmake_cache_path('%s_DIR' % dep.upper(),
@@ -309,6 +326,18 @@ def initconfig_package_entries(self):
             else:
                 entries.append('# %s not build\n' % dep.upper())
 
+        if '+scr' in spec:
+            dep_dir = get_spec_path(spec, 'scr', path_replacements)
+            entries.append(cmake_cache_path('SCR_DIR', dep_dir))
+
+            # scr's dependencies
+            for dep in ('kvtree', 'dtcmp'):
+                if spec.satisfies('^{0}'.format(dep)):
+                    dep_dir = get_spec_path(spec, dep, path_replacements)
+                    entries.append(cmake_cache_path('%s_DIR' % dep.upper(), dep_dir))
+        else:
+            entries.append('# scr not build\n')
+
         ##################################
         # Devtools
         ##################################
@@ -336,16 +365,16 @@ def initconfig_package_entries(self):
             entries.append("# ClangFormat disabled due to disabled devtools\n")
             entries.append(cmake_cache_option("ENABLE_CLANGFORMAT", False))
 
-        if "+python" in spec or "+devtools" in spec:
+        if spec.satisfies('^python') or "+devtools" in spec:
             python_path = os.path.realpath(spec['python'].command.path)
             for key in path_replacements:
                 python_path = python_path.replace(key, path_replacements[key])
             entries.append(cmake_cache_path("PYTHON_EXECUTABLE", python_path))
 
-        enable_docs = "doxygen" in spec or "py-sphinx" in spec
+        enable_docs = spec.satisfies('^doxygen') or spec.satisfies('^py-sphinx')
         entries.append(cmake_cache_option("ENABLE_DOCS", enable_docs))
 
-        if "py-sphinx" in spec:
+        if spec.satisfies('^py-sphinx'):
             python_bin_dir = get_spec_path(spec, "python",
                                            path_replacements,
                                            use_bin=True)
@@ -353,14 +382,14 @@ def initconfig_package_entries(self):
                                             pjoin(python_bin_dir,
                                                   "sphinx-build")))
 
-        if "py-shroud" in spec:
+        if spec.satisfies('^py-shroud'):
             shroud_bin_dir = get_spec_path(spec, "py-shroud",
                                            path_replacements, use_bin=True)
             entries.append(cmake_cache_path("SHROUD_EXECUTABLE",
                                             pjoin(shroud_bin_dir, "shroud")))
 
-        for dep in ('uncrustify', 'cppcheck', 'doxygen'):
-            if dep in spec:
+        for dep in ('cppcheck', 'doxygen'):
+            if spec.satisfies('^%s' % dep):
                 dep_bin_dir = get_spec_path(spec, dep, path_replacements,
                                             use_bin=True)
                 entries.append(cmake_cache_path('%s_EXECUTABLE' % dep.upper(),
@@ -371,9 +400,6 @@ def initconfig_package_entries(self):
     def cmake_args(self):
         options = []
 
-        if self.spec.satisfies('%cce'):
-            options.append('-DCMAKE_Fortran_FLAGS=-ef')
-
         if self.run_tests is False:
             options.append('-DENABLE_TESTS=OFF')
         else:


Test patch: