Thank you to all of you for your help.  It turned out that OpenKIM does some 
magic in the API package to make CMake remember what compilers were used to 
build the API, and then use the same for the models.  That somehow goes wrong 
in an EasyBuild environment.

In the end, the solution was simply to add these lines to the easyconfig of the 
models:

configopts += '-DCMAKE_C_COMPILER=`which icc` '
configopts += '-DCMAKE_CXX_COMPILER=`which icpc` '
configopts += '-DCMAKE_Fortran_COMPILER=`which ifort` ‘

I have updated my OpenKIM PR #7569 to reflect this.
https://github.com/easybuilders/easybuild-easyconfigs/pull/7569

Thanks again for your help.

Jakob



> On 12 Mar 2019, at 14:04, Jakob Schiøtz <schi...@fysik.dtu.dk> wrote:
> 
> 
> 
>> On 12 Mar 2019, at 11:03, Paul Melis <paul.me...@surfsara.nl> wrote:
>> 
>> Hi Jakob,
>> 
>> Whoops, sorry, didn't read your post in enough detail. I saw the options 
>> -DCMAKE_C_COMPILER='icc' and such and didn't expect those to come from EB 
>> and/or the package's CMAKE. In general it is best to use full paths for 
>> those values.
> 
> Actually, the OpenKIM developers just told me that the kim API does some 
> “magic” to remember what compilers were used for the API itself, and that is 
> what breaks CMAKE.  The solution is to use your suggestion and give the full 
> path to the compilers.
> 
> Do you (or anybody else) know how to find the full path for the compiler, so 
> I can add that to the CMake command line?  And if so, how do I prevent 
> EasyBuild from also adding a -DCMAKE_C_COMPILER='icc’ to the command line, so 
> my own definition takes precedence?
> 
> Best regards
> 
> Jakob
> 
> 
> 
>> 
>> Paul
>> 
>> ----- Original Message -----
>> From: "Jakob Schiøtz" <schi...@fysik.dtu.dk>
>> To: "easybuild" <easybuild@lists.ugent.be>
>> Sent: Tuesday, 12 March, 2019 10:35:36
>> Subject: Re: [easybuild] Problems building with CMake
>> 
>>> On 12 Mar 2019, at 10:25, Paul Melis <paul.me...@surfsara.nl> wrote:
>>> 
>>> You need to set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER values to the full 
>>> path to the compilers, not just "icc" and "icpc". CMake's error is pretty 
>>> clear about it.
>> 
>> Dear Paul, 
>> 
>> Thanks for your suggestion, but are you sure? 
>> 
>> It is the easybuild itself that sets them to icc and icpc, not my 
>> easyconfig.  And the error message says (my emphasis):
>> 
>> 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.***
>> 
>> Best regards
>> 
>> Jakob
>> 
>> 
>>> 
>>> Paul
>>> 
>>> 
>>> 
>>> I am trying to make a .eb files for a module using the CMakeMake block.  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 run.py:192 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/
>>>  
>>> ...
>>> CMake Error at CMakeLists.txt:37 (project):
>>> The CMAKE_CXX_COMPILER:
>>> 
>>>  
>>> /home/niflheim/schiotz/easybuild/broadwell/build/OpenKIMModels/20190221/intel-2018b/easybuild_obj/icpc
>>> 
>>> 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.
>>> 
>>> 
>>> 
>>> --
>>> Jakob Schiøtz, professor, Ph.D.
>>> Department of Physics
>>> Technical University of Denmark
>>> DK-2800 Kongens Lyngby, Denmark
>>> http://www.fysik.dtu.dk/~schiotz/
>> 
>> --
>> Jakob Schiøtz, professor, Ph.D.
>> Department of Physics
>> Technical University of Denmark
>> DK-2800 Kongens Lyngby, Denmark
>> http://www.fysik.dtu.dk/~schiotz/
> 
> --
> Jakob Schiøtz, professor, Ph.D.
> Department of Physics
> Technical University of Denmark
> DK-2800 Kongens Lyngby, Denmark
> http://www.fysik.dtu.dk/~schiotz/
> 
> 
> 

--
Jakob Schiøtz, professor, Ph.D.
Department of Physics
Technical University of Denmark
DK-2800 Kongens Lyngby, Denmark
http://www.fysik.dtu.dk/~schiotz/



Reply via email to