lanl/Draco

CMake Error at config/setupMPI.cmake:54 (Unknown arguments specified)

Closed this issue · 4 comments

I assume I do not have some dependency installed, but CMake should give a good error what is missing. This looks like a bug in config/setupMPI.cmake:54. I am using Ubuntu 18.04, and I installed cmake using spack.

$ mkdir build
$ cd build
$ module load cmake-3.15.4-gcc-7.4.0-ws6w22p
$ cmake ..
-- The CXX compiler identification is GNU 7.4.0
-- The C compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done

======================================================
This is Draco version 7.3.20191104.
======================================================


Platform Checks...

-- Looking to see if we are building in a Cray Environment...
-- Looking to see if we are building in a Cray Environment...no.
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file limits.h
-- Looking for include file limits.h - found
-- Looking for include file winsock2.h
-- Looking for include file winsock2.h - not found
-- Looking for include file direct.h
-- Looking for include file direct.h - not found
-- Looking for include file sys/param.h
-- Looking for include file sys/param.h - found
-- Looking for gethostname
-- Looking for gethostname - found
-- Looking for HOST_NAME_MAX
-- Looking for HOST_NAME_MAX - found
-- Looking for _POSIX_HOST_NAME_MAX
-- Looking for _POSIX_HOST_NAME_MAX - not found
-- Looking for MAXHOSTNAMELEN
-- Looking for MAXHOSTNAMELEN - found
-- Looking for MAXPATHLEN
-- Looking for MAXPATHLEN - found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for the C99 restrict keyword
-- Performing Test HAVE_RESTRICT
-- Performing Test HAVE_RESTRICT - Success
-- Looking for the C99 restrict keyword - found __restrict
-- Looking for hardware FMA support...
-- Looking for hardware FMA support...found fma.
-- Looking for hardware AVX2 support...
-- Looking for hardware AVX2 support...found AVX2.

Compiler Setup...

-- Looking for OpenMP...
-- Looking for OpenMP... -fopenmp
-- Performing Test HAS_MARCH_NATIVE
-- Performing Test HAS_MARCH_NATIVE - Success
-- Performing Test HAS_WNOEXCEPT
-- Performing Test HAS_WNOEXCEPT - Success
-- Performing Test HAS_WSUGGEST_ATTRIBUTE
-- Performing Test HAS_WSUGGEST_ATTRIBUTE - Success
-- Performing Test HAS_WUNUSED_LOCAL_TYPEDEFS
-- Performing Test HAS_WUNUSED_LOCAL_TYPEDEFS - Success
-- Looking for ccache...
-- Looking for ccache... not found.
-- Looking for f90cache...
-- Looking for f90cache... not found.
-- Looking for CMakeAddFortranSubdirectory Fortran compiler...
-- Looking for CMakeAddFortranSubdirectory Fortran compiler... found /usr/bin/gfortran

Vendor Setup:

-- Looking for lapack (netlib)...
-- Looking for lapack (netlib)....not found
-- Looking for lapack (OpenBLAS)...
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Looking for lapack (OpenBLAS)...NOTFOUND
-- Looking for lapack (no cmake config files)...
-- Looking for lapack(no cmake config)...NOTFOUND
-- Looking for MPI...
CMake Error at config/setupMPI.cmake:54 (elseif):
  given arguments:

    "STREQUAL" "spectrum"

  Unknown arguments specified
Call Stack (most recent call first):
  config/setupMPI.cmake:426 (setMPIflavorVer)
  config/vendor_libraries.cmake:785 (setupMPILibrariesUnix)
  CMakeLists.txt:95 (setupVendorLibraries)


-- Configuring incomplete, errors occurred!
See also "/home/certik/repos/Draco/build/CMakeFiles/CMakeOutput.log".
See also "/home/certik/repos/Draco/build/CMakeFiles/CMakeError.log".

@david8dixon thanks for the feedback. Actually it is possible to ensure CMake gives meaningful error messages --- that's the whole point of using it. :)

In this case, this is a Draco specific module that has a bug in it. It's missing " around ${MPI_FLAVOR}:

diff --git a/config/setupMPI.cmake b/config/setupMPI.cmake
index da522499..5b5e27c5 100644
--- a/config/setupMPI.cmake
+++ b/config/setupMPI.cmake
@@ -51,7 +51,7 @@ function( setMPIflavorVer )
     if( DEFINED ENV{CRAY_MPICH2_VER} )
       set( MPI_VERSION $ENV{CRAY_MPICH2_VER} )
     endif()
-  elseif( ${MPI_FLAVOR} STREQUAL "spectrum" )
+  elseif( "${MPI_FLAVOR}" STREQUAL "spectrum" )
     if( DEFINED ENV{LMOD_MPI_VERSION} )
       set( LMOD_MPI_VERSION $ENV{LMOD_MPI_VERSION} )
     endif()

Now I get a meaningful error (missing GSL):

$ cmake ..

======================================================
This is Draco version 7.3.20191104.
======================================================

-- Looking for CMakeAddFortranSubdirectory Fortran compiler...
-- Looking for CMakeAddFortranSubdirectory Fortran compiler... found /usr/bin/gfortran

Vendor Setup:

-- Looking for lapack (netlib)...
-- Looking for lapack (netlib)....not found
-- Looking for lapack (OpenBLAS)...
-- Looking for lapack (OpenBLAS)...NOTFOUND
-- Looking for lapack (no cmake config files)...
-- Looking for lapack(no cmake config)...NOTFOUND
-- Looking for MPI...
-- Looking for MPI.......found /usr/bin/mpiexec
-- Looking for GSL...
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
CMake Error at /home/certik/repos/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gcc-7.4.0/cmake-3.15.4-ws6w22pub7i7durz7njjdzg2hhfxytvc/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find GSL (missing: GSL_INCLUDE_DIR GSL_LIBRARY GSL_CBLAS_LIBRARY)
  (found version "")
Call Stack (most recent call first):
  /home/certik/repos/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gcc-7.4.0/cmake-3.15.4-ws6w22pub7i7durz7njjdzg2hhfxytvc/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /home/certik/repos/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gcc-7.4.0/cmake-3.15.4-ws6w22pub7i7durz7njjdzg2hhfxytvc/share/cmake-3.15/Modules/FindGSL.cmake:149 (find_package_handle_standard_args)
  config/vendor_libraries.cmake:424 (find_package)
  config/vendor_libraries.cmake:617 (setupGSL)
  config/vendor_libraries.cmake:786 (setupVendorLibrariesUnix)
  CMakeLists.txt:95 (setupVendorLibraries)


-- Configuring incomplete, errors occurred!
See also "/home/certik/repos/Draco/build/CMakeFiles/CMakeOutput.log".
See also "/home/certik/repos/Draco/build/CMakeFiles/CMakeError.log".

Yes, I have MPI. I fixed this particular bug in #693. I think that's all there was to it.