Announcing the first official release of Flang! Congratulations to everyone who has contributed to this LLVM Fortran project, which began in late 2020. The blog post below provides a historical recap of the project.
Also, big thanks to Peter Klausler who wrote the first component to Flang, the parser! Peter continues to be one of the main contributors to the project (in fact, he is now the #24 all-time contributor to the LLVM project).
There is still work to be done, but it is great to reach this milestone today!
How does one install flang on a Mac (macos-arm64) machine? My preferred solution is conda, but this flang package doesnāt have a Mac build. I see various llvm packages (e.g., llvm), but installing them they donāt seem to include the actual compiler?
I think @JeffH has installed it on an apple silicon mac and should have some good insights on this. Otherwise, you can probably build it yourself if you have a spare couple of hours for it build from source
Of the long list of tar files etc. given in the download link in the referenced blog, which one actually has a working version of the flang binary. Is it the entire llvm-20.1 tar file. Are any of the other files listed required as well. If the LLVM flang people want us to try their compiler they can stop assuming we are all mind readers and give us explicit instructions on how to install their compiler on our preferred OS. Also, is this still just a alpha release or is it a full working compiler. If the former, what works and what doesnāt work.
That wonāt the the new llvm20 based, but it is quite usable.
Homebrew flang-new version 19.1.7
Target: arm64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/flang/19.1.7_1/libexec
Configuration file: /opt/homebrew/Cellar/flang/19.1.7_1/libexec/flang.cfg
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin24.cfg
Note that āquad precisionā (kind=16) isnāt supported, but wonāt be diagnosed.
I recommend that you donāt try to build flang yourself. Yesterday morning, I began building the AUR package, and it was completed in the evening. My ThinkPad was almost unusable during that period.
It took way longer than building LFortran. I think because it had to build mlir (Multi-Level IR Compiler Framework for LLVM), too.
I used MacPorts to install Flang20 but I am confused as to what was installed. there are three flang compilers in the bin folder - flang-20-mp-20, flang-mp-20 and flang-new-mp-20. not sure what each one does. Anyone else use this MacPorts install?
I did find I may have been looking in the wrong directory. the opt/local/lbexec/llvm-20/bin directory has flang, flang-20, and flang-new files. But flang and flang-20 are aliases to flang-new.
I am now also working with Flang 20.1.3 (Linux Fedora 42) to compile gtk-fortran. First, I had to add for Flang the -fPIC option in order to avoid a linking error for the shared library (.so):
emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table.
I am now working on other errors and warnings in the examples. It is interesting as Flang gives you errors and warnings different from those of Intel ifx, themselves different from GFortranās ones. As if each compiler was more concerned with different kinds of problems⦠So having several compilers is really interesting as they are complementary. I am now eager to do the same thing with LFortran when it will be ready.