Does LLVM/Flang support compile LAPACK now on windows?

Hi Flang-Dev

we try to compile openblas on windows ,we use CLang64 Flang to compile but it failed when compile LAPACK of OpenBlas. I have asked help from Openblas communtity, and as they said:

There are two different Flang: LLVM/Flang and Classic Flang.
The one packaged on MSYS2/clang64 is the LLVM one. which couldn’t generate binary code and is also not supported by CMake.
MSYS2/mingw-w64 doesn’t have Classic Flang

so I want to make sure whether their answer is correct? thansk a lot!

it seems flang-new.exe lack cc1 tool, so I use f18,but it still failed
C:\msys64\clang64\bin>flang-new.exe -cc1
error: unknown integrated tool ‘-cc1’. Valid tools include ‘-fc1’.

C:\msys64\clang64\bin>f18.exe -cc1
Enter Fortran source
Use EOF character (^D) to end file

Compile failure info:
– The Fortran compiler identification is unknown
C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.3.0/…/…/…/…/x86_64-w64-mingw32/lib/…/lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function main': C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to WinMain’
collect2.exe: error: ld returned 1 exit status
execvp(gfortran) failed:
– Detecting Fortran compiler ABI info
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_Fortran_PREPROCESS_SOURCE

Hello Jerry,

Yes, the OpenBlas community’s answer is correct. The flang that is packaged along with llvm is llvm/flang. The codegen is not yet available and currently, llvm/flang uses an external compiler to do codegen.

flang-new.exe is the new driver which is designed like clang. You have to use fc1​ in place of cc1​.
f18.exe is a temporary driver that has been replaced with flang-new.exe. f18.exe does not accept cc1​ or fc1​ options. You can probably use the help option to find the appropriate flags.

–Kiran