Is OpenMP available in High Sierra LLVM?

Standard Apple’s clang supports OpenMP. They just disabled the driver option. But you can use the frontend option instead this way: clang -Xclang -fopenmp <you_program> -I <path to omp.h> -L <path to libomp.dylib> -lomp

Also, you need to set DYLD_LIBRARY_PATH environmental variable: export DYLD_LIBRARY_PATH=<path to libomp.dylib>

How to get/build libomp.

$ cd
$ svn co http://llvm.org/svn/llvm-project/openmp/trunk libomp
$ cd libomp
$ mkdir build && cd build
$ cmake -DCMAKE_INSTALL_PREFIX=~/libomp/openmp
$ make && make install

After this directory ~/libomp/openmp will have 2 subdirs: include and lib, which should be used as the path to omp.h and the path to libomp.dylib correspondingly.

See also my answer to Is C++ compilable with OpenMP and boost on MacOS?

Leave a Comment