spack: llvm fails to install on M1 Max
LLVM 13 fails to install with:
[2028/7867] /Users/ondrej/repos/spack/lib/spack/env/clang/clang -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/private/var/folders/8w/5mqfkhqn1nj0tw97g3hl1nyh0000gn/T/ondrej/spack-stage/spack-stage-llvm-13.0.1-phyeyvk4nr7dpi4ekep44qvyzenfox4a/spack-build-phyeyvk/projects/compiler-rt/lib/builtins -I/private/var/folders/8w/5mqfkhqn1nj0tw97g3hl1nyh0000gn/T/ondrej/spack-stage/spack-stage-llvm-13.0.1-phyeyvk4nr7dpi4ekep44qvyzenfox4a/spack-src/compiler-rt/lib/builtins -I/private/var/folders/8w/5mqfkhqn1nj0tw97g3hl1nyh0000gn/T/ondrej/spack-stage/spack-stage-llvm-13.0.1-phyeyvk4nr7dpi4ekep44qvyzenfox4a/spack-build-phyeyvk/include -I/private/var/folders/8w/5mqfkhqn1nj0tw97g3hl1nyh0000gn/T/ondrej/spack-stage/spack-stage-llvm-13.0.1-phyeyvk4nr7dpi4ekep44qvyzenfox4a/spack-src/llvm/include -O3 -DNDEBUG -arch x86_64h -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.5 -fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer -DHAS_ASM_LSE -arch x86_64h -MD -MT projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_x86_64h_osx.dir/paritydi2.c.o -MF projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_x86_64h_osx.dir/paritydi2.c.o.d -o projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_x86_64h_osx.dir/paritydi2.c.o -c /private/var/folders/8w/5mqfkhqn1nj0tw97g3hl1nyh0000gn/T/ondrej/spack-stage/spack-stage-llvm-13.0.1-phyeyvk4nr7dpi4ekep44qvyzenfox4a/spack-src/compiler-rt/lib/builtins/paritydi2.c
FAILED: projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_x86_64h_osx.dir/paritydi2.c.o
error: unknown target CPU 'armv8.4-a'
note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
Note that this exact version used to install for me on M1 (not Max): https://github.com/spack/spack/issues/26319#issuecomment-962632195, so either something is different on M1 Max as opposed to M1, or something in Spack changed.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 18 (17 by maintainers)
future me … just happened so thanks for your debugging efforts more than a year ago!
In this case, the system Python (
/usr/bin/python3) works great, it’s Homebrew Python that breaks everything. Note that Spack is still installing its own Python in the DAG, the issue is with the Python used to run the Spack executable. Anyway, just mentioning this in case anyone else runs into this issue (ahem, future me) and maybe this will be a potential fix for them.Figured it out, I knew I had seen this before.
The first
python3in myPATHwas an x86_64 executable (built by homebrew) running in Rosetta mode. If I setSPACK_PYTHON=/usr/bin/python3and use that aarch64 built Python, all of my builds magically succeed. Any idea why the Python used to run Spack would affect the build like this?spack archstill reports aarch64 regardless, so I’m not sure what could be wrong.That’s perfectly fine to get to a functional compile, but as to optimization it will not. It will compile to the least-common-denominator aarch64 target. There’s more information in the archspec issue, but you really want to have the
-mcpuon there if you want best performance out of it. This is actually true for arm targets on all compilers, nobody should be using march for arm targets is my understanding, so I’m hoping we can get that cleaned up over there.