Goddard-Fortran-Ecosystem / pFUnit

Parallel Fortran Unit Testing Framework
Other
173 stars 45 forks source link

Fails to build with cmake>=3.27 + Ninja #461

Closed MehdiChinoune closed 2 months ago

MehdiChinoune commented 6 months ago
[1351/1468] Building Fortran object src/funit/CMakeFiles/funit-main.dir/FUnit.F90.o
 FAILED: src/funit/CMakeFiles/funit-main.dir/FUnit.F90.o src/funit/mod/funit.mod 
 /usr/bin/f95 -I/pFUnit/src/funit -I/pFUnit/build/src/funit/mod -I/pFUnit/include -I/pFUnit/build/extern/fArgParse/extern/gFTL-shared/extern/gFTL/include/v1 -I/pFUnit/build/extern/fArgParse/extern/gFTL-shared/src/v1/mod -I/pFUnit/build/extern/fArgParse/mod -I/pFUnit/build/extern/fArgParse/extern/gFTL-shared/extern/gFTL/include/v2 -I/pFUnit/extern/fArgParse/extern/gFTL-shared/extern/gFTL/include/v2 -I/pFUnit/build/extern/fArgParse/extern/gFTL-shared/src/v2/mod -g -cpp -O0 -ffree-line-length-none -fallow-argument-mismatch -fbacktrace -Jsrc/funit/mod -fPIC -fopenmp -fpreprocessed -c src/funit/CMakeFiles/funit-main.dir/FUnit.F90-pp.f90 -o src/funit/CMakeFiles/funit-main.dir/FUnit.F90.o
 /pFUnit/src/funit/FUnit.F90:4:8:

     4 |    use PF_Assert
       |        1
 Fatal Error: Cannot open module file 'pf_assert.mod' for reading at (1): No such file or directory

It succeeds with GCC 12.3.0, but fails with GCC 13.2.0 and 14.0.1 (dev). I thought It is some issues with paralled building, but It fails when using a single job!

MehdiChinoune commented 6 months ago

Actually It's because of Ninja generator!

tclune commented 6 months ago

Ah - good. I finally had a successful build with 13.2 a couple of weeks ago, but did not have any build issues. Just some run-time issues where F2008 polymorphic assignment had to be reverted to F2003 ALLOCATE statements. (And even that was only in some of the pFUnit dependencies I think.

Cheers.

MehdiChinoune commented 6 months ago

We have reported the issue to CMake, they say that pFUnit should use target_link_libraries() instead of add_dependencies() if there is a module dependency. see: https://gitlab.kitware.com/cmake/cmake/-/issues/25788#note_1497239

I could open a PR if there is no required CLA.

tclune commented 6 months ago

Please do. I've given up on the CLA.