Skip to content

Installation issue: llvm@15 on macos #48865

@Chrismarsh

Description

@Chrismarsh

Steps to reproduce the issue

$spack spec llvm@15
[email protected]%[email protected]+clang~code_signing~cuda~flang~gold~ipo~libomptarget~libomptarget_debug~link_llvm_dylib+lld+lldb+llvm_dylib+lua~mlir+polly~python~split_dwarf~z3~zstd build_system=cmake build_type=Release compiler-rt=runtime generator=ninja libcxx=runtime libunwind=runtime openmp=runtime patches=25bc503,8248141,90f3d78 shlib_symbol_version=none targets=all version_suffix=none arch=darwin-sonoma-m1

Error message

The first error is:

In file included from /Users/cbm038/Documents/science/code/spack/stage/spack-stage-llvm-15.0.7-m7em4urqg5vmrjyfkyht4nn3wh4bwm6l/spack-src/lldb/source/API/SBFile.cpp:9:
/Users/cbm038/Documents/science/code/spack/stage/spack-stage-llvm-15.0.7-m7em4urqg5vmrjyfkyht4nn3wh4bwm6l/spack-src/lldb/include/lldb/API/SBFile.h:27:10: error: unknown type name 'FILE'
   27 |   SBFile(FILE *file, bool transfer_ownership);
      |          ^
/Users/cbm038/Documents/science/code/spack/stage/spack-stage-llvm-15.0.7-m7em4urqg5vmrjyfkyht4nn3wh4bwm6l/spack-src/lldb/source/API/SBFile.cpp:39:9: error: out-of-line definition of 'SBFile' does not match any declaration in 'lldb::SBFile'
   39 | SBFile::SBFile(FILE *file, bool transfer_ownership) {
      |         ^~~~~~
2 errors generated.

spack-build-out.txt

This error is resolvable with the following patch

--- a/lldb/include/lldb/API/SBFile.h
+++ b/lldb/include/lldb/API/SBFile.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_API_SBFILE_H
 #define LLDB_API_SBFILE_H

+#include <stdio.h>
 #include "lldb/API/SBDefines.h"

 namespace lldb {

This then leads to the error:

  >> 15498    /Users/cbm038/Documents/science/code/spack/stage/spack-stage-llvm-15.0.7-kum6jogrfnvj6vcavqcf5asvc2ipqr5b/spack-src/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp:630:15: error: const
              expr function never produces a constant expression [-Winvalid-constexpr]
     15499    constexpr u16 GetOSMajorKernelOffset() {
     15500                  ^
     15501    /Users/cbm038/Documents/science/code/spack/stage/spack-stage-llvm-15.0.7-kum6jogrfnvj6vcavqcf5asvc2ipqr5b/spack-src/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp:634:1: note: control
               reached end of constexpr function
     15502    }
     15503    ^

spack-build-out.txt

Which is resolvable with

--- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
@@ -618,7 +618,7 @@

 // Offset example:
 // XNU 17 -- macOS 10.13 -- iOS 11 -- tvOS 11 -- watchOS 4
-constexpr u16 GetOSMajorKernelOffset() {
+u16 GetOSMajorKernelOffset() {
   if (TARGET_OS_OSX) return 4;
   if (TARGET_OS_IOS || TARGET_OS_TV) return 6;
   if (TARGET_OS_WATCH) return 13;

However, a final error

>> 15504    /Users/cbm038/Documents/science/code/spack/stage/spack-stage-llvm-15.0.7-kum6jogrfnvj6vcavqcf5asvc2ipqr5b/spack-src/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp:1180:3: error: stati
              c assertion failed due to requirement 'max_vm <= (1ULL << 36)': Max virtual address must be less than mmap range size.
     15505      static_assert(max_vm <= SANITIZER_MMAP_RANGE_SIZE,
     15506      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

is unclear on how to resolve.

llvm@15 shipped in homebrew without major patches
Homebrew/homebrew-core@207de70#diff-5e996f93f5a1c45f4e6fc81331d60ad9171f503668b9d2521cce250d3c164dd9

Perhaps a redherring: the projects enabled don't match what homebrew asks for and I find it odd that libcxx, for example, isn't enabled, but I might be mis reading the output

-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is enabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- libcxx project is disabled
-- libcxxabi project is disabled
-- libunwind project is disabled
-- lld project is enabled
-- lldb project is enabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is enabled
-- pstl project is disabled
-- flang project is disabled

Information on your system

$ spack debug report
* **Spack:** 1.0.0.dev0 (72bc877add40ce4f21a8d534ab71820064049017)
* **Python:** 3.12.6
* **Platform:** darwin-sonoma-m1

Additional information

For the original error:
spack-build-env.txt
spack-build-out.txt

@haampie @skosukhin @trws

General information

  • I have run spack debug report and 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions