Adios2: Fortran compiler not found with CMake -GNinja

Created on 7 Mar 2019  路  13Comments  路  Source: ornladios/ADIOS2

Might be realted to #1190 and should be easy to reproduce, I am running on a standard Ubuntu 16 with gcc compilers and openmpi.

CMake -GNinja can't find Fortran compiler:

-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - NOTFOUND
...
Features:
    Library Type: shared
    Build Type:   Debug
    Testing: ON
    Build Options:
      BZip2    : ON
      ZFP      : ON
      SZ       : ON
      MGARD    : OFF
      MPI      : ON
      DataMan  : ON
      WDM      : ON
      SST      : OFF
      ZeroMQ   : ON
      HDF5     : ON
      Python   : ON
      Fortran  : OFF
      SysVShMem: ON
      Endian_Reverse: ON

While using default make finds Fortran compilers, thus enabling the Fortran bindings:

-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - /usr/bin/f95
-- The Fortran compiler identification is GNU 5.4.0
-- Check for working Fortran compiler: /usr/bin/f95
-- Check for working Fortran compiler: /usr/bin/f95  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/f95 supports Fortran 90
-- Checking whether /usr/bin/f95 supports Fortran 90 -- yes
...
Features:
    Library Type: shared
    Build Type:   Debug
    Testing: ON
    Build Options:
      BZip2    : ON
      ZFP      : ON
      SZ       : ON
      MGARD    : OFF
      MPI      : ON
      DataMan  : ON
      WDM      : ON
      SST      : OFF
      ZeroMQ   : ON
      HDF5     : ON
      Python   : ON
      Fortran  : ON
      SysVShMem: ON
      Endian_Reverse: ON
help wanted not-a-bug question

All 13 comments

I had this issue, too. ninja doesn't support Fortran out of the box. Kitware is maintaining a ninja branch that adds the needed support, but it hasn't made it back into upstream. cmake checks whether you have the special patched ninja and if so, it'll enable Fortran, and otherwise cmake + ninja + Fortran isn't supported, so the workaround is to use the Makefiles generator.

@germasch thanks, I wasn't aware of that. I'll add this to the read the docs documentation (which are fairly outdated at this point).

FWIW our ninja fortran support was finally merged upstream in ninja-build/ninja#1521 and will be part of the next upstream release, v1.10

@chuckatkins reopening this. Not sure if it's an adios2 issue, but using the master branch of ninja still gives the error message:

CMake Error at /opt/adios2/2.4.0/lib/cmake/adios2/adios2-config-common.cmake:16 (enable_language):
   The Ninja generator does not support Fortran using Ninja version

     1.9.0.git

   due to lack of required features.  Kitware has implemented the required
   features but as of this version of CMake they have not been integrated to
   upstream ninja.  Pending integration, Kitware maintains a branch at:

     https://github.com/Kitware/ninja/tree/features-for-fortran#readme

   with the required features.  One may build ninja from that branch to get
   support for Fortran.
 Call Stack (most recent call first):
   /opt/adios2/2.4.0/lib/cmake/adios2/adios2-config.cmake:29 (include)
   VTK/CMake/vtkModule.cmake:3556 (find_package)
   VTK/IO/ADIOS2/CMakeLists.txt:1 (vtk_module_find_package)

Also, I am using cmake 3.14.5

CMake Error at /opt/adios2/2.4.0/lib/cmake/adios2/adios2-config-common.cmake:16 (enable_language):
   The Ninja generator does not support Fortran using Ninja version

     1.9.0.git

@chuckatkins said that the support will be in ninja v1.10, so that'd be my guess why it's still not working for you. (I don't think v1.10 is out yet, though it looks like the ninja master branch has that support merged.)

I don't believe cmake can detect whether or not support is available by just looking at the git version reported by ninja. @KyleFromKitware or @bradking can you confirm this?

I guess this from @bradking (https://github.com/ninja-build/ninja/pull/1521) is the answer:

@dublet CMake 3.7 and higher already have support. It is activated by recognizing a special .dyndep-1 suffix on Ninja's version number that Kitware added to our branch of Ninja we maintain pending upstream integration. One can activate it on top of this PR's branch by locally hacking src/version.cc:

-const char* kNinjaVersion = "1.9.0.git";
+const char* kNinjaVersion = "1.9.0.git.dyndep-1";

I'm going to go ahead and close this then as not a bug since it's an issue with upstream ninja and it's interaction with cmake. For now you'll need to either use the kw fork of ninja or wait for the 1.10 release. Even with the 1.10 release you'll probably still need to use a new cmake (I.e. the upcoming 3.15 release) to correctly detect it.

As of the latest master, CMake does not yet know about any upstream version of Ninja that supports dyndep. I don't know exactly what @bradking's plans are, but I'm guessing he plans to add this information once 1.10 (or some other version) is released with dyndep support.

Since it can be confirmed to work with ninjamaster by tinkering with the version string reported by ninja then it's probably worth preemptively having cmake recognize 1.10 as usable. Either way, not an adios issue.

Thank you all. Yes, it's not an adios2 issue per-se, still adios2 modules are expected to be deployed with the Fortran bindings, so it's not straight-forward to link adios2 with ninja based projects. The same goes for the current conda-forge adios2 packages.

CMake MR 3256 teaches CMake that Ninja 1.10 has dyndep support. It is closed/blocked waiting for the actual Ninja 1.10 release.

Meanwhile one can use Kitware's Ninja releases that include dyndep support in a way CMake is aware of.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AaronV77 picture AaronV77  路  9Comments

AaronV77 picture AaronV77  路  6Comments

ax3l picture ax3l  路  6Comments

rkube picture rkube  路  5Comments

ax3l picture ax3l  路  8Comments