OpenMP Error in Clang

Hello,

I am getting the following error while trying to build a benchmark with a custom function pass:

clang -Xclang -fopenmp=libomp -Xclang -load -Xclang my_lib.so file.c

error: unknown argument: ‘-fopenmp=libomp’

If I use this instead:

clang -Xclang -fopenmp=libomp -Xclang -load -Xclang my_lib.so file.c

I get the error: fatal error: ‘omp.h’ file not found

I am not sure where the problem is, especially since I have used OpenMP applications with llvm before.

Thanks,
Bodhi

I don't see what the difference is between the two command lines is. However,

1. the option is "clang -fopenmp" (without -Xclang, which is for
options for the -cc1 invocation)

2. omp.h is part of the openmp subproject, it must be enabled
(-DLLVM_ENABLE_PROJECTS=openmp) and omp.h found in the include path.

Michael

I don't see what the difference is between the two command lines is. However,

Me neither.

1. the option is "clang -fopenmp" (without -Xclang, which is for
options for the -cc1 invocation)

Right. If you don't use the driver option you need to manage your include and library paths yourself.

Does `clang -fopenmp test.c` work for you?