-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kokkos, ninja: make clean
deletes generated cpp file and is not regenerated, causing compilation issues with rebuild when using ninja
#13643
Comments
Looks similar to https://gitlab.kitware.com/cmake/cmake/-/issues/18032. |
From looking at the file I don't remember all the details, but I you have to be careful about how you define custom targets/commands that generate files. It may be that: Trilinos/packages/kokkos/cmake/build_env_info.cmake Lines 103 to 106 in dc17e77
is the issue. I think you have to use a custom command, not a custom target (the documentation is confusing on this). See, for example: Just a hutch (and a bad memory from 15+ years ago dealing with the same issue). |
Looks like diff --git a/packages/kokkos/cmake/build_env_info.cmake b/packages/kokkos/cmake/build_env_info.cmake
index ac28b2d8503..e9c6f8b8686 100644
--- a/packages/kokkos/cmake/build_env_info.cmake
+++ b/packages/kokkos/cmake/build_env_info.cmake
@@ -100,10 +100,11 @@ function(check_git_version)
endfunction()
function(check_git_setup)
- add_custom_target(
- AlwaysCheckGit COMMAND ${CMAKE_COMMAND} -DRUN_CHECK_GIT_VERSION=1 -DKOKKOS_SOURCE_DIR=${Kokkos_SOURCE_DIR} -P
- ${CURRENT_LIST_DIR}/build_env_info.cmake BYPRODUCTS ${post_configure_file}
+ add_custom_command(OUTPUT ${post_configure_file} COMMAND touch ${post_configure_file}
+ COMMAND ${CMAKE_COMMAND} -DRUN_CHECK_GIT_VERSION=1 -DKOKKOS_SOURCE_DIR=${Kokkos_SOURCE_DIR} -P
+ ${CURRENT_LIST_DIR}/build_env_info.cmake
)
+ add_custom_target(AlwaysCheckGit DEPENDS ${post_configure_file})
add_library(impl_git_version ${CMAKE_BINARY_DIR}/generated/Kokkos_Version_Info.cpp)
target_include_directories(impl_git_version PUBLIC ${CMAKE_BINARY_DIR}/generated) would fix the issue. |
Thanks @masterleinad , I tried a similar change without success, didn't realize the When testing the rebuild after clean, I got this warning:
Is that a concern? More detailed summary of steps:
|
It seems diff --git a/packages/kokkos/cmake/build_env_info.cmake b/packages/kokkos/cmake/build_env_info.cmake
index ac28b2d8503..76afbb74b63 100644
--- a/packages/kokkos/cmake/build_env_info.cmake
+++ b/packages/kokkos/cmake/build_env_info.cmake
@@ -4,7 +4,7 @@ find_package(Git QUIET)
set(CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
set(pre_configure_dir ${CMAKE_CURRENT_LIST_DIR})
-set(post_configure_dir ${CMAKE_BINARY_DIR}/generated)
+set(post_configure_dir ${CMAKE_CURRENT_BINARY_DIR}/generated)
set(pre_configure_file ${pre_configure_dir}/Kokkos_Version_Info.cpp.in)
set(post_configure_file ${post_configure_dir}/Kokkos_Version_Info.cpp)
@@ -105,7 +105,7 @@ function(check_git_setup)
${CURRENT_LIST_DIR}/build_env_info.cmake BYPRODUCTS ${post_configure_file}
)
- add_library(impl_git_version ${CMAKE_BINARY_DIR}/generated/Kokkos_Version_Info.cpp)
+ add_library(impl_git_version ${CMAKE_CURRENT_BINARY_DIR}/generated/Kokkos_Version_Info.cpp)
target_include_directories(impl_git_version PUBLIC ${CMAKE_BINARY_DIR}/generated)
target_compile_features(impl_git_version PRIVATE cxx_raw_string_literals)
add_dependencies(impl_git_version AlwaysCheckGit) is the better fix. |
@masterleinad your newest suggestion worked well 👍 |
@ndellingwood Can you create a pull request? |
@masterleinad yes, I'll put up a kokkos PR shortly along with patch match PR to Trilinos |
This PR resolves issues with ninja as generator reported in trilinos/Trilinos#13643 In Trilinos builds with ninja as generator, calling `make clean` followed by recompiling resulted in compilation errors due to a missing generated file Kokkos_Version_Info.cpp that was deleted during clean The changes in this PR resolve the issue Added notes: * The issue did not occur with Unix Makefiles as generator * The issue did not ocur with standalond kokkos Co-authored-by: Daniel Arndt <[email protected]>
This PR resolves issues with ninja as generator reported in trilinos#13643 In Trilinos builds with ninja as generator, calling `make clean` followed by recompiling resulted in compilation errors due to a missing generated file Kokkos_Version_Info.cpp that was deleted during clean The changes in this PR resolve the issue Added notes: * The issue did not occur with Unix Makefiles as generator * The issue did not ocur with standalond kokkos Co-authored-by: Daniel Arndt <[email protected]> Signed-off-by: Nathan Ellingwood <[email protected]>
This PR resolves issues with ninja as generator reported in #13643 In Trilinos builds with ninja as generator, calling `make clean` followed by recompiling resulted in compilation errors due to a missing generated file Kokkos_Version_Info.cpp that was deleted during clean The changes in this PR resolve the issue Added notes: * The issue did not occur with Unix Makefiles as generator * The issue did not ocur with standalond kokkos Signed-off-by: Nathan Ellingwood <[email protected]> Co-authored-by: Daniel Arndt <[email protected]>
@ndellingwood I can confirm that building Trilinos with |
and thanks for the quick fix! |
This PR resolves issues with ninja as generator reported in trilinos/Trilinos#13643 In Trilinos builds with ninja as generator, calling `make clean` followed by recompiling resulted in compilation errors due to a missing generated file Kokkos_Version_Info.cpp that was deleted during clean The changes in this PR resolve the issue Added notes: * The issue did not occur with Unix Makefiles as generator * The issue did not ocur with standalond kokkos Co-authored-by: Daniel Arndt <[email protected]>
This PR resolves issues with ninja as generator reported in trilinos#13643 In Trilinos builds with ninja as generator, calling `make clean` followed by recompiling resulted in compilation errors due to a missing generated file Kokkos_Version_Info.cpp that was deleted during clean The changes in this PR resolve the issue Added notes: * The issue did not occur with Unix Makefiles as generator * The issue did not ocur with standalond kokkos Signed-off-by: Nathan Ellingwood <[email protected]> Co-authored-by: Daniel Arndt <[email protected]>
Bug Report
@trilinos/kokkos
Description
Following the merge of #13589 , some build system behavior changes, when using ninja as build generator, were reported by @jhux2 @cgcgcg .
When attempting to re-compile Trilinos after calling
make clean
, compilation fails due to a missing generated fileKokkos_Version_Info.cpp
that was deleted during themake clean
call, but not regenerated (no rerun of configure+generation stage) during a follow up build stageninja
as the build generator - I did not reproduce the issue withUnix Makefiles
as generatorSteps to Reproduce
Error output:
Adding more knowledgeable folks than myself for possible insights or guidance on how to continue triage - @bartlettroscoe @masterleinad @dalg24 @crtrott
The text was updated successfully, but these errors were encountered: