brew install clang-omp not working

后端 未结 4 1090
野的像风
野的像风 2020-12-02 23:26

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 tryin

相关标签:
4条回答
  • 2020-12-02 23:55

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

    brew install libomp
    
    0 讨论(0)
  • 2020-12-03 00:07

    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

    0 讨论(0)
  • 2020-12-03 00:08

    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
    
    0 讨论(0)
  • 2020-12-03 00:13

    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)
    
    0 讨论(0)
提交回复
热议问题