Flang f18 is a new LLVM Fortran compiler front-end based in C++17 instead of the monolithic C code inherited from PGI that become the first-generation Flang.
Flang is invoked in CMake ≥ 3.10 by
FC=flang CC=clang CXX=clang++ cmake ..
How to install Flang
Pick ONE of the following:
- Download the latest Flang Linux binary release
- Compile from source (not recommended for casual Flang users)
Download Flang binary
Flang prerelease binaries are provided for Linux. OSX, Windows, BSD support is in work.
- install Clang
apt install clang
- download Flang binary and extract to
- add to
export PATH=$PATH:$HOME/.local/flang/bin export LD_LIBRARY_PATH=$HOME/.local/flang/lib/:$LD_LIBRARY_PATH
- open a new Terminal and check
For casual use, consider starting instead by downloading the Flang binary as above.
Building the LLVM Flang Fortran compiler from source is a resource-intensive process.
- You need a moderately powerful PC to compile Flang with > 100 GB of free space on the drive you build Flang on. Flang install is small, but Flang build process requires a lot of drive space.
- Don’t use too much RAM with the
makefor building Flang. It maxed out RAM on a PC with 32 GB of RAM with
make -j. Try just plain
- follow the Flang build instructions sequentially. Don’t try to build later parts while earlier parts are still building, this will not work properly.