8000 Building with `ninja` fails · Issue #844 · CGNS/CGNS · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Building with ninja fails #844

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

Open
LecrisUT opened this issue Apr 28, 2025 · 5 comments
Open

Building with ninja fails #844

LecrisUT opened this issue Apr 28, 2025 · 5 comments

Comments

@LecrisUT
Copy link
Contributor

While trying to change the generator from Makefile to Ninja in Fedora we found out a build failure due to:

[122/541] /usr/bin/cmake -E cmake_ninja_dyndep --tdi=src/ptests/CMakeFiles/test_poly_unstructured_f90.dir/FortranDependInfo.json --lang=Fortran --dd=src/ptests/CMakeFiles/test_poly_unstructured_f90.dir/Fortran.dd @src/ptests/CMakeFiles/test_poly_unstructured_f90.dir/Fortran.dd.rsp
ninja: build stopped: multiple rules generate src/ptests/testing_utils.mod.

The issue comes from duplications in (utilsf.F90)

set(FORTRAN_PTESTS_LIST
pcgns_ftest
fexample
benchmark_hdf5_f90
test_mixed_par_ser
test_unstruc_quad_f90
test_poly_unstructured_f90
)
set(pcgns_ftest_FILES pcgns_ftest.F90 ${CMAKE_SOURCE_DIR}/src/tests/utilsf.F90)
add_executable(pcgns_ftest ${pcgns_ftest_FILES})
set(fexample_FILES fexample.F90)
add_executable(fexample ${fexample_FILES})
set(benchmark_hdf5_f90_FILES benchmark_hdf5_f90.F90)
add_executable(benchmark_hdf5_f90 ${benchmark_hdf5_f90_FILES})
set(test_mixed_par_ser_FILES test_mixed_par_ser.F90)
add_executable(test_mixed_par_ser ${test_mixed_par_ser_FILES})
set(test_unstruc_quad_f90_FILES test_unstruc_quad_f90.F90)
add_executable(test_unstruc_quad_f90 ${test_unstruc_quad_f90_FILES})
set(test_poly_unstructured_f90_FILES test_poly_unstructured_f90.F90 ${CMAKE_SOURCE_DIR}/src/tests/utilsf.F90)
add_executable(test_poly_unstructured_f90 ${test_poly_unstructured_f90_FILES})

The solution is to make either a STATIC or OBJECT library that contains the utilsf.F90 and add it as a target_link_libraries instead.

@MicK7
Copy link
Contributor
MicK7 commented Apr 29, 2025

Do you mean doing something like :

add_library(objlib_utilsf OBJECT ${CMAKE_SOURCE_DIR}/src/tests/utilsf.F90)
add_executable(pcgns_ftest ${pcgns_ftest_FILES} $<TARGET_OBJECTS:objlib_utilsf>)
add_executable(test_poly_unstructured_f90 ${test_poly_unstructured_f90_FILES} $<TARGET_OBJECTS:objlib_utilsf>)

@LecrisUT
Copy link
Contributor Author

Close. I believe that is a deprecated way of doing it. Nowadays it's just like linking to a STATIC library, i.e.

# Could also move this up a level
add_library(test_utils OBJECT ../utilsf.F90)
add_executable(pcgns_ftest ${pcgns_ftest_FILES})
target_link_libraries(pcgns_ftest PRIVATE test_utils)
add_executable(test_poly_unstructured_f90 ${test_poly_unstructured_f90_FILES})
target_link_libraries(test_poly_unstructured_f90 PRIVATE test_utils)

(although for better visibility in that change, I would also remove the variables *_FILES)

Because the build failed, I did not check if there are other equivalent failures that need to be patched.

@MicK7
Copy link
Contributor
MicK7 commented Apr 30, 2025

#845 should help with the ninja build

@MicK7
Copy link
Contributor
MicK7 commented Apr 30, 2025

@LecrisUT I tried to compile with Ninja to reproduce the issue but I do not manage to get the fortran to compile properly. Which version of Ninja do you recommend for a correct Fortran support ?

@LecrisUT
Copy link
Contributor Author

I believe CMake only has one check for Ninja 1.11, but it should still work before that. What errors are you seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0