Package Details: flang 21.1.8-1

Git Clone URL: https://aur.archlinux.org/flang.git (read-only, click to copy)
Package Base: flang
Description: ground-up implementation of a Fortran front end written in modern C++
Upstream URL: http://llvm.org/
Licenses: Apache-2.0 WITH LLVM-exception
Submitter: xantares
Maintainer: xantares
Last Packager: xantares
Votes: 5
Popularity: 0.011185
First Submitted: 2023-08-25 22:06 (UTC)
Last Updated: 2026-02-15 10:29 (UTC)

Latest Comments

1 2 3 Next › Last »

xantares commented on 2025-11-19 21:06 (UTC) (edited on 2025-11-19 21:06 (UTC) by xantares)

ok for POSITION_INDEPENDENT_CODE

for flang I cannot really throw more than 1 thread because it can blow the RAM

MartinDiehl commented on 2025-11-18 21:27 (UTC)

I've encountered an error when compiling openMPI which I could resolve by adding -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true. I don't know to which of the builds it was really needed and added it to both. I also had to add -DCMAKE_Fortran_FLAGS='' to the flang-rt build because otherwise non-working options for GFortran are used.

To speed up the build, I also disabled debug and used 4 threads, so in the end I used

diff --git a/PKGBUILD b/PKGBUILD
index 573380f..7c361eb 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,7 +7,7 @@ url="http://llvm.org/"
 license=('Apache-2.0 WITH LLVM-Exception')
 depends=("mlir>=${pkgver%%.*}" "clang" "llvm-libs")
 makedepends=('cmake' 'python' 'llvm')
