I have a C++ project that uses Fortran.
When compiling under GCC, I can link in Fortran statically using target_link_libraries(Project -static-libgfortran gfortran)
.
However, I am now compiling the same project using Clang, which means instead of gfortran I am using Flang. (flang-new version 15.0.7)
If I don't include any replacement, I get a lot of undefined symbols, like _FortranAioBeginExternalFormattedOutput
.
If I try to swap out those two with just "flang", it fails, saying:
lld: error: unable to find library -lflang
LLVM has a single sentence on linking flang, which I don't follow:
"After the LLVM IR is created, the flang driver invokes LLVM’s existing infrastructure to generate object code and invoke a linker to create the executable file."
How do I link in Flang the same way I did GFortran?