我需要在Mac上使用OpenMP编译C ++代码。不幸的是,Mac上安装的默认版本的clang(703.0.31)不支持OpenMP。因此,我正在尝试使用brew安装clang-omp包(例如,遵循this指南)。问题是brew找不到libiomp,也找不到clang-omp包:
$ brew install clang-omp
Error: No available formula with the name "clang-omp"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
我想知道clang-omp是否仍由brew提供。或者我做错了什么?有任何想法吗?
编辑:如果我做brew搜索,我得到以下内容:
$ brew search clang
clang-format emacs-clang-complete-async
Caskroom/cask/openclonk-c54d917-darwin-amd64-clang
因此,没有铿锵的证据。我是否有可能更改存储库或类似的东西?
您可以使用brew安装llvm,因为它现在包含openmp。
brew install llvm
如果需要,您可以创建符号链接
ln -s /usr/local/opt/llvm/bin/clang /usr/local/bin/clang-omp
我的makefile看起来像这样
CPP = /usr/local/opt/llvm/bin/clang
CPPFLAGS = -I/usr/local/opt/llvm/include -fopenmp
LDFLAGS = -L/usr/local/opt/llvm/lib
example: example.c
$(CPP) $(CPPFLAGS) $^ -o $@ $(LDFLAGS)
安装已删除的公式
brew install homebrew/boneyard/clamp-omp
要么
brew tap homebrew/boneyard
brew install clang-omp
参考:https://superuser.com/questions/1110414/install-a-deleted-homebrew-formulae/1110934#1110934
然后你需要设置环境:
export C_INCLUDE_PATH=/usr/local/Cellar/libiomp/20150401/include/libiomp:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/Cellar/libiomp/!date!/include/libiomp:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=/usr/local/Cellar/libiomp/!date!/lib:$LIBRARY_PATH
clang-omp已被保管。看到这个提交:https://github.com/Homebrew/homebrew-core/commit/c57e30773:
clang-omp:迁移到boneyard
功能现在可作为Homebrew中LLVM的一部分提供。所以只需安装llvm
OpenMP正式包含在brew中(在方法之前,安装llvm或过时的clang-omp)。
brew install libomp