Commit 3b9bdd8
authored
[Build] Use brew clang compiler on mac (#8704)
Issue: #
### Brief Summary
Use brew clang compiler on mac
copilot:summary
### Walkthrough
When building on latest Macs, e.g. Sequoia, the system clang is 16.0.0,
or 17.0.0, depending on whether using XCode (16.0.0), or command line
tools (17.0.0). Either way, the bytecode generated at
python/taichi/_lib/runtime/runtime_arm64.bc is not loadable by llvm 15.
Trying to load the clang-15/16 compiled runtime_arm64.bc with llvm 15
gives an error about unknown attribute (86). llvm 15 is the version of
llvm used by taichi currently. therefore, building using system clang on
macos sequoia prevents taichi from loading/running.
Example failure:
https://github.com/taichi-dev/taichi/actions/runs/14742813933/job/41384420135?pr=8688

To fix this, we use the clang from the brew installed llvm@15 instead.
This then runs ok.
We assume in compile.py that brew has already been used earlier in the
script to install llvm@15. We use brew config to locate brew, and then
assume the clang path as `{HOMEBREW_PREFIX}/opt/llvm@15/bin/clang`, and
similarly for clang++.
copilot:walkthrough1 parent e8fd57b commit 3b9bdd8
1 file changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
27 | | - | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
37 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
38 | 52 | | |
39 | 53 | | |
40 | 54 | | |
| |||
0 commit comments