brew install clang-omp not working

你说的曾经没有我的故事 提交于 2020-01-09 06:30:58

问题


I need to compile a C++ code with OpenMP on my Mac. Unfortunately the default version of clang installed on the Mac (703.0.31) does not support OpenMP. Therefore, I am trying to install the clang-omp package with brew (e.g., following this guide). The issue is that brew cannot find neither the libiomp, nor the clang-omp package:

$ 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.

I am wondering whether clang-omp is still provided by brew. Or am I doing something wrong? Any ideas?

Edit: If I do brew search I get the following:

$ brew search clang
clang-format           emacs-clang-complete-async
Caskroom/cask/openclonk-c54d917-darwin-amd64-clang

Thus, no evidence of clang-omp. Is it possible I have to change repository or something like this?


回答1:


You can install llvm using brew since it now includes openmp.

brew install llvm

You can make a symlink if you want

ln -s /usr/local/opt/llvm/bin/clang /usr/local/bin/clang-omp

My makefile looks like this

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)



回答2:


Install a deleted formula

brew install homebrew/boneyard/clamp-omp

OR

brew tap homebrew/boneyard
brew install clang-omp

Reference: https://superuser.com/questions/1110414/install-a-deleted-homebrew-formulae/1110934#1110934

Then you need to set the environment:

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



回答3:


clang-omp has been boneyarded. See this commit: https://github.com/Homebrew/homebrew-core/commit/c57e30773:

clang-omp: migrate to boneyard

Functionality is now available as part of LLVM in Homebrew. So just install llvm




回答4:


OpenMP was officially included in the brew (before the method, either install llvm, or outdated clang-omp).

brew install libomp


来源:https://stackoverflow.com/questions/38971394/brew-install-clang-omp-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!