Branch: refs/heads/main
Revision: 4bd353c
Author: mppf
Link: Link chpl with the same libc++ that built the Homebrew LLVM by mppf · Pull Request #19445 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #19445 from mppf/address-19217
Link chpl with the same libc++ that built the Homebrew LLVM
Resolves #19217
This PR adds a workaround to solve #19217. The problem we were seeing is
that the Homebrew LLVM is built with one C++ standard library, but it
includes a different version of a C++ standard library that our include
and link paths were picking up. This can be detected with comparing
output of otool -L chpl
vs otool -l libLLVM.dylib
(with appropriate
paths).
To fix it, this PR adjusts chpl_llvm.py
to:
- compute the sdk used when building the llvm/clang Homebrew package.
The current strategy is to find theDEFAULT_SYSROOT
define from
clang/Config/config.h
. This strategy relies on the Homebrew formula
passing-DDEFAULT_SYSROOT=#{macos_sdk}
when cmake'ing llvm and
clang. The main alternative strategy that I know of for this is more
complex and relies on running bothotool
andxcrun
. - Put -I and -L paths based on this sdk first in the system compile
options so that we find the sdk libc++ rather than one from the
Homebrew package
While there, I fixed some problems in error reporting when checking an
llvm-config.
Reviewed by @ronawho - thanks!
Testing:
-
thanks to @ronawho and @aconsroe-hpe for helping test some of these
configs -
[ ] full local testing
-
[x] Ubuntu 21.10 system still works with system LLVM
-
[x] Ubuntu 21.10 system with homebrew works with homebrew llvm@12
-
[x] Monterey (12.2) ARM Mac with llvm@11, llvm@12, and llvm@13
-
[x] Monterey (12.2) x86 Mac with llvm@11, llvm@12, and llvm@13
-
[x] Big Sur (11.6) x86 Mac with llvm@12 and llvm@13
-
[x] Catalina (10.15.7) x86 Mac with llvm@11, llvm@12, and llvm@13
-
[x] some of the above Mac systems have xcode and some only have command
line toolsModified Files:
M util/chplenv/chpl_llvm.pyCompare: Comparing 080e5b797287...4bd353ce8261 · chapel-lang/chapel · GitHub