[Chapel Merge] Link LLVM and clang dynamically on Mac OS X

Branch: refs/heads/main
Revision: b4c3453
Author: mppf
Link: Link LLVM and clang dynamically on Mac OS X by mppf · Pull Request #20567 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #20567 from mppf/dynamic-link-clang-osx

Link LLVM and clang dynamically on Mac OS X

This PR adjusts the chplenv scripts so that chpl builds on Mac OS X
with system LLVM will link LLVM and Clang dynamically. That makes Mac OS
X less of an exception in this regard.

We were originally statically linking on Mac OS X with system LLVM due to
problems with upstream LLVM and Homebrew in building a dynamic library
that works with llvm-config (in particular, there were errors about a
versioned file, like libLLVM-11.dylib, missing). See this LLVM bug
report
. However this
should be fixed in Homebrew llvm@12 and newer.

Note that we are currently still statically linking for
CHPL_LLVM=bundled.

Future Work:

  • I observed a problem CHPL_LLVM=none and llvm@11 on Monterey, but this
    problem exists also on 'main', and this PR does not make it worse.

Reviewed by @ronawho - thanks!

Testing CHPL_LLVM=system make check with OS or Homebrew LLVM versions

  • note: Homebrew docs say "10.15 or higher is recommended while
    10.11-10.14 are supported on a best-effort basis". So, I only tested
    10.15 and newer here.

Mac OS X 10.15 "Catalina"

  • llvm@11

Mac OS X 11 "Big Sur"

  • llvm@11
  • llvm@12
  • llvm@13
  • llvm (14)

Mac OS X 12 "Monterey"