Then if I simply add a target_link_libraries to library Kokkos, in src/Reader/CMakeLists.txt as shown here:
cmake complains with following error message (see below).
What is strange to me is that actually, the Makefiles are well generated; and if I add some code that actually uses Kokkos API, it builds and runs fine; but still this cmake error at generate step persists. I don’t know how to remove it.
I also tried (just for cross-checking) linking to other external third party libraries. It works fine. So I guess there may be something special when linking a paraview plugin to kokkos library ? I don’t know how to investigate that. And again, despite the error message, the plugin can still build ok.
Any help appreciated.
========================================================================
– Found MPI: TRUE (found version “3.1”) found components: C
– Found MPI: TRUE (found version “3.1”)
– Enabled Kokkos devices: OPENMP
– Configuring done
CMake Error in src/CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
CMake Error in src/Reader/CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
I’ve renamed the module, I’ve also modified CMakeLists.txt that builds the module to use vtk_module_find_package(PACKAGE Kokkos) to detect external library. But still the error at generate step is still there and I don’t understand why.
CMake Error in Plugin/CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
/home/kestenerp/install/visualization/paraview/github/ParaView/Examples/Plugins/LagrangianIntegrationModel/_build/Plugin/CMakeFiles/LagrangianExample-client-server..args
CMake Error in Plugin/LagrangianExample/CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
/home/kestenerp/install/visualization/paraview/github/ParaView/Examples/Plugins/LagrangianIntegrationModel/_build/Plugin/LagrangianExample/CMakeFiles/LagrangianExample-hierarchy..args
Again, despite the cmake error, the build is ok.
There is obviously something that I didn’t understand about linking a plugin module to an external library.
Can someone help ?
That is certainly weird… I notice the ..args in the paths which seems like you have an empty string configuration value? Can you provide the target definition of Kokkos::kokkos?
all the other Kokkos:: targets are either SHARED or INTERFACE IMPORTED libraries.
I can provide the entire file if needed. Anything particular should be noticed ? One can also see that Kokkos is linking to libdl, could this be a problem (for whatever reason) ?
Is there a way to trace inside cmake to understand how the error is generated ?
I’ve recompiled cmake just to make the error message clearer (and print the difference when conflict happens).
I found the origin of the conflict when generating those files (e.g. LagrangianExample-client-server..args). They are generated for language C and CXX and Kokkos is adding symbol KOKKOS_DEPENDENCE for CXX for compile and link (that’s the difference):
This symbol is used by kokkos; when compiling, kokkos actually uses kokkos_launch_compiler to redirect to the actual c++ compiler/linker when needed (e.g. when compiling for Nvidia/Cuda). I’m only using Kokkos::OpenMP backend, but this symbol is always defined for language CXX (and not for C).
I don’t quite understand why this problem only happens now, only when building a paraview plugin.
Is is really necessary to generate those files for C language ? Maybe, that is the root cause of the problem ?
Seems to be the case. I’m not sure what makes it get generated per-language though… Is there only the one file(GENERATE) call that mentions this path as an OUTPUT or are there multiple instances in the --trace-expand log?
yes, there is only one call to file(GENERATE)
and I noticed that every occurence of file(GENERATE) leads to 2 calls to cmGeneratorExpressionEvaluationFile::Generate, one for C language, one for CXX language.
There error message above correspond to the two occurences where C and CXX generated file disagree.
In my case, the file that is actually used finaly is the one generated using lang=C, the second time, the error message is displayed. So I think there is something wrong, it means if the third party c++ library is defining compilation flags specific for CXX, they will be ignored when building the plugin.
The file(GENERATE) calls that are causing problem are the ones coming from paraview’s :
vtkModule.cmake in function _vtk_module_write_wrap_hierarchy
vtkModuleWrapClientServer.cmake in function _vtk_module_wrap_client_server_sources
Would it be a solution to modify the calls to file(GENERATE) at those locations by adding CONDITION <expression> where condition would be true only for lang=CXX (since anyway the plugin is written in CXX) ?