Using "clang" - toolchain question

Greg Earle earle at isolar.DynDNS.ORG
Thu Jan 23 06:58:10 UTC 2020


I'm looking at my dev Mac and there are several versions of "clang" on 
the system:

mac{cmbuild}% /usr/bin/clang -v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

mac{cmbuild}% /Library/Developer/CommandLineTools/usr/bin/clang -v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

mac{cmbuild}% 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 
-v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix

mac{cmbuild}% /opt/local/libexec/llvm-9.0/bin/clang -v
clang version 9.0.1
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-9.0/bin

Now the MacPorts "clang-9.0" port might be a little behind the Apple 
version but it has something the Apple "clang" binaries don't have - 
support for "-fopenmp".

I'm trying to build something (NCAR Graphics) that wants/demands 
"-fopenmp" support.

How can I get the build to use the MacPorts "clang" part of the 
toolchain?

Do I just stick "/opt/local/libexec/llvm-9.0/bin" at the front of $PATH 
and hope that "gcc"/"gfortran" et al. don't have any embedded "clang" 
paths (like "/usr/bin/clang") in them?

Or do I have to install a matching GCC port (like libgcc8/gcc8 @8.2.0) 
to match up with "clang-9.0"?

(I'm using a gfortran that's GCC 8.2.0-based, if it matters.)

Thanks,

		- Greg


More information about the macports-users mailing list