Omp.h not found

I built LLVM with the below CMAKE line

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release

but when I try to compile a simple OpenMP program, I get <omp.h> not found.

openmp.c:2:10: fatal error: ‘omp.h’ file not found
#include <omp.h>
1 error generated.

This is how I am compiling openmp code,

clang -fopenmp hellp.c

What am I missing?

I’m assuming you installed LLVM somewhere and you’re using the correct binary? There should be a file called omp.h in the compiler’s resource directory. You should be able to see it via clang --print-resource-dir which should then have include/omp.h inside it. If it’s not there then your install is likely wrong or you used the wrong compiler. If it is there then I’m not sure, because the resource directory should be included by default.

Apparently, it works from installed directory but not from build directory. This is ok for me if it is not expected to work from build directory.

Yes, this is expected because the compiler’s resource directory is not constructed until it’s installed. For internal use you’re expected to pass the include directory manually.

Thanks. That answers.