【发布时间】:2017-09-19 04:56:39
【问题描述】:
我使用的是 Mac OS X Sierra,我发现 clang(LLVM 版本 8.1.0 (clang-802.0.38))不支持 OpenMP:
当我运行clang -fopenmp program_name.c 时,出现以下错误:
clang: error: unsupported option '-fopenmp'
好像clang不支持-fopenmp标志。
我在自制软件中找不到任何 openmp 库。根据 LLVM 网站,LLVM 已经支持 OpenMP。但我在编译期间找不到启用它的方法。
这是否意味着 Mac 中的默认 clang 不支持 OpenMP? 您能提供什么建议吗?
(当我切换到GCC编译同一个程序(gcc使用brew install gcc --without-multilib安装),编译成功。)
【问题讨论】:
-
确实,Apple 提供的 clang 不支持 OpenMP。
-
brew install llvm应该安装最新的 LLVM 版本,即 4.0.0。这能解决问题吗? -
Apple 提供的 clang 默认情况下不支持 OpenMP。可以在 Apple 提供的 clang 中启用该功能,也可以安装默认支持 OpenMP 的更新版本的 clang。
-
@IncreasinglyIdiotic 我们如何启用它?我们只需要编译和安装 openmp 运行时吗?
-
@MarcusJ 你应该只需要
brew install llvm libomp然后确保使用新的clang 来编译-fopenmp标志