tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.8k stars 318 forks source link

flang support #404

Open jeroen opened 8 months ago

jeroen commented 8 months ago

Right now we build the full gcc for x86_64-apple-darwin22-gfortran to cross compile some fortran code. The latest versions of ubuntu now include the llvm flang toolchain: https://packages.ubuntu.com/noble/flang-16.

Is this something that could possibly work at some point?

ivan-aksamentov commented 4 months ago

I was hoping that

ENABLE_FORTRAN=1 ./build.sh

will do just that. But was surprised that it doesn't.

I don't know the internal workings of osxcross, but this could potentially be as simple as adding flang to the list of LLVM_ENABLE_PROJECTS here:

https://github.com/tpoechtrager/osxcross/blob/ff8d100f3f026b4ffbe4ce96d8aac4ce06f1278b/build_clang.sh#L168C6-L168C27

like that:

-DLLVM_ENABLE_PROJECTS='clang;flang'

(there are also other things you might want to add: https://github.com/llvm/llvm-project/blob/5f1319bb385342c7ef4124b05b83b89ef8588ee8/llvm/CMakeLists.txt#L126-L128)

It would be nice in fact to have more control over LLVM build, potentially by passing CMake flags directly, instead of having a limited set of proxy env vars.

Now that flang is stable, it would not harm anyone if it is enabled by default.