Using "clang" - toolchain question

Ken Cunningham ken.cunningham.webuse at
Thu Jan 23 23:26:39 UTC 2020

Apple’s clang numbering and LLVM’s clang numbering diverged a while ago, and in fact LLVM’s clang is usually a year or two ahead of Apple’s.

Apple has it’s own fork of clang and llvm, and the two are similar but not identical. Indeed, openmp support is one area where they diverge.

LLVM’s clang supports openmp, but it can take some finagling — you need to use the -fopenmp flag, of course, and you need to pass in the proper link libraries.

I have found no shortage of configure file errors trying to support openmp with clang — until Apple’s clang (Xcode) supports it, these will probably not get properly sorted out.

So with that in mind, you just install the clang you want:

sudo port -v install clang-9.0

and then specify the one you want in your build with

CC=/opt/local/bin/clang-mp-9.0 CXX=/opt/local/bin/clang++-mp-9.0 CXXFLAGS=-fopenmp etc etc etc

or similar.

You can find out what files are included with a port install like this:

port contents clang-9.0 | grep bin/clang

or similar.

If it’s a MacPorts port that you want to add openmp support to, that doesn’t already have it — well, good luck. That’s hard.

But ask for help, and someone will help guide you with a specific question.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list