最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

macos - LLVM cmake build fails, giving "FAILED: libTargetX86CMakeFilesLLVMX86CodeGen.dirX86WinEHState.cpp.o" e

programmeradmin1浏览0评论

I am new to LLVM and want to write analysis / transformation passes in LLVM.

My iMac configurations are:
Chip : M1
Memory : 16 GB
macOS : Sonoma 14.4.1

I am trying to build llvm-clang for the first time from source using the following command:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug \
 -DCMAKE_C_COMPILER=/opt/homebrew/Cellar/llvm/19.1.7/bin/clang \
-DCMAKE_CXX_COMPILER=/opt/homebrew/Cellar/llvm/19.1.7/bin/clang++ - \
DCMAKE_MAKE_PROGRAM=/opt/homebrew/bin/Ninja \
-DCMAKE_INSTALL_PREFIX=/Users/sudeep/custom-llvm \
-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_OPTIMIZED_TABLEGEN=TRUE \
../llvm-project/llvm

But on building it using cmake --build ., I am getting the following error. I tried searching a solution to resolve this error but could not found anything.

[375/5326] Configuring NATIVE LLVM...
CMake Deprecation Warning at /Users/sudeep/Documents/llvm_practice/llvm-project/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
  The OLD behavior for policy CMP0116 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:7 (include)


-- The C compiler identification is Clang 19.1.7
-- The CXX compiler identification is Clang 19.1.7
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /opt/homebrew/Cellar/llvm/19.1.7/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/Cellar/llvm/19.1.7/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/Cellar/llvm/19.1.7/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Found libtool - /Library/Developer/CommandLineTools/usr/bin/libtool
-- Found Python3: /opt/homebrew/Frameworks/Python.framework/Versions/3.13/bin/python3.13 (found suitable version "3.13.2", minimum required is "3.0") found components: Interpreter
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Success
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - not found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - not found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Performing Test HAVE_BUILTIN_THREAD_POINTER
-- Performing Test HAVE_BUILTIN_THREAD_POINTER - Success
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Performing Test HAVE_CRASHREPORTER_INFO
-- Performing Test HAVE_CRASHREPORTER_INFO - Success
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for shm_open in rt
-- Looking for shm_open in rt - not found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libz.tbd (found version "1.2.12")
-- Looking for compress2
-- Looking for compress2 - found
-- Found LibXml2: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libxml2.tbd (found version "2.9.13")
-- Looking for xmlReadMemory
-- Looking for xmlReadMemory - found
-- Looking for histedit.h
-- Looking for histedit.h - found
-- Found LibEdit: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include (found version "2.11")
-- Looking for arc4random
-- Looking for arc4random - found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Looking for __register_frame
-- Looking for __register_frame - found
-- Looking for __deregister_frame
-- Looking for __deregister_frame - found
-- Looking for __unw_add_dynamic_fde
-- Looking for __unw_add_dynamic_fde - found
-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Looking for mallctl
-- Looking for mallctl - not found
-- Looking for mallinfo
-- Looking for mallinfo - not found
-- Looking for mallinfo2
-- Looking for mallinfo2 - not found
-- Looking for malloc_zone_statistics
-- Looking for malloc_zone_statistics - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for sbrk
-- Looking for sbrk - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strerror_s
-- Looking for strerror_s - not found
-- Looking for setenv
-- Looking for setenv - found
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Success
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Failed
-- Looking for pthread_getname_np
-- Looking for pthread_getname_np - found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Looking for pthread_get_name_np
-- Looking for pthread_get_name_np - not found
-- Looking for pthread_set_name_np
-- Looking for pthread_set_name_np - not found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for proc_pid_rusage
-- Looking for proc_pid_rusage - found
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- LLVM host triple: arm64-apple-darwin23.4.0
-- Native target architecture is AArch64
-- Threads enabled.
-- Doxygen disabled.
-- Ninja version: 1.12.1
-- Found ld64 - /Library/Developer/CommandLineTools/usr/bin/ld-classic
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- Could NOT find Python module pygments
-- Could NOT find Python module pygments.lexers.c_cpp
-- Could NOT find Python module yaml
-- LLVM default target triple: arm64-apple-darwin23.4.0
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Success
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Success
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - found
-- Performing Test macos_signposts_usable
-- Performing Test macos_signposts_usable - Success
-- Linker detection: Apple
-- Performing Test LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS
-- Performing Test LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS - Success
-- Performing Test LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES
-- Performing Test LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES - Success
-- Performing Test HAS_WERROR_GLOBAL_CTORS
-- Performing Test HAS_WERROR_GLOBAL_CTORS - Success
-- Performing Test LLVM_HAS_NOGLOBAL_CTOR_MUTEX
-- Performing Test LLVM_HAS_NOGLOBAL_CTOR_MUTEX - Failed
-- Looking for __x86_64__
-- Looking for __x86_64__ - not found
-- Found Git: /opt/homebrew/bin/git (found version "2.48.1")
-- Looking for logf128
-- Looking for logf128 - not found
-- Targeting AArch64
-- Targeting AMDGPU
-- Targeting ARM
-- Targeting AVR
-- Targeting BPF
-- Targeting Hexagon
-- Targeting Lanai
-- Targeting LoongArch
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting RISCV
-- Targeting Sparc
-- Targeting SPIRV
-- Targeting SystemZ
-- Targeting VE
-- Targeting WebAssembly
-- Targeting X86
-- Targeting XCore
CMake Deprecation Warning at /Users/sudeep/Documents/llvm_practice/llvm-project/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
  The OLD behavior for policy CMP0116 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  /Users/sudeep/Documents/llvm_practice/llvm-project/clang/CMakeLists.txt:7 (include)


