Skip to content

Instantly share code, notes, and snippets.

@jakelee8
Last active July 5, 2016 01:54
Show Gist options
  • Save jakelee8/f9cd90e4e68494c5667bcf1c271cf70b to your computer and use it in GitHub Desktop.
Save jakelee8/f9cd90e4e68494c5667bcf1c271cf70b to your computer and use it in GitHub Desktop.
Compile programs with OpenMP support on macOS

Compile programs with OpenMP on macOS and llvm/clang.

  1. Download the LLVM-3.8 binaries:
  1. Install the binaries:

For example, to install at /opt/llvm38:

tar xJf clang+llvm-3.8.0-x86_64-apple-darwin.tar.xz
sudo mkdir -p /opt
sudo mv clang+llvm-3.8.0-x86_64-apple-darwin /opt/llvm38
  1. Configure the environment to use clang-3.8:
export CC=/opt/llvm38/bin/clang
export CXX=/opt/llvm38/bin/clang++
export PATH=/opt/llvm38/bin:$PATH
export C_INCLUDE_PATH=/opt/llvm38/include:/usr/local/include:/usr/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/opt/llvm38/include:/usr/local/include:/usr/include:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=/opt/llvm38/lib:/usr/local/lib:/usr/lib:$LIBRARY_PATH
export DYLD_LIBRARY_PATH=/opt/llvm38/lib:$DYLD_LIBRARY_PATH

For most programs, setting the environmental settings should be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment