spack: Installation issue: LLVM fails on MacOS with clang and microarchitecture flags
Steps to reproduce the issue
Ensure that the clang compiler is not a mixed toolchain in compilers.yaml:
compilers:
- compiler:
spec: apple-clang@12.0.0
paths:
cc: /usr/bin/clang
cxx: /usr/bin/clang++
f77: null
fc: null
operating_system: catalina
target: x86_64
modules: []
environment: {}
extra_rpaths: []
$ spack install llvm
...
>> 3736 clang: error: the clang compiler does not support '-march=skylake'
>> 3737 make[2]: *** [projects/compiler-rt/lib/builtins/CMakeFiles/clang_r
t.builtins_arm64_osx.dir/comparetf2.c.o] Error 1
Make the clang compiler a mixed toolchain (in my case, I build gcc and copy the f77 & fc lines)
$ spack install llvm
==> No binary for llvm-11.1.0-capkkllvmkkcl3wkyviaegdqxwxw5xfq found: installing from source
==> Warning: Missing a source id for apple-libuuid@1353.100.2
==> Warning: microarchitecture specific optimizations are not supported yet on mixed compiler toolchains [check apple-clang@12.0.0 for further details]
...
Success
Information on your system
macOS catalina, 10.15.7
- Spack: 0.16.0-2323-a568903a64
- Python: 3.7.9
- Platform: darwin-catalina-skylake
- Concretizer: original
Additional information
General information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have run
spack maintainers <name-of-the-package>and @mentioned any maintainers - I have uploaded the build log and environment files
- I have searched the issues of this repo and believe this is not a duplicate
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 18 (17 by maintainers)
Just upgraded to BigSur (from Mojave), same problem building LLVM with spack.
My understanding is:
-march=skylakeinto each compilation line (I suppose via the compiler wrapper using the env variableSPACK_TARGET_ARGS),arm64When it starts cross-compiling the build command becomes inconsistent, because it finds itself building for an architecture, i.e.
-arch arm64, which is not compatible with the flag imposed by spack, i.e.-march=skylake.My expectation is that if it would be possible to constraint via CMake to build LLVM just for the native architecture, it would work. I don’t know if it would be reasonable or not, but if that’s the case it would be possible to think about differentiating the native compilation from the cross-build one in spack/spack package.
Unfortunately, at the moment I’m still not able to constrain it (tried with
CMAKE_OSX_ARCHITECTUREShttps://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html?highlight=cmake_osx_architectures with no luck). I will hopefully give a look to LLVM cmake options next week.Note: I don’t know exactly what that means, but during LLVM build I see both next two “types” of build lines (depending on the cmake target):
clang ... -arch x86_64clang ... -arch x86_64 -arch arm64The second one is the offending one, because it results in
-arch x86_64 -arch arm64 -march=skylake ..., which LLVM is not able to interpret complaining withclang: error: the clang compiler does not support '-march=skylake'.Information
Problem with both LLVM 12 and 13, both with
Command_Line_Tools_for_Xcode_13.1andCommand_Line_Tools_for_Xcode_13.2_beta.That’s certainly what it looks like. At least it’s an issue with handling of clang and Apple-clang as opposed to the LLVM/clang package.
Sent from my iPhone
On Apr 20, 2021, at 9:49 PM, Nichols A. Romero @.***> wrote:
If I am understand correctly, the issue is not specific to LLVM package but more of a global problem?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.us/v3/__https://github.com/spack/spack/issues/23036*issuecomment-823773217__;Iw!!G2kpM7uM-TzIFchu!liOZVLyCRxpkjDjpG1L2FfFyuUdZpqmrKmgqm18UC3lwxY2HCdTDyN8ZPa0pGBBZaA$, or unsubscribehttps://urldefense.us/v3/__https://github.com/notifications/unsubscribe-auth/AAFBFNPIJBACYIIPPDP7CRDTJZKN5ANCNFSM43BV243Q__;!!G2kpM7uM-TzIFchu!liOZVLyCRxpkjDjpG1L2FfFyuUdZpqmrKmgqm18UC3lwxY2HCdTDyN8ZPa2TBW24IA$.