I'm using the Windows version of Clang (LLVM) 8 under Windows.
I'm compiling a code which uses OpenMP.
Under the lib
folder of Clang there are 2 files which are OpenMP related:
libomp.lib
.libiomp5md.dll
.My questions are:
-Xclang -fopenmp
for the compiler. In in GCC and ICC using the flags tell the compiler to link the OpenMP library automatically. What about Clang? Does it do it automatically or must I link with libomp.lib
manually? Is there a way to trigger automatic linking to the OpenMP library?clang
driver both for compiling and linking and then the -fopenmp
will work as in GCC
.libomp.lib
manually (Defining as a library for the linker) the output exe
requires libomp.dll
while the supplied OpenMP Dynamic Library is libiomp5md.dll
. Is that a bug or is it because I link manually?libomp.dll
is supplied in the bin
folder and not the lib
folder.clang-cl
driver doesn't work with /openmp
or -openmp
as the MSVC's cl
compiler.clang -fopenmp ...
, clang-cl -Xclang -fopenmp ...
or clang-cl /clang:-fopenmp ...
(Which is equivalent of -Xclang -fopenmp
).Remark
On Windows I use Windows Driver of Clang using clang-cl
.
To compile and link OpenMP code with clang on Windows, you will have to pass -fopenmp
to both the compiler and the linker:
clang -fopenmp -o bla.obj -c bla.c
clang -fopenmp -o bla.exe bla.obj