Error on CADET installation on macOS

Hey guys,
I am trying to build CADET (core simulator) on my MacBook. What I have done:

  • install Homebrew
  • then I installed required dependencies: HDF5, SUNDIALS, SuperLU, and UMFPACK via Homebrew by a command 'homebrew install '.
  • next, I built a CADET.
  • since I did not build any dependency but installed via Homebrew, so I execute ‘cmake -DCMAKE_INSTALL_PREFIX="/cadet" …/code/’. Worked just fine and files were created on build folder.
  • I got the error when executing ‘make’. Couldn’t figure out why.

ERROR
Last login: Wed Oct 21 13:18:52 on ttys000
(base) hoangnguyen@MacBook-Pro-13 ~ % cd modsim-CADET
(base) hoangnguyen@MacBook-Pro-13 modsim-CADET % cd build
(base) hoangnguyen@MacBook-Pro-13 build % cmake -DCMAKE_INSTALL_PREFIX="/Users/hoangnguyen/modsim-CADET/build/cadet" …/code/
– Found Git: /usr/bin/git (found version “2.24.3 (Apple Git-128)”)
– Get version from file
– CADET version: 4.1.0
– Current git HEAD: GITDIR-NOTFOUND SHA1 GITDIR-NOTFOUND
– The CXX compiler identification is AppleClang 12.0.0.12000032
– The C compiler identification is AppleClang 12.0.0.12000032
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Build type: Release (default)
– Found TBB: /usr/local/include (found version “2020.3”) found components: tbb missing components: tbb_preview
– Looking for sgemm_
– Looking for sgemm_ - not found
– Looking for sgemm
– Looking for sgemm - not found
– 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 dgemm_
– Looking for dgemm_ - found
– Found BLAS: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Accelerate.framework
– Looking for cheev_
– Looking for cheev_ - found
– A library with LAPACK API found.
– Found SUNDIALS: /usr/local/lib/libsundials_idas.dylib;/usr/local/lib/libsundials_nvecserial.dylib (found version “5.4.0”) found components: sundials_idas sundials_nvecserial missing components: sundials_nvecopenmp
/Users/hoangnguyen/anaconda3/bin/h5cc: line 318: x86_64-apple-darwin13.4.0-clang: command not found
– HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
– Found HDF5: /usr/local/lib/libhdf5.dylib (found version “1.12.0”) found components: C
– Performing Test HDF5_DONT_NEED_ZLIBS
– Performing Test HDF5_DONT_NEED_ZLIBS - Success
– Found SuperLU: TRUE (found version “5.2.1”)
– Found UMFPACK: TRUE (found version “5.7.9”)
– Looking for mxCreateUninitNumericMatrix
– Looking for mxCreateUninitNumericMatrix - found
– Looking for mxCreateUninitNumericArray
– Looking for mxCreateUninitNumericArray - found
– Looking for dgbtrf
– Looking for dgbtrf - not found
– Looking for dgbtrf_
– Looking for dgbtrf_ - found
– Found Matlab: /Applications/MATLAB_R2019b.app/extern/include (found version “9.7”) found components: MX_LIBRARY LAPACK_LIBRARY TBB_LIBRARY UMFPACK_LIBRARY
– AD library: SFAD
– Added build tools
– Performing Test COMPILER_SUPPORT_NOEXCEPT_DEFAULTED_MOVE
– Performing Test COMPILER_SUPPORT_NOEXCEPT_DEFAULTED_MOVE - Success
– Added LIBCADET module
– Added CADET-CLI module
– Performing Test HAS_MINUS_PTHREAD
– Performing Test HAS_MINUS_PTHREAD - Success
– Added CADET-MEX module
– Added tools
– Added tests

--------------------------- Feature Summary ---------------------------
– The following features have been enabled:

  • ENABLE_LOGGING, Enables logging
  • ENABLE_THREADING, Use multi-threading
  • ENABLE_GRM_2D, Build 2D general rate model
  • ENABLE_CADET_CLI, Build CADET command line interface
  • ENABLE_CADET_MEX, Build CADET Matlab MEX interface
  • ENABLE_CADET_TOOLS, Build CADET tools
  • ENABLE_TESTS, Build CADET tests
  • ENABLE_IPO, Enable interprocedural optimization if compiler supports it
  • CMAKE_INSTALL_RPATH_USE_LINK_PATH, Add paths to linker search and installed rpath
  • MATLAB_USE_SYSTEM_LAPACK, Forcefully enables usage of system’s LAPACK instead of MATLAB’s one
  • MATLAB_ENABLE_THREADING, Enable multi-threading in MATLAB
  • MATLAB_USE_SYSTEM_TBB, Forcefully enables usage of system TBB instead of MATLAB’s one