-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Clang version: 21.0.0git
-- Host linker version: 1053.12
-- Looking for include file CoreServices/CoreServices.h
-- Looking for include file CoreServices/CoreServices.h - found
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT - Failed
-- Registering ExampleIRTransforms as a pass plugin (static build: OFF)
-- Registering Bye as a pass plugin (static build: OFF)
-- Configuring done (19.5s)
-- Generating done (1.6s)
-- Build files have been written to: /Users/sudeep/Documents/llvm_practice/llvm-build/NATIVE
[375/5326] Building native llvm-min-tblgen...
[195/195] Linking CXX executable bin/llvm-min-tblgen
[390/5326] Building native clang-tblgen...
[24/24] Linking CXX executable bin/clang-tblgen
[1098/5326] Building native llvm-tblgen...
[87/87] Linking CXX executable bin/llvm-tblgen
[1340/5326] Linking CXX static library lib/libLLVMFrontendHLSL.a
warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: lib/libLLVMFrontendHLSL.a the table of contents is empty (no object file members in the library define global symbols)
[3997/5326] Building CXX object lib/Target/X8...eFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o
FAILED: lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o
/opt/homebrew/Cellar/llvm/19.1.7/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/sudeep/Documents/llvm_practice/llvm-build/lib/Target/X86 -I/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86 -I/Users/sudeep/Documents/llvm_practice/llvm-build/include -I/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include -isystem /opt/homebrew/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk  -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o -MF lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o.d -o lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o -c /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86/X86WinEHState.cpp
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86/X86WinEHState.cpp:17:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h:19:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/GraphTraits.h:22:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/STLExtras.h:21:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/Hashing.h:52:
In file included from /opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/algorithm:1828:
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_backward.h:98:68: error: invalid operands to binary expression ('llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' and 'long')
   98 |       auto __iter        = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).second;
      |                                                             ~~~~~~ ^ ~~~~~~
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_move_common.h:95:19: note: in instantiation of function template specialization 'std::__copy_backward_impl<std::_ClassicAlgPolicy>::operator()<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>, 0>' requested here
   95 |   auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
      |                   ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_backward.h:119:15: note: in instantiation of function template specialization 'std::__copy_move_unwrap_iters<std::__copy_backward_impl<std::_ClassicAlgPolicy>, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>, 0>' requested here
  119 |   return std::__copy_move_unwrap_iters<__copy_backward_impl<_AlgPolicy> >(
      |               ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_backward.h:130:15: note: in instantiation of function template specialization 'std::__copy_backward<std::_ClassicAlgPolicy, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>>' requested here
  130 |   return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
      |               ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/deque:1938:12: note: in instantiation of function template specialization 'std::copy_backward<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>>' requested here
 1938 |       std::copy_backward(__f, __m, __old_end);
      |            ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/deque:1874:10: note: in instantiation of function template specialization 'std::deque<llvm::BasicBlock *>::__insert_bidirectional<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>>' requested here
 1874 |   return __insert_bidirectional(__p, __f, __l, std::distance(__f, __l));
      |          ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/STLExtras.h:2121:5: note: in instantiation of function template specialization 'std::deque<llvm::BasicBlock *>::insert<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, 0>' requested here
 2121 |   C.insert(C.end(), adl_begin(R), adl_end(R));
      |     ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86/X86WinEHState.cpp:724:11: note: in instantiation of function template specialization 'llvm::append_range<std::deque<llvm::BasicBlock *>, llvm::iterator_range<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>>>' requested here
  724 |     llvm::append_range(Worklist, successors(BB));
      |           ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2193:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'APInt' for 1st argument
 2193 | inline APInt operator-(APInt a, uint64_t RHS) {
      |              ^         ~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2182:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'APInt' for 1st argument
 2182 | inline APInt operator-(APInt a, const APInt &b) {
      |              ^         ~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2187:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'const APInt' for 1st argument
 2187 | inline APInt operator-(const APInt &a, APInt &&b) {
      |              ^         ~~~~~~~~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2198:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'uint64_t' (aka 'unsigned long long') for 1st argument
 2198 | inline APInt operator-(uint64_t LHS, APInt b) {
      |              ^         ~~~~~~~~~~~~
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__iterator/move_iterator.h:303:1: note: candidate template ignored: could not match 'move_iterator' against 'llvm::SuccIterator'
  303 | operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) {
      | ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__iterator/reverse_iterator.h:287:1: note: candidate template ignored: could not match 'reverse_iterator' against 'llvm::SuccIterator'
  287 | operator-(const reverse_iterator<_Iter1>& __x,
      | ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__iterator/wrap_iter.h:209:5: note: candidate template ignored: could not match '__wrap_iter' against 'llvm::SuccIterator'
  209 |     operator-(const __wrap_iter<_Iter1>& __x,
      |     ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/IR/CFG.h:213:7: note: candidate function not viable: no known conversion from 'long' to 'const Self' (aka 'const SuccIterator<llvm::Instruction, llvm::BasicBlock>') for 1st argument
  213 |   int operator-(const Self &RHS) const {
      |       ^         ~~~~~~~~~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2157:14: note: candidate function not viable: requires single argument 'v', but 2 arguments were provided
 2157 | inline APInt operator-(APInt v) {
      |              ^         ~~~~~~~
1 error generated.
[4006/5326] Building CXX object lib/Target/X8...VMX86CodeGen.dir/GISel/X86LegalizerInfo.cpp.o
ninja: build stopped: subcommand failed.

I am new to LLVM and want to write analysis / transformation passes in LLVM.

My iMac configurations are:
Chip : M1
Memory : 16 GB
macOS : Sonoma 14.4.1

I am trying to build llvm-clang for the first time from source using the following command:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug \
 -DCMAKE_C_COMPILER=/opt/homebrew/Cellar/llvm/19.1.7/bin/clang \
-DCMAKE_CXX_COMPILER=/opt/homebrew/Cellar/llvm/19.1.7/bin/clang++ - \
DCMAKE_MAKE_PROGRAM=/opt/homebrew/bin/Ninja \
-DCMAKE_INSTALL_PREFIX=/Users/sudeep/custom-llvm \
-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_OPTIMIZED_TABLEGEN=TRUE \
../llvm-project/llvm

But on building it using cmake --build ., I am getting the following error. I tried searching a solution to resolve this error but could not found anything.

[375/5326] Configuring NATIVE LLVM...
CMake Deprecation Warning at /Users/sudeep/Documents/llvm_practice/llvm-project/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
  The OLD behavior for policy CMP0116 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:7 (include)


-- The C compiler identification is Clang 19.1.7
-- The CXX compiler identification is Clang 19.1.7
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /opt/homebrew/Cellar/llvm/19.1.7/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/Cellar/llvm/19.1.7/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/Cellar/llvm/19.1.7/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Found libtool - /Library/Developer/CommandLineTools/usr/bin/libtool
-- Found Python3: /opt/homebrew/Frameworks/Python.framework/Versions/3.13/bin/python3.13 (found suitable version "3.13.2", minimum required is "3.0") found components: Interpreter
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Success
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - not found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - not found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Performing Test HAVE_BUILTIN_THREAD_POINTER
-- Performing Test HAVE_BUILTIN_THREAD_POINTER - Success
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Performing Test HAVE_CRASHREPORTER_INFO
-- Performing Test HAVE_CRASHREPORTER_INFO - Success
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for shm_open in rt
-- Looking for shm_open in rt - not found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libz.tbd (found version "1.2.12")
-- Looking for compress2
-- Looking for compress2 - found
-- Found LibXml2: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libxml2.tbd (found version "2.9.13")
-- Looking for xmlReadMemory
-- Looking for xmlReadMemory - found
-- Looking for histedit.h
-- Looking for histedit.h - found
-- Found LibEdit: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include (found version "2.11")
-- Looking for arc4random
-- Looking for arc4random - found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Looking for __register_frame
-- Looking for __register_frame - found
-- Looking for __deregister_frame
-- Looking for __deregister_frame - found
-- Looking for __unw_add_dynamic_fde
-- Looking for __unw_add_dynamic_fde - found
-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Looking for mallctl
-- Looking for mallctl - not found
-- Looking for mallinfo
-- Looking for mallinfo - not found
-- Looking for mallinfo2
-- Looking for mallinfo2 - not found
-- Looking for malloc_zone_statistics
-- Looking for malloc_zone_statistics - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for sbrk
-- Looking for sbrk - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strerror_s
-- Looking for strerror_s - not found
-- Looking for setenv
-- Looking for setenv - found
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Success
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Failed
-- Looking for pthread_getname_np
-- Looking for pthread_getname_np - found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Looking for pthread_get_name_np
-- Looking for pthread_get_name_np - not found
-- Looking for pthread_set_name_np
-- Looking for pthread_set_name_np - not found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for proc_pid_rusage
-- Looking for proc_pid_rusage - found
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- LLVM host triple: arm64-apple-darwin23.4.0
-- Native target architecture is AArch64
-- Threads enabled.
-- Doxygen disabled.
-- Ninja version: 1.12.1
-- Found ld64 - /Library/Developer/CommandLineTools/usr/bin/ld-classic
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- Could NOT find Python module pygments
-- Could NOT find Python module pygments.lexers.c_cpp
-- Could NOT find Python module yaml
-- LLVM default target triple: arm64-apple-darwin23.4.0
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Success
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Success
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - found
-- Performing Test macos_signposts_usable
-- Performing Test macos_signposts_usable - Success
-- Linker detection: Apple
-- Performing Test LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS
-- Performing Test LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS - Success
-- Performing Test LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES
-- Performing Test LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES - Success
-- Performing Test HAS_WERROR_GLOBAL_CTORS
-- Performing Test HAS_WERROR_GLOBAL_CTORS - Success
-- Performing Test LLVM_HAS_NOGLOBAL_CTOR_MUTEX
-- Performing Test LLVM_HAS_NOGLOBAL_CTOR_MUTEX - Failed
-- Looking for __x86_64__
-- Looking for __x86_64__ - not found
-- Found Git: /opt/homebrew/bin/git (found version "2.48.1")
-- Looking for logf128
-- Looking for logf128 - not found
-- Targeting AArch64
-- Targeting AMDGPU
-- Targeting ARM
-- Targeting AVR
-- Targeting BPF
-- Targeting Hexagon
-- Targeting Lanai
-- Targeting LoongArch
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting RISCV
-- Targeting Sparc
-- Targeting SPIRV
-- Targeting SystemZ
-- Targeting VE
-- Targeting WebAssembly
-- Targeting X86
-- Targeting XCore
CMake Deprecation Warning at /Users/sudeep/Documents/llvm_practice/llvm-project/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
  The OLD behavior for policy CMP0116 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  /Users/sudeep/Documents/llvm_practice/llvm-project/clang/CMakeLists.txt:7 (include)


-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Clang version: 21.0.0git
-- Host linker version: 1053.12
-- Looking for include file CoreServices/CoreServices.h
-- Looking for include file CoreServices/CoreServices.h - found
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT - Failed
-- Registering ExampleIRTransforms as a pass plugin (static build: OFF)
-- Registering Bye as a pass plugin (static build: OFF)
-- Configuring done (19.5s)
-- Generating done (1.6s)
-- Build files have been written to: /Users/sudeep/Documents/llvm_practice/llvm-build/NATIVE
[375/5326] Building native llvm-min-tblgen...
[195/195] Linking CXX executable bin/llvm-min-tblgen
[390/5326] Building native clang-tblgen...
[24/24] Linking CXX executable bin/clang-tblgen
[1098/5326] Building native llvm-tblgen...
[87/87] Linking CXX executable bin/llvm-tblgen
[1340/5326] Linking CXX static library lib/libLLVMFrontendHLSL.a
warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: lib/libLLVMFrontendHLSL.a the table of contents is empty (no object file members in the library define global symbols)
[3997/5326] Building CXX object lib/Target/X8...eFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o
FAILED: lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o
/opt/homebrew/Cellar/llvm/19.1.7/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/sudeep/Documents/llvm_practice/llvm-build/lib/Target/X86 -I/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86 -I/Users/sudeep/Documents/llvm_practice/llvm-build/include -I/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include -isystem /opt/homebrew/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk  -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o -MF lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o.d -o lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86WinEHState.cpp.o -c /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86/X86WinEHState.cpp
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86/X86WinEHState.cpp:17:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h:19:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/GraphTraits.h:22:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/STLExtras.h:21:
In file included from /Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/Hashing.h:52:
In file included from /opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/algorithm:1828:
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_backward.h:98:68: error: invalid operands to binary expression ('llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' and 'long')
   98 |       auto __iter        = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).second;
      |                                                             ~~~~~~ ^ ~~~~~~
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_move_common.h:95:19: note: in instantiation of function template specialization 'std::__copy_backward_impl<std::_ClassicAlgPolicy>::operator()<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>, 0>' requested here
   95 |   auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
      |                   ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_backward.h:119:15: note: in instantiation of function template specialization 'std::__copy_move_unwrap_iters<std::__copy_backward_impl<std::_ClassicAlgPolicy>, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>, 0>' requested here
  119 |   return std::__copy_move_unwrap_iters<__copy_backward_impl<_AlgPolicy> >(
      |               ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__algorithm/copy_backward.h:130:15: note: in instantiation of function template specialization 'std::__copy_backward<std::_ClassicAlgPolicy, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>>' requested here
  130 |   return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
      |               ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/deque:1938:12: note: in instantiation of function template specialization 'std::copy_backward<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, std::__deque_iterator<llvm::BasicBlock *, llvm::BasicBlock **, llvm::BasicBlock *&, llvm::BasicBlock ***, long>>' requested here
 1938 |       std::copy_backward(__f, __m, __old_end);
      |            ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/deque:1874:10: note: in instantiation of function template specialization 'std::deque<llvm::BasicBlock *>::__insert_bidirectional<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>>' requested here
 1874 |   return __insert_bidirectional(__p, __f, __l, std::distance(__f, __l));
      |          ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/STLExtras.h:2121:5: note: in instantiation of function template specialization 'std::deque<llvm::BasicBlock *>::insert<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>, 0>' requested here
 2121 |   C.insert(C.end(), adl_begin(R), adl_end(R));
      |     ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/lib/Target/X86/X86WinEHState.cpp:724:11: note: in instantiation of function template specialization 'llvm::append_range<std::deque<llvm::BasicBlock *>, llvm::iterator_range<llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>>>' requested here
  724 |     llvm::append_range(Worklist, successors(BB));
      |           ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2193:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'APInt' for 1st argument
 2193 | inline APInt operator-(APInt a, uint64_t RHS) {
      |              ^         ~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2182:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'APInt' for 1st argument
 2182 | inline APInt operator-(APInt a, const APInt &b) {
      |              ^         ~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2187:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'const APInt' for 1st argument
 2187 | inline APInt operator-(const APInt &a, APInt &&b) {
      |              ^         ~~~~~~~~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2198:14: note: candidate function not viable: no known conversion from 'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>' to 'uint64_t' (aka 'unsigned long long') for 1st argument
 2198 | inline APInt operator-(uint64_t LHS, APInt b) {
      |              ^         ~~~~~~~~~~~~
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__iterator/move_iterator.h:303:1: note: candidate template ignored: could not match 'move_iterator' against 'llvm::SuccIterator'
  303 | operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) {
      | ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__iterator/reverse_iterator.h:287:1: note: candidate template ignored: could not match 'reverse_iterator' against 'llvm::SuccIterator'
  287 | operator-(const reverse_iterator<_Iter1>& __x,
      | ^
/opt/homebrew/Cellar/llvm/19.1.7/bin/../include/c++/v1/__iterator/wrap_iter.h:209:5: note: candidate template ignored: could not match '__wrap_iter' against 'llvm::SuccIterator'
  209 |     operator-(const __wrap_iter<_Iter1>& __x,
      |     ^
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/IR/CFG.h:213:7: note: candidate function not viable: no known conversion from 'long' to 'const Self' (aka 'const SuccIterator<llvm::Instruction, llvm::BasicBlock>') for 1st argument
  213 |   int operator-(const Self &RHS) const {
      |       ^         ~~~~~~~~~~~~~~~
/Users/sudeep/Documents/llvm_practice/llvm-project/llvm/include/llvm/ADT/APInt.h:2157:14: note: candidate function not viable: requires single argument 'v', but 2 arguments were provided
 2157 | inline APInt operator-(APInt v) {
      |              ^         ~~~~~~~
1 error generated.
[4006/5326] Building CXX object lib/Target/X8...VMX86CodeGen.dir/GISel/X86LegalizerInfo.cpp.o
ninja: build stopped: subcommand failed.
Share Improve this question asked Mar 30 at 15:02 Sudeep ChowdharySudeep Chowdhary 1 2
  • What CMake version are you using? Does this happen with an older version of CMake? – jpr42 Commented Mar 30 at 16:59
  • Any reason you can't use Homebrew to install llvm? – trojanfoe Commented Mar 31 at 8:30
Add a comment  | 

1 Answer 1

Reset to default 0

I would try with something different.
Here's the commands that I used when I was working with LLVM

  • cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD="<Insert Here your Backend>"

  • make -j $(nproc)

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论