osxcross icon indicating copy to clipboard operation
osxcross copied to clipboard

flang support

Open jeroen opened this issue 1 year ago • 1 comments

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?

jeroen avatar Nov 11 '23 17:11 jeroen

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.

ivan-aksamentov avatar Feb 23 '24 10:02 ivan-aksamentov