[cmake-developers] cmake checkfortran fails

blubee blubeeme gurenchan at gmail.com
Mon Oct 22 19:45:22 EDT 2018


There's a newly open sourced fortran compiler flang:
https://github.com/flang-compiler/flang

The CMakeTestFortranCompiler.cmake erroneously says that the compiler
doesn't work.

-- The Fortran compiler identification is Flang 99.99.1
-- Check for working Fortran compiler: /usr/local/bin/flang
-- Check for working Fortran compiler: /usr/local/bin/flang  -- broken
CMake Error at
/usr/local/share/cmake/Modules/CMakeTestFortranCompiler.cmake:45 (message):
  The Fortran compiler

    "/usr/local/bin/flang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir:
/wrkdirs/usr/ports/math/trilinos/work/.build/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/local/bin/ninja" "cmTC_3bdf7"
    [1/4] Building Fortran preprocessed
CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f
    FAILED: CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f
CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f.ddi
    /usr/local/bin/flang -cpp    -E testFortranCompiler.f -o
CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f &&
/usr/local/bin/cmake -E cmake_ninja_depends
--tdi=CMakeFiles/cmTC_3bdf7.dir/FortranDependInfo.json
--pp=CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f
--dep=CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f.d
--obj=CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f.o
--ddi=CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f.ddi
    # 1 "testFortranCompiler.f"
    # 2 "testFortranCompiler.f"
            PROGRAM TESTFortran
            PRINT *, 'Hello'
            END

    CMake Error: -E cmake_ninja_depends failed to open
CMakeFiles/cmTC_3bdf7.dir/testFortranCompiler.f-pp.f
    ninja: build stopped: subcommand failed.

the fortran compiler does work if you remove the -E flag from the the
compilation command.

Is this an issue something that can get some attention?

Best,
Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20181023/5d7c6da2/attachment.html>


More information about the cmake-developers mailing list