– The following OPTIONAL packages have been found:

  • Git
  • BLAS
  • Threads

– The following RECOMMENDED packages have been found:

– The following REQUIRED packages have been found:

– The following features have been disabled:

  • ENABLE_BENCHMARK, Enables benchmark mode (fine-grained timing)
  • ENABLE_PLATFORM_TIMER, Use a platform-dependent timer
  • ENABLE_DEBUG_THREADING, Use multi-threading in debug builds
  • ENABLE_SUNDIALS_OPENMP, Prefer OpenMP vector implementation of SUNDIALS if available (for large problems)
  • ENABLE_ANALYTIC_JACOBIAN_CHECK, Enable verification of analytical Jacobian by AD
  • ENABLE_STATIC_LINK_DEPS, Prefer static over dynamic linking of dependencies
  • ENABLE_STATIC_LINK_LAPACK, Prefer static over dynamic linking of LAPACK and BLAS
  • ENABLE_STATIC_LINK_CLI, Prefer static over dynamic linking for CADET CLI
  • MATLAB_FORCE_UMFPACK, Forcefully use MATLAB’s UMFPACK as sole sparse solver in MEX interface
  • MATLAB_FORCE_ENABLE_TBB, Forcefully enable usage of MATLAB’s TBB library in case system TBB is not compatible and not enforced

------------------------------- Summary -------------------------------
C++ compiler name: AppleClang at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
Build type: Release
Source dir: /Users/hoangnguyen/modsim-CADET/code
Binary dir: /Users/hoangnguyen/modsim-CADET/build
Install dir: /Users/hoangnguyen/modsim-CADET/build/cadet
C Flags:
C++ Flags:
IPO enabled: ON
------------------------------- Modules -------------------------------
CADET-CLI: ON
CADET-MEX: ON
Tools: ON
Tests: ON
------------------------------- Options -------------------------------
Logging: ON
Benchmark mode: OFF
Platform-dependent timer: OFF
AD library: sfad
2D General Rate Model: ON
Check analytic Jacobian: OFF
----------------------------- Dependencies ----------------------------
Found BLAS: TRUE
Linker flags
Libs /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Accelerate.framework
Underscore suffix TRUE
Found LAPACK: TRUE
Linker flags
Libs /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Accelerate.framework;-lm;-ldl
Found TBB: TRUE
Version 2020.3 (Interface 11103)
Include /usr/local/include
Definitions __TBB_NO_IMPLICIT_LINKAGE=1
Libs /usr/local/lib/libtbb.dylib
Found SUNDIALS: TRUE
Version 5.4.0
Includes /usr/local/include/sundials/…;/usr/local/include/sundials
Libs /usr/local/lib/libsundials_idas.dylib;/usr/local/lib/libsundials_nvecserial.dylib
Found SuperLU: TRUE
Version 5.2.1
Includes /usr/local/include/superlu
Libs /usr/local/lib/libsuperlu.a;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Accelerate.framework
Integer type int
Found UMFPACK: TRUE
Version 5.7.9
Includes /usr/local/include
Libs /usr/local/lib/libumfpack.dylib;/usr/local/lib/libcolamd.dylib;/usr/local/lib/libccolamd.dylib;/usr/local/lib/libamd.dylib;/usr/local/lib/libcamd.dylib;/usr/local/lib/libcholmod.dylib;/usr/local/lib/libsuitesparseconfig.dylib;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Accelerate.framework;/usr/local/lib/libmetis.dylib
Found HDF5: TRUE
Version 1.12.0
Includes /usr/local/include
Libs /usr/local/lib/libhdf5.dylib
Defs
Found Matlab: TRUE
Version 9.7
In /Applications/MATLAB_R2019b.app
Includes /Applications/MATLAB_R2019b.app/extern/include
Libs /Applications/MATLAB_R2019b.app/bin/maci64/libmex.dylib;/Applications/MATLAB_R2019b.app/bin/maci64/libmx.dylib;/Applications/MATLAB_R2019b.app/bin/maci64/libMatlabDataArray.dylib;/Applications/MATLAB_R2019b.app/extern/bin/maci64/libMatlabEngine.dylib;/Applications/MATLAB_R2019b.app/bin/maci64/libmwlapack.dylib;/Applications/MATLAB_R2019b.app/bin/maci64/libmwblas.dylib;/Applications/MATLAB_R2019b.app/bin/maci64/libtbb.dylib;/Applications/MATLAB_R2019b.app/bin/maci64/libmwumfpack.dylib
MKL /Applications/MATLAB_R2019b.app/bin/maci64/libmwlapack.dylib /Applications/MATLAB_R2019b.app/bin/maci64/libmwblas.dylib
LAPACK functions have trailing underscore: ON
Declares mxCreateUninitNumericMatrix: ON
Declares mxCreateUninitNumericArray: ON
TBB /Applications/MATLAB_R2019b.app/bin/maci64/libtbb.dylib (interface version 9104)
Parallelization (TBB compatibility):
UMFPACK /Applications/MATLAB_R2019b.app/bin/maci64/libmwumfpack.dylib (enforced OFF)

