brew install clang-omp not working

29,603

Solution 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)

Solution 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

Solution 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

Solution 4

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

brew install libomp
Share:
29,603

Related videos on Youtube

mtazzari
Author by

mtazzari

Updated on April 12, 2020

Comments

  • mtazzari
    mtazzari about 4 years

    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?

    • Hristo Iliev
      Hristo Iliev almost 8 years
      Have you updated the brew recipes by calling brew update first?
    • mtazzari
      mtazzari almost 8 years
      @HristoIliev Yes, I did it. Just to be sure, I have re-done it right now (I have updated Homebrew from 87173cb to 984ed83) but still clang-omp is not found (I get the same error above).
    • Jim Cownie
      Jim Cownie almost 8 years
      LLVM 3.8 and later should support OpenMP "out of the box". Therefore there should no longer be any need to have a specific, different, clang-omp...
    • Mark Setchell
      Mark Setchell almost 8 years
      You could use gcc v6 to compile C++ with OpenMP. You can install with brew install gcc --without-multilib
    • Mark Setchell
      Mark Setchell almost 8 years
      @JimCownie How would you compile C++11 compliant main.cpp which uses OpenMP with LLVM please - what would be the full command-line?
    • 冯剑龙
      冯剑龙 about 5 years
      you can reference to link macappstore.org/clang-omp
  • Piyush Chauhan
    Piyush Chauhan over 7 years
    It says omp.h doesn't exists. Is it possible if you could provide an example, will be very helpful as i'm struggling to get it work with openmp.
  • slek120
    slek120 over 7 years
    @PiyushChauhan If I run make using the makefile in the answer, it would run /usr/local/opt/llvm/bin/clang -I/usr/local/opt/llvm/include -fopenmp example.c -o example -L/usr/local/opt/llvm/include
  • coatless
    coatless over 7 years
    Nice copy & paste of the deleted formula part from superuser.com/a/1110934/429046 without credit.
  • Microos
    Microos over 7 years
    @coatless Sorry, I just want to help. Hope you won't mind.
  • coatless
    coatless over 7 years
    Just give credit where credit is due, especially if you copy wording...
  • coatless
    coatless over 7 years
    Also, you may wish to remove the <formula> in the first example in favor of clamp-omp
  • SumNeuron
    SumNeuron almost 7 years
    this doesnt work when you have to use an older command lines tools
  • Sander W. van der Laan
    Sander W. van der Laan over 6 years
    I've just install llvm using brew install llvm. Still, the program I want to use (LDSTORE) is not working, stating dyld: Library not loaded: /usr/local/opt/libiomp/lib/libiomp5.dylib. How do I make sure that it is properly loaded? Where do I do this?
  • gaelgarcia
    gaelgarcia about 6 years
    What is the optional symlink step for? ln -s /usr/local/opt/llvm/bin/clang /usr/local/bin/clang-omp
  • slek120
    slek120 about 6 years
    The symlink is to put it in your path. I added the -omp to separate it from default clang and because it used to be called clang-omp in brew.
  • gbrennon
    gbrennon over 5 years
    I think this doesnt work anymore... We cant use brew tap anymore