如何解决Apple M1 上是否支持 Clang openMP?
我一直在尝试使用 clang 构建一个使用 openMP 的库,但出现此错误:
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.
即使我在 /opt/homebrew/Cellar/libomp/11.0.1/include/
中有 omp.h。我已尝试将环境变量 CPLUS_INCLUDE_PATH
设置为指向 /opt/homebrew/Cellar/libomp/11.0.1/include/
,但出现此错误:
ld: library not found for -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我使用的命令是:
clang++ -dynamiclib -DNDEBUG -I/opt/homebrew/Cellar/eigen/3.3.9/include/eigen3/ -Xpreprocessor -fopenmp -o libcafx.dylib cafxlibrary.cpp -lomp -std=c++11
我也试过不使用 -lomp
。我还使用自制软件安装了 llvm
和 libomp
,但问题仍然存在。我也试过将 omp.h
直接放在 /opt/homebrew/Cellar/eigen/3.3.9/include/eigen3/Eigen/src/Core
中。任何帮助表示赞赏。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。