The Flang (Fortran 2018 compiler) is the part of the latest LLVM-11 project release. Could llvm@gentoo project add this package to portage tree? Reproducible: Always
Related release notes: https://releases.llvm.org/11.0.0/tools/flang/docs/ReleaseNotes.html
Note: "Flang is not yet able to generate LLVM IR for the source code and thus is unable to compile a running binary. Flang is able to unparse the input source code into a canonical form and emit it to allow testing. Flang can also invoke an external Fortran compiler on this canonical input." I'll tentatively assign this to llvm@ but they may not want the workload. If that's the case, llvm@, just assign to maintainer-wanted@.
I think that last I checked it, flang depended on mlir, and mlir did not support standalone builds.
LLVM 13 marks the official release of Flang. Any chance we can get an ebuild? It's been 2 releases and maybe mlir can be built stand alone now?
(In reply to unhappy-ending from comment #4) > LLVM 13 marks the official release of Flang. Any chance we can get an > ebuild? It's been 2 releases and maybe mlir can be built stand alone now? I'll verify that and try to package them today.
Nope, it's not ready yet. It doesn't explode right away but it needs a lot of hacks to even build correctly. I've gotten as far as to having tools installed and I've decided it's not worth the effort. Someone really needs to start fixing this upstream. For a start, make tools buildable and installable without hacks and linking to libMLIR.so. If someone wants to play with it, the ebuild's on 'mlir-wip' branch of https://github.com/mgorny/gentoo.
(In reply to Michał Górny from comment #6) > Nope, it's not ready yet. It doesn't explode right away but it needs a lot > of hacks to even build correctly. I've gotten as far as to having tools > installed and I've decided it's not worth the effort. > > Someone really needs to start fixing this upstream. For a start, make tools > buildable and installable without hacks and linking to libMLIR.so. > > If someone wants to play with it, the ebuild's on 'mlir-wip' branch of > https://github.com/mgorny/gentoo. Is it current problem to provide the both proper build and slotted installation of mril for further use of it? Or is mril almost ready to use and is problem with flang build itself?
Maybe it could help anyone: I found fedora spec files for mlir [1] and flang [2] with their patches. The mlir is compile for me not fast ('dev-python/lit' should be installed before src_configure() phase to run tests). The one of the main difference from mlir ebuild provided by Michał Górny is option `-DBUILD_SHARED_LIBS=OFF`. With this option enabled build provides smaller number of .so files with many static libs. The list of syn libs after src_install() phase is: ``` # tree | grep "\.so" │ ├── libMLIR.so -> libMLIR.so.13 │ ├── libMLIR.so.13 │ ├── libmlir_async_runtime.so -> libmlir_async_runtime.so.13 │ ├── libmlir_async_runtime.so.13 │ ├── libmlir_c_runner_utils.so -> libmlir_c_runner_utils.so.13 │ ├── libmlir_c_runner_utils.so.13 │ ├── libmlir_runner_utils.so -> libmlir_runner_utils.so.13 │ └── libmlir_runner_utils.so.13 ``` instead of list of 177 dynamic libraries (+ symlinks) without `-DBUILD_SHARED_LIBS=OFF` option. My cpu is slow so testing of trying to create flang ebuild will take long time. [1] : https://src.fedoraproject.org/rpms/mlir/blob/rawhide/f/mlir.spec [2] : https://src.fedoraproject.org/rpms/flang/blob/rawhide/f/flang.spec
I note that AMD ship flang as part of their AMD Optimizing C/C++ and Fortran Compilers [AOCC], currently based on llvm 16[1]. Any chance we can revisit this? I have some very crusty old fortran code that I'd love another alternative to `gfortran` and `ifort` to build against and catch weird behaviour. [1]: https://www.amd.com/en/developer/aocc.html
I would also add here, considering packages like hipSPARSE or hipBLAS requires a Fortran compiler and mixing CLANG with GNU Fortran makes errors
It's coming...many thanks, Michal! https://packages.gentoo.org/packages/llvm-core/flang And FWIW, AMD's AOCC was updated a few months back. https://www.amd.com/en/developer/aocc.html
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8672cd4d8095d55cee13f5750a76bc3d59bf12f9 commit 8672cd4d8095d55cee13f5750a76bc3d59bf12f9 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2025-02-17 20:28:56 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2025-02-17 20:47:10 +0000 llvm-core/flang: Add 21.0.0_pre20250215 snapshot Closes: https://bugs.gentoo.org/748087 Signed-off-by: Michał Górny <mgorny@gentoo.org> llvm-core/flang/Manifest | 1 + llvm-core/flang/flang-21.0.0_pre20250215.ebuild | 72 +++++++++++++++++++++++++ 2 files changed, 73 insertions(+)