-options=(staticlibs)
+options=(staticlibs !debug)
 _source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
 source=($_source_base/flang-$pkgver.src.tar.xz{,.sig}
         $_source_base/cmake-$pkgver.src.tar.xz{,.sig}
@@ -38,23 +38,26 @@ build() {
   cmake \
     -DCMAKE_BUILD_TYPE=Release \
     -DCMAKE_INSTALL_PREFIX=/usr \
+    -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \
     -DCLANG_DIR=/usr/lib/cmake/clang/ \
     -DMLIR_TABLEGEN_EXE=/usr/bin/mlir-tblgen \
     -DFLANG_INCLUDE_TESTS=OFF \
     -B build -S .
-  cmake --build build --parallel 1
+  cmake --build build --parallel 4

   # flang-rt standalone build
   cd "$srcdir"/llvm-project-$pkgver.src/flang-rt
   cmake \
     -DCMAKE_BUILD_TYPE=Release \
     -DCMAKE_INSTALL_PREFIX=/usr \
+    -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \
     -DCMAKE_Fortran_COMPILER="$srcdir"/flang-$pkgver.src/build/bin/flang \
     -DCMAKE_Fortran_COMPILER_WORKS=yes \
+    -DCMAKE_Fortran_FLAGS='' \
     -DFLANG_RT_INCLUDE_TESTS=OFF \
     -DLLVM_ENABLE_RUNTIMES="flang-rt" \
     -B build -S "$srcdir"/llvm-project-$pkgver.src/runtimes
-  cmake --build build
+  cmake --build build --parallel 4
 }

 package() {

wanghaoran commented on 2025-11-18 17:21 (UTC)

I don't know where the flag came from, but I've made sure my makepkg configure files do not contain it.

gomfol12 commented on 2025-11-18 14:09 (UTC)

Hi @xantares, I had the same problem as @wanghaoran and his suggested fix worked.

xantares commented on 2025-11-13 19:01 (UTC)

hi @wanghaoran maybe you are using old makepkg config files ? I dont see where its defined in makepkg

wanghaoran commented on 2025-11-09 16:54 (UTC)

btw, compilation without "--parallel 1" works for me. It should be much faster.

wanghaoran commented on 2025-11-09 16:39 (UTC)

Hello,

I've encountered a build failure with the current PKGBUILD. The error is:

1 flang-21: error: unknown argument: '-ffile-prefix-map=/home/user/flang/src=/usr/src/debug/flang'

This seems to be caused by makepkg passing the -ffile-prefix-map flag to the flang compiler during the flang-rt build, and this version of flang does not recognize the argument.

I was able to fix this by adding -DCMAKE_Fortran_FLAGS="" to the cmake command for the flang-rt build. This prevents the problematic flag from being passed to the Fortran compiler.

Here is the suggested change to the PKGBUILD:

1 --- a/PKGBUILD
2 +++ b/PKGBUILD
3 @@ -47,6 +47,7 @@
4      -DCMAKE_INSTALL_PREFIX=/usr \
5      -DCMAKE_Fortran_COMPILER="$srcdir"/flang-$pkgver.src/build/bin/flang \
6      -DCMAKE_Fortran_COMPILER_WORKS=yes \
7 +    -DCMAKE_Fortran_FLAGS="" \
8      -DFLANG_RT_INCLUDE_TESTS=OFF \
9      -DLLVM_ENABLE_RUNTIMES="flang-rt" \

10 -B build -S "$srcdir"/llvm-project-$pkgver.src/runtimes

Thank you for maintaining this package

krystophny commented on 2025-11-07 20:33 (UTC)

Please bump version.

New PKGBUILD:

pkgname=('flang')
pkgver=21.1.5
pkgrel=1
pkgdesc="ground-up implementation of a Fortran front end written in modern C++"
arch=('x86_64')
url="http://llvm.org/"
license=('Apache-2.0 WITH LLVM-Exception')
depends=("mlir>=${pkgver%%.*}" "clang" "llvm-libs")
makedepends=('cmake' 'python' 'llvm' 'lld')
options=(staticlibs)
_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
source=($_source_base/flang-$pkgver.src.tar.xz{,.sig}
        $_source_base/cmake-$pkgver.src.tar.xz{,.sig}
        $_source_base/clang-$pkgver.src.tar.xz{,.sig}
        $_source_base/llvm-project-$pkgver.src.tar.xz{,.sig})
sha256sums=('e60f5c440966364f763c5162c2c33a28cd5e0872d08ee1ef638ec19295ab1ce0'
            'SKIP'
            '48013d5714a96419bf993a2e5e4c5827377e8cf9c565070731fb2305d50d9511'
            'SKIP'
            'eee4de3b3f01ea6dd6b0936ac8be319eef0a65d0022def258c70110e3743807c'
            'SKIP'
            '1794be4bf974e99a3fe1da4b2b9b1456c02ae9479c942f365441d8d207bd650c'
            'SKIP')
validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A'  # Tom Stellard <tstellar@redhat.com>
              'D574BD5D1D0E98895E3BF90044F2485E45D59042'  # Tobias Hieta <tobias@hieta.se>
              'FFB3368980F3E6BB5737145A316C56D064CACBA5'  # Douglas Yung <douglas.yung@sony.com>
              '71046D1E9C6656BDD61171873E83BABF4A4F9E85') # Cullen Rhodes <cullen.rhodes@arm.com>

prepare() {
  cp -r clang{-$pkgver.src,}
  cp -r cmake{-$pkgver.src,}
}

build() {
  # flang standalone build
  cd flang-$pkgver.src
  export CXXFLAGS="${CXXFLAGS} -Wp,-U_GLIBCXX_ASSERTIONS"
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCLANG_DIR=/usr/lib/cmake/clang/ \
    -DMLIR_TABLEGEN_EXE=/usr/bin/mlir-tblgen \
    -DFLANG_INCLUDE_TESTS=OFF \
    -B build -S .
  cmake --build build --parallel 1

  # flang-rt standalone build
  cd "$srcdir"/llvm-project-$pkgver.src/flang-rt
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_Fortran_COMPILER="$srcdir"/flang-$pkgver.src/build/bin/flang \
    -DCMAKE_Fortran_COMPILER_WORKS=yes \
    -DFLANG_RT_INCLUDE_TESTS=OFF \
    -DLLVM_ENABLE_RUNTIMES="flang-rt" \
    -B build -S "$srcdir"/llvm-project-$pkgver.src/runtimes
  cmake --build build
}

package() {
  cd flang-$pkgver.src
  DESTDIR="${pkgdir}" cmake --install build
  cd ../llvm-project-$pkgver.src/flang-rt
  DESTDIR="${pkgdir}" cmake --install build

  # move runtime dir to match flang linker flags -L/usr/lib/clang/21/lib/linux, see flang-rt/cmake/modules/GetToolchainDirs.cmake
  mv -v "${pkgdir}"/usr/lib/clang/${pkgver%%.*}/lib/*-unknown-linux-gnu/ "${pkgdir}"/usr/lib/clang/${pkgver%%.*}/lib/linux
}

xantares commented on 2025-11-02 15:14 (UTC)

I added the flang-rt lib

MartinDiehl commented on 2025-10-30 09:29 (UTC) (edited on 2025-10-30 09:29 (UTC) by MartinDiehl)

compilation of 21.1.4-1 works for me but invoking flang fails with /usr/bin/ld: cannot find -lflang_rt.runtime: No such file or directory