I read somewhere that the current FLang (Ubuntu flang package) can not cross-compile. I would like to know if the “new” FLang (f18) can, ans if yes, then if/how it’s possible to use it alongside Google’s Android-CLang-toolchain to compile Fortran for Android.

I’m interested in this because I want to cross-compile OpenBLAS.



Hi Thorsten,

Flang/F18 has only been merged to LLVM recently ([flang] Merge flang-compiler/f18 · llvm/llvm-project@b98ad94 · GitHub). I don’t know the answer to your specific question, but this project is still work-in-progress and it will be a while.

The good news is that there’s a lot of interest and desire to make this happen ASAP :slightly_smiling_face:


Hi all,

Has there been any movement on this? I’m attempting to cross-compile SPEC CPU 2017 for an AArch64 system and I see lots of this:

/data/andrew/llvm-root/bin/flang                -m64 --target=aarch64-linux-gnu --sysroot=/usr/aarch64-linux-gnu -B/usr/lib/gcc/aarch64-linux-gnu/10.2.0/ -I/usr/aarch64-linux-gnu/include/c++/10.2.0/ -I/usr/aarch64-linux-gnu/include/c++/10.2.0/aarch64-linux-gnu/ -I/usr/aarch64-linux-gnu/include/c++/10.2.0/backward -c -o flux_lam.fppized.o -g -O3 -fno-finite-math-only -static flux_lam.fppized.f
gfortran: error: unrecognized command-line option '--target=aarch64-linux-gnu'

I presume that flang is invoking gfortran to do the linking step as clang does for C/C++ programs.