Problems with CMake when building models

Dear all,

I am trying to make an EasyBuild configuration for the OpenKIM models. It downloads the models, and tries to build them with cmake. I am having a strange problem, and my lack of experience with CMake makes it hard for me to figure out what is going on.

Apparently, cmake cannot find the compilers, since it somehow gets the idea that they are placed in the build directory:

== 2019-03-11 11:07:25,450 INFO running cmd: cmake -DCMAKE_INSTALL_PREFIX=/home/niflheim/schiotz/easybuild/broadwell/software/OpenKIM-Models/20190221-intel-2018b -DCMAKE_C_COMPILER='icc' -DCMAKE_Fortran_FLAGS='-O2 -xHost -ftz -fp-speculation=safe -fp-model source' -DCMAKE_CXX_FLAGS='-O2 -xHost -ftz -fp-speculation=safe -fp-model source' -DCMAKE_CXX_COMPILER='icpc' -DCMAKE_Fortran_COMPILER='ifort' -DCMAKE_C_FLAGS='-O2 -xHost -ftz -fp-speculation=safe -fp-model source' -DCMAKE_VERBOSE_MAKEFILE=ON -DKIM_API_INSTALL_COLLECTION=SYSTEM -DKIM_API_MODEL_INSTALL_PREFIX=/home/niflheim/schiotz/easybuild/broadwell/software/OpenKIM-Models/20190221-intel-2018b/lib/kim-api-v2/models -DKIM_API_MODEL_DRIVER_INSTALL_PREFIX=/home/niflheim/schiotz/easybuild/broadwell/software/OpenKIM-Models/20190221-intel-2018b/lib/kim-api-v2/model-drivers /home/niflheim/schiotz/easybuild/broadwell/build/OpenKIMModels/20190221/intel-2018b/OpenKIM-Models-v2-2019-02-21/
== 2019-03-11 11:07:26,976 ERROR EasyBuild crashed with an error (at ?:124 in __init__): cmd " cmake -DCMAKE_INSTALL_PREFIX=/home/niflheim/schiotz/easybuild/broadwell/software/OpenKIM-Models/20190221-intel-2018b -DCMAKE_C_COMPILER='icc' -DCMAKE_Fortran_FLAGS='-O2 -xHost -ftz -fp-speculation=safe -fp-model source' -DCMAKE_CXX_FLAGS='-O2 -xHost -ftz -fp-speculation=safe -fp-model source' -DCMAKE_CXX_COMPILER='icpc' -DCMAKE_Fortran_COMPILER='ifort' -DCMAKE_C_FLAGS='-O2 -xHost -ftz -fp-speculation=safe -fp-model source' -DCMAKE_VERBOSE_MAKEFILE=ON -DKIM_API_INSTALL_COLLECTION=SYSTEM -DKIM_API_MODEL_INSTALL_PREFIX=/home/niflheim/schiotz/easybuild/broadwell/software/OpenKIM-Models/20190221-intel-2018b/lib/kim-api-v2/models -DKIM_API_MODEL_DRIVER_INSTALL_PREFIX=/home/niflheim/schiotz/easybuild/broadwell/software/OpenKIM-Models/20190221-intel-2018b/lib/kim-api-v2/model-drivers /home/niflheim/schiotz/easybuild/broadwell/build/OpenKIMModels/20190221/intel-2018b/OpenKIM-Models-v2-2019-02-21/" exited with exit code 1 and output:
-- Found KIM-API-V2: kim-api-v2 (Required is at least version "2.0")
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:37 (project):


is not a full path to an existing compiler tool.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

and the same for the C and Fortran compilers.

And in that folder, there is a CMakeCache.txt file, and it contains lines like:


I have no idea where it gets that idea from. Has anybody seen something like that before, or have any hint as to where I should be looking?

Best regards



The kim-api remembers the compilers used to build it and uses those same values to build models (ignoring what cmake is told to use). So, I expect this is the root of the problem.

You can use a special build argument to override this for the kim-api. Similar to what I have done for homebrew:

Let me know if you need further pointers.


Hi again,

Problem solved!

Adding -DKIM_API_CMAKE_C_COMPILER and friends when compiling the API did not help. However, adding -DCMAKE_C_COMPILER=`which icc` and similar when configuring the models did work.

Thanks for your help!


Hi Jakob,

Interesting.... I don't quite understand how that's all working, but if it works, great!