# Flang compilers

**URL:** <https://fortran-lang.discourse.group/t/flang-compilers/9057>\
**Category:** Help\
**Created:** [January 11, 2025, 8:13am UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057 "2025-01-11T08:13:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harper](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Harper](https://fortran-lang.discourse.group/u/Harper)\
**Post date:** [January 11, 2025, 8:13am UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/1 "2025-01-11T08:13:31Z")

</div>

Are classic flang, AMD flang and LLVM flang 3 different compilers? If not, which ones are the same?

---

<div class="post-metadata">

**Author:** ![Euler-37](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@Euler-37](https://fortran-lang.discourse.group/u/Euler-37)\
**Post date:** [January 11, 2025, 12:03pm UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/2 "2025-01-11T12:03:20Z")

</div>

classic-flang [GitHub - flang-compiler/flang: Flang is a Fortran language front-end designed for integration with LLVM.](https://github.com/flang-compiler/flang)

llvm-flang [GitHub - llvm/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.](https://github.com/llvm/llvm-project/)

AMD AOCC seems to extend Classic Flang [https://docs.amd.com/r/en-US/57222-AOCC-user-guide/Support-for-Annex-F-IEEE-754/IEC-559-of-C99/C11](https://docs.amd.com/r/en-US/57222-AOCC-user-guide/Support-for-Annex-F-IEEE-754/IEC-559-of-C99/C11)

and AMD’s Next-Gen Fortran Compiler will is a downstream flavor of LLVM-Flang [Introducing AMD’s Next-Gen Fortran Compiler — ROCm Blogs](https://rocm.blogs.amd.com/ecosystems-and-partners/fortran-journey/README.html)

---

<div class="post-metadata">

**Author:** ![themos](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/themos/32/521_2.png) [@themos](https://fortran-lang.discourse.group/u/themos)\
**Post date:** [January 11, 2025, 12:09pm UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/3 "2025-01-11T12:09:05Z")

</div>

They are all different.

But the first two, [Classic Flang](https://github.com/flang-compiler/flang) and [AOCC](https://www.amd.com/en/developer/aocc.html), have common lineage.

[LLVM Flang](https://github.com/llvm/llvm-project/tree/main/flang) is the odd one out. Implemented in C++, the entire front-end has been written from scratch (first commit was Jan 25, 2018 but I am told the project started mid-2017).

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [January 11, 2025, 2:17pm UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/4 "2025-01-11T14:17:39Z")

</div>

There is also the [Arm Fortran compiler](https://developer.arm.com/documentation/101380/2404?lang=en) (`armflang`),

> Arm® Fortran Compiler is a Linux user space Fortran compiler for server and High Performance Computing (HPC) Arm-based platforms. Arm Fortran Compiler is built on the open-source Clang front-end and the LLVM 18.1.1-based optimization and code generation back-end.

The current version (24.04) is based on the Classic Flang front-end.

---

<div class="post-metadata">

**Author:** ![Harper](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Harper](https://fortran-lang.discourse.group/u/Harper)\
**Post date:** [January 12, 2025, 7:43am UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/5 "2025-01-12T07:43:41Z")

</div>

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:

```auto
[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.)

---

<div class="post-metadata">

**Author:** ![Euler-37](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@Euler-37](https://fortran-lang.discourse.group/u/Euler-37)\
**Post date:** [January 12, 2025, 9:17am UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/6 "2025-01-12T09:17:48Z")

</div>

Maybe you could try LLVM Debian/Ubuntu nightly packages

[https://apt.llvm.org/](https://apt.llvm.org/)

---

<div class="post-metadata">

**Author:** ![eugene\_epshteyn](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@eugene\_epshteyn](https://fortran-lang.discourse.group/u/eugene_epshteyn)\
**Post date:** [January 13, 2025, 12:03am UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/7 "2025-01-13T00:03:48Z")

</div>

The killed signal is an indication that the build is running out of memory. LLVM flang build needs lots of memory. On Ubuntu laptop with 64GB of RAM I can build debug flang by limiting the build to 8 compilation threads and 1 link thread. This way I get the successful build and the machine is still somewhat usable while building.

---

<div class="post-metadata">

**Author:** ![Harper](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Harper](https://fortran-lang.discourse.group/u/Harper)\
**Post date:** [January 13, 2025, 1:14am UTC](https://fortran-lang.discourse.group/t/flang-compilers/9057/8 "2025-01-13T01:14:22Z")

</div>

Thank you Eugene. To avoid unnecessary software bloat I am getting rid of  
the many Gb that LLVM flang put on my machine. I can live without that  
compiler.
