Skip to content

Fortran: Ninja fails when build tree path has a symlink

I am building a project (ParaView) on Linux in a build named build folder which happens to be a symbolic link pointing to a folder named buildD. (build -> buildD)

Recently, I have started using the Ninja build system and since then I have the following problem:

 Check for working Fortran compiler: /usr/bin/f95 - broken
 CMake Error at [...]/Software/install/cmake/share/cmake-3.19/Modules/CMakeTestFortranCompiler.cmake:51 (message):
   The Fortran compiler

     "/usr/bin/f95"

   is not able to compile a simple test program.

   It fails with the following output:

     Change Dir: [...]/Software/sources/paraview/master/build/CMakeFiles/CMakeTmp

     Run Build Command(s):/usr/bin/ninja cmTC_6340f && [1/4] Building Fortran preprocessed CMakeFiles/cmTC_6340f.dir/testFortranCompiler.f-pp.f
     [2/4] Generating Fortran dyndep file CMakeFiles/cmTC_6340f.dir/Fortran.dd
     ninja: build stopped: CMakeFiles/cmTC_6340f.dir/Fortran.dd:2: no build statement exists for '[...]/Software/sources/paraview/master/buildD/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_6340f.dir/testFortranCompiler.f.o'

We see that the first occurence of CMakeTmp is in build and the second one in buildD. Only one of them resolved the symbolic link.

The problem disappear if I comment the line enable_langage(Fortran OPTIONAL)

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information