– Configuring done
– Generating done
– Build files have been written to: /Users/hoangnguyen/modsim-CADET/build
(base) hoangnguyen@MacBook-Pro-13 build % make
Scanning dependencies of target templateCodeGen
[ 0%] Building CXX object src/build-tools/CMakeFiles/templateCodeGen.dir/templateCodeGen.cpp.o
[ 1%] Linking CXX executable templateCodeGen
[ 1%] Built target templateCodeGen
Scanning dependencies of target libcadet_nonlinalg_static
[ 1%] Building CXX object src/libcadet/CMakeFiles/libcadet_nonlinalg_static.dir/linalg/BandMatrix.cpp.o
[ 1%] Building CXX object src/libcadet/CMakeFiles/libcadet_nonlinalg_static.dir/linalg/DenseMatrix.cpp.o
[ 2%] Building CXX object src/libcadet/CMakeFiles/libcadet_nonlinalg_static.dir/linalg/SparseMatrix.cpp.o
[ 2%] Building CXX object src/libcadet/CMakeFiles/libcadet_nonlinalg_static.dir/linalg/CompressedSparseMatrix.cpp.o
[ 3%] Building CXX object src/libcadet/CMakeFiles/libcadet_nonlinalg_static.dir/linalg/Gmres.cpp.o
/Users/hoangnguyen/modsim-CADET/code/src/libcadet/linalg/Gmres.cpp:141:9: error:
use of undeclared identifier ‘flag’
return flag;
^
1 error generated.
make[2]: *** [src/libcadet/CMakeFiles/libcadet_nonlinalg_static.dir/linalg/Gmres.cpp.o] Error 1
make[1]: *** [src/libcadet/CMakeFiles/libcadet_nonlinalg_static.dir/all] Error 2
make: *** [all] Error 2
(base) hoangnguyen@MacBook-Pro-13 build %

If anyone figures out why, please let me know.

Thank you so much for your time.

You have SUNDIALS 5.4.0. CADET only works with SUNDIALS up to (including) version 3.2.1.

You will need to install SUNDIALS 3.2.1 manually:

  • Download SUNDIALS source
  • Unzip
  • Open a terminal and change to the parent directory of the unzipped directory
  • Create a new folder sundialsbuild and change to it
  • Execute
    cmake -DCMAKE_INSTALL_PREFIX="<ROOT>/Libs/sundials" -DEXAMPLES_ENABLE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=Release ../sundials-3.2.1/
    
    where <ROOT> is some directory (e.g., /Users/hoangnguyen/modsim-CADET/)
  • Execute make install
  • Delete the folder sundialsbuild (e.g., execute rm -rf sundialsbuild in the parent directory of sundialsbuild)

When calling cmake on CADET, you need to point it at your SUNDIALS installation:

cd /Users/hoangnguyen/modsim-CADET/build
cmake -DCMAKE_INSTALL_PREFIX="/Users/hoangnguyen/modsim-CADET/install" -DSUNDIALS_ROOT="/Users/hoangnguyen/modsim-CADET/Libs/sundials" …/code/

Thank you so much Samuel. It is resolved now :slight_smile: