CMAKE_Fortran_COMPILER-NOTFOUND

This is Ubuntu 20.04 LTS / x86_64 / gcc, g++, gfortran 9.3.0 / cmake 3.16.3 here.

The building of the current “v6-24-00-patches” branch fails to compile “g2root” and “h2root” (for all three C++11, C++14 and C++17 builds).

I am configuring it with “-Dall=ON” and then …
root-config --has-fortran” says “yes
root-config --f77” says “CMAKE_Fortran_COMPILER-NOTFOUND

It seems that the configuration step does not even try to “Check for working Fortran compiler” at all.

Any ideas?

Looking at the corresponding “v6.24/06” binary distribution provided by the ROOT team, I can see that both Fortran-related executables are there. How come?

BTW. I am able to build both executables with the current “v5-34-00-patches” branch, which is also internally using “CMAKE_Fortran_COMPILER”.

So, it’s a bug in the ROOT’s configuration logic.

If, instead of “-Dall=ON”, I explicitly use “-Dfortran=ON”, it checks for working Fortran compiler, and it compiles both executables.

Note: @Axel I spotted this bug for the “fortran” feature but, maybe also other components, which are enabled by “-Dall=ON”, face the same problems (i.e., they are “enabled”, but the required configuration steps are omitted).

You are right, the problem is that in CMakeLists.txt the line include(CheckCompiler) comes right before include(RootBuildOptions), and if you use -Dall=ON, the options are enabled in that second module, which is too late for CheckCompiler to enable the Fortran compiler. I think that just swapping those two lines should fix the problem, but I’m not sure if RootBuildOptions needs to use information from CheckCompiler, so that needs to be double checked.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Half a year later … this bug is still present in the newest “v6-26-00-patches” branch (as of 2022.03.10).

Afaik that’s the case. I don’t know what to do here. @bellenot @amadio suggestions?