Thank you all. I already have gfortran, g95, ifort, ifx, lfortran and AMD flang in my Ubuntu system and tried to install LLVM flang, following the instructions in Getting Started. While the first cmake command was running this message appeared:
[2049/6786] Building CXX object tools/....MLIRMemRefDialect.dir/MemRefOps.cpp.o
FAILED: tools/mlir/lib/Dialect/MemRef/IR/CMakeFiles/obj.MLIRMemRefDialect.dir/MemRefOps.cpp.o
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/john/build/tools/mlir/lib/Dialect/MemRef/IR -I/home/john/llvm-project/mlir/lib/Dialect/MemRef/IR -I/home/john/build/tools/mlir/include -I/home/john/llvm-project/mlir/include -I/home/john/build/include -I/home/john/llvm-project/llvm/include -I/home/john/miniforge3/envs/lf/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -O3 -DNDEBUG -std=c++17 -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Dialect/MemRef/IR/CMakeFiles/obj.MLIRMemRefDialect.dir/MemRefOps.cpp.o -MF tools/mlir/lib/Dialect/MemRef/IR/CMakeFiles/obj.MLIRMemRefDialect.dir/MemRefOps.cpp.o.d -o tools/mlir/lib/Dialect/MemRef/IR/CMakeFiles/obj.MLIRMemRefDialect.dir/MemRefOps.cpp.o -c /home/john/llvm-project/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[2062/6786] Building CXX object lib/Tr...strumentation.dir/InstrProfiling.cpp.o
ninja: build stopped: subcommand failed.
Is there a way to recover from there or should I just delete all the files that had been put in my machine and abandon LLVM flang? (I am a Fortran programmer not a systems expert.)