Enable OpenMP support in clang in Mac OS X (sierra & Mojave)

后端 未结 4 1323
长情又很酷
长情又很酷 2020-11-28 09:37

I am using Mac OS X Sierra, and I found that clang (LLVM version 8.1.0 (clang-802.0.38)) does not support OpenMP: when I run clang -fopenmp program_name.c, I go

4条回答
  •  -上瘾入骨i
    2020-11-28 10:24

    Conda-Based Compilation Environment

    Conda uses clang for OSX compilation (umbrella package cxx-compiler), but I hit similar issues with using llvm-openmp and the -fopenmp flag throwing errors. Solution is rather similar to other answers, but I am including here in case others have more exactly this issue.

    Specific solution was to include the Conda environment's include/ directory in the CFLAGS, namely:

    CFLAGS="-I${CONDA_PREFIX}/include"
    

    Note, I also needed to add -lstdc++ -Wl,-rpath ${CONDA_PREFIX}/lib -L${CONDA_PREFIX}/lib when linking, similar to this GitHub Issue.

提交回复
热议问题