I've been trying to build a library that uses openMP using clang but I get this error:
In file included from cafxlibrary.cpp:2:
In file included from /opt/homebrew/Cellar/eigen/3.3.9/include/eigen3/Eigen/Dense:1:
/opt/homebrew/Cellar/eigen/3.3.9/include/eigen3/Eigen/Core:266:10: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
Even though I have omp.h in /opt/homebrew/Cellar/libomp/11.0.1/include/
. I've tried setting up the environment variable CPLUS_INCLUDE_PATH
to point to /opt/homebrew/Cellar/libomp/11.0.1/include/
but I get this error instead:
ld: library not found for -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The command I'm using is:
clang++ -dynamiclib -DNDEBUG -I/opt/homebrew/Cellar/eigen/3.3.9/include/eigen3/ -Xpreprocessor -fopenmp -o libcafx.dylib cafxlibrary.cpp -lomp -std=c++11
I've also tried without -lomp
. I also have installed llvm
and libomp
using homebrew but the problem persists. I've also tried placing omp.h
directly in /opt/homebrew/Cellar/eigen/3.3.9/include/eigen3/Eigen/src/Core
. Any help is appreciated.