GEOS-DEV / thirdPartyLibs

Repository to build the GEOSX third party libraries
3 stars 12 forks source link

Chai/umpaire cmake issue on macos: No known features for CXX compiler #157

Closed ouassimk closed 3 years ago

ouassimk commented 3 years ago

Hi, I wasn't able to build chai library on a macos machine following the steps on Quick start guide. I also checked Third party dependencies. The error happens when I run make inside build--release folder. The problem seems related to umpire library but I wasn't able to debug it. There is only one issue on the project (#149) that is related to umpaire but it dons't correspond to my case. I was able to build, run and debug GEOSX code on Linux machine (PopOs 20.10) without an issue, but I faced challenges to build TPL on macos in the past and now as well. Thank you for the help.

Cmake error:

[ 37%] Performing configure step for 'chai'
-- The CXX compiler identification is Clang 12.0.0
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- BLT Version: 0.3.6
-- CMake Version: 3.17.3
-- CMake Executable: /opt/local/bin/cmake
-- Found Git: /usr/local/bin/git (found version "2.29.2") 
-- Git Support is ON
-- Git Executable: /usr/local/bin/git
-- Git Version: 2.29.2
-- MPI Support is Off
-- OpenMP Support is OFF
-- CUDA Support is OFF
-- HIP Support is Off
-- HCC Support is OFF
-- Sphinx support is OFF
-- Valgrind support is ON
-- Found Valgrind: /usr/local/bin/valgrind  
-- AStyle support is ON
-- Found AStyle: /usr/local/bin/astyle  
-- ClangFormat support is ON
-- Found ClangFormat: /usr/local/opt/llvm/bin/clang-format  
-- Uncrustify support is ON
-- Found Uncrustify: /usr/local/bin/uncrustify  
-- Cppcheck support is ON
-- Found Cppcheck: /usr/local/bin/cppcheck  
-- ClangQuery support is ON
-- Found ClangQuery: /usr/local/opt/llvm/bin/clang-query  
-- C Compiler family is Clang
-- Adding optional BLT definitions and compiler flags
-- Standard C++11 selected
-- Enabling all compiler warnings on all targets.
-- Fortran support disabled.
-- CMAKE_C_FLAGS flags are:    -Wall -Wextra 
-- CMAKE_CXX_FLAGS flags are:       -Wall -Wextra     -Wall -Wextra 
-- CMAKE_EXE_LINKER_FLAGS flags are:  -L/usr/local/opt/llvm/lib
-- The C compiler identification is Clang 12.0.0
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Using CMake version 3.17.3
-- Setting C standard to 99
-- Checking for std::filesystem
-- Performing Test UMPIRE_ENABLE_FILESYSTEM
-- Performing Test UMPIRE_ENABLE_FILESYSTEM - Failed
-- std::filesystem NOT found, using POSIX
-- Performing Test UMPIRE_HAS_ASAN
-- Performing Test UMPIRE_HAS_ASAN - Success
-- Umpire may be built with ASAN support
-- CHAI: using external RAJA via find_package /Users/ouassimkhebzegga/code/GEOSX/thirdPartyLibs/install-my-darwin-clang-geosx-release/raja/share/raja/cmake
-- Configuring done
CMake Error in src/tpl/umpire/src/umpire/CMakeLists.txt:
  No known features for CXX compiler

  "Clang"

  version 12.0.0.

CMake Generate step failed.  Build files cannot be regenerated correctly.
make[2]: *** [chai/src/chai-stamp/chai-configure] Error 1
make[1]: *** [CMakeFiles/chai.dir/all] Error 2
make: *** [all] Error 2

MacOs: ProductName: macOS ProductVersion: 11.2.3 BuildVersion: 20D91

clang: clang version 12.0.0 Target: x86_64-apple-darwin20.3.0 Thread model: posix InstalledDir: /usr/local/opt/llvm/bin

gfortran: GNU Fortran (Homebrew GCC 10.2.0_4) 10.2.0

cmak config:

site_name(HOST_NAME)
set(CONFIG_NAME "${HOST_NAME}-darwin-x86_64-clang@apple-mp" CACHE PATH "") 
message("CONFIG_NAME = ${CONFIG_NAME}")

set(CMAKE_C_COMPILER "/usr/local/opt/llvm/bin/clang" CACHE PATH "")
set(CMAKE_CXX_COMPILER "/usr/local/opt/llvm/bin/clang++" CACHE PATH "")
set(CMAKE_Fortran_COMPILER "/usr/local/bin/gfortran" CACHE PATH "")
set(ENABLE_FORTRAN OFF CACHE BOOL "" FORCE)

set(ENABLE_MPI ON CACHE PATH "")
set(MPI_C_COMPILER "/usr/local/bin/mpicc" CACHE PATH "")
set(MPI_CXX_COMPILER "/usr/local/bin/mpicxx" CACHE PATH "")
set(MPIEXEC "/usr/local/bin/mpirun" CACHE PATH "")
set(MPI_Fortran_COMPILER "/usr/local/bin/mpifort" CACHE PATH "")

set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "" FORCE)

set(ENABLE_PAMELA ON CACHE BOOL "" FORCE)
set(ENABLE_PVTPackage ON CACHE BOOL "" FORCE)
set(ENABLE_GEOSX_PTP OFF CACHE BOOL "" FORCE)

set(CUDA_ENABLED "OFF" CACHE PATH "" FORCE)
set(CHAI_BUILD_TYPE   "cpu-no-rm" CACHE PATH "" FORCE )
set(CHAI_ARGS         ""          CACHE PATH "" FORCE )

set(ENABLE_OPENMP "OFF" CACHE PATH "" FORCE)
set(ENABLE_CALIPER "OFF" CACHE PATH "" FORCE )
set(ENABLE_SPHINX "OFF" CACHE PATH "" FORCE )
set(ENABLE_UNCRUSTIFY "OFF" CACHE PATH "" FORCE )
set(VALGRIND_EXECUTABLE "/usr/local/bin/valgrind" CACHE PATH "")
set(ASTYLE_EXECUTABLE "/usr/local/bin/astyle" CACHE PATH "")
set(CPPCHECK_EXECUTABLE "/usr/local/bin/cppcheck" CACHE PATH "")
set(UNCRUSTIFY_EXECUTABLE "/usr/local/bin/uncrustify" CACHE PATH "")

set(BLAS_LIBRARIES /usr/local/Cellar/lapack/3.9.1/lib/libblas.dylib CACHE PATH "" FORCE)
set(LAPACK_LIBRARIES /usr/local/Cellar/lapack/3.9.1/lib/liblapack.dylib CACHE PATH "" FORCE )
set(ENABLE_DOXYGEN OFF CACHE BOOL "" FORCE)

set(GEOSX_TPL_DIR "~/code/GEOSX/thirdPartyLibs/install-darwin-clang-release" CACHE PATH "" FORCE )
include(${CMAKE_CURRENT_LIST_DIR}/tpls.cmake)
klevzoff commented 3 years ago

Hey @ouassimk ,

Could you try checking out the branch from https://github.com/GEOSX/thirdPartyLibs/pull/158 and clean-rebuilding CHAI? Something like

git fetch origin
git switch bugfix/klevzoff/llvm-clang
cd build-darwin-clang-release
rm -rf chai
cmake ..
make chai

should be sufficient (or you can just do a full rebuild from scratch). Let us know if it fixes the problem. If it does, you should then be able to continue building TPLs with just make.

Long story short, seems none of the developers of CHAI or GEOSX have ever tried this combination (LLVM/Clang instead of AppleClang on OSX), and there's a CMake policy that needs to be set for this to work correctly.

ouassimk commented 3 years ago

Thank you Sergey, it worked perfectly 👍, I think we can close this issue.