New Issue: llvm@12 issues on mac

19217, "ronawho", "llvm@12 issues on mac", "2022-02-08T13:01:50Z"

While looking into https://github.com/chapel-lang/chapel/issues/17825 I wanted to try out llvm@12, but ran into a few issues (note that I first ran into this on aarch64 mac, but I can reproduce on x86 as well.)

First is that if llvm@11 and llvm@12 are both installed llvm@11 is preferred, but I don't think this is intentional. Reversing the order of llvm_versions finds llvm@12, so seems like either that or the code we use to iterate to find homebrew llvm versions needs to be reversed.

When actually using llvm@12 (and 13) I get errors about not being able to finder headers when compiling any program:

chpl examples/hello.chpl
<built-in>:1:10: fatal error: cannot open file './sys_basic.h': No such file or directory
#include "sys_basic.h"
         ^
1 error generated.
error: error running clang during code generation

Here's my chplenv:

./util/printchplenv --all --anonymize
CHPL_HOST_PLATFORM: darwin
CHPL_HOST_COMPILER: clang
  CHPL_HOST_CC: clang
  CHPL_HOST_CXX: clang++
CHPL_HOST_ARCH: arm64
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: llvm
  CHPL_TARGET_CC: /opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang
  CHPL_TARGET_CXX: /opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++
CHPL_TARGET_ARCH: arm64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
  CHPL_GPU_CODEGEN: none
CHPL_COMM: none
CHPL_TASKS: fifo
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_HOST_MEM: cstdlib
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: bundled
CHPL_HWLOC: none
CHPL_RE2: bundled
CHPL_LLVM: system
  CHPL_LLVM_CONFIG: /opt/homebrew/opt/llvm@12/bin/llvm-config
CHPL_AUX_FILESYS: none
CHPL_LIB_PIC: none
CHPL_SANITIZE: none
CHPL_SANITIZE_EXE: none