Using "clang" - toolchain question

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Fri Jan 24 00:29:09 UTC 2020


Greg, I am repeatedly building port NCARG with a simple recipe, as part of
my local testing regime.  I never use any special options related to a
clang version or OpenMP.  This seems to work fine every time.  I am on a
Mac Pro, currently running OS 10.14.6 Mojave and Xcode 11.3.  This also
worked fine with recent earlier versions.  Here is a summary of my current
recipe.

    Create local test directory in user space, not /opt/local
    Isolate a test environment, omit /opt/local and /usr /local

    Install macports base, current version
    port install -s gcc9    (with libunwind workaround)
    port install -s hdf5 +gcc9
    port install -s ncarg

I repeatedly confirmed that the hdf5 +gcc9 variant is necessary here.
OpenMP requirements seem to be satisfied automatically within this simple
scenario.  It is possible that my brief executable tests (NCL scripts) are
not properly exercising OpenMP.

I would expect that a similar recipe would also work in the standard
/opt/local location.  You might not need to source-build anything other
than NCARG, maybe this hdf5 variant; not sure about that.  Try this if you
think it might help.


On Wed, Jan 22, 2020 at 11:58 PM Greg Earle <earle at isolar.dyndns.org> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20200123/2aaabf45/attachment.html>


More information about the macports-users mailing list