Locally built LLVM works from command line, but not cmake

I built with

cmake -G "Ninja" \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DLLVM_USE_LINKER=lld \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb" \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DCLANG_ENABLE_BOOTSTRAP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_INSTALL_UTILS=ON \
-DCMAKE_INSTALL_PREFIX=~/.local/stow/llvm \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DCLANG_DEFAULT_RTLIB=compiler-rt \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
-DLIBCXX_USE_COMPILER_RT=YES \
-DLIBCXXABI_USE_COMPILER_RT=YES \
-DLIBCXXABI_USE_LLVM_UNWINDER=YES \
-DLIBUNWIND_USE_COMPILER_RT=Yes \
-DBOOTSTRAP_CMAKE_BUILD_TYPE=Release \
-DBOOTSTRAP_LLVM_ENABLE_PROJECTS="clang;lld;lldb" \
-DBOOTSTRAP_LLVM_ENABLE_RUNTIMES="compiler-rt;libc;libcxx;libcxxabi;libunwind" \
-DBOOTSTRAP_CLANG_DEFAULT_CXX_STDLIB=libc++ \
-DBOOTSTRAP_CLANG_DEFAULT_RTLIB=compiler-rt \
-DBOOTSTRAP_LIBCXX_USE_COMPILER_RT=YES \
-DBOOTSTRAP_LIBCXXABI_USE_COMPILER_RT=YES \
-DBOOTSTRAP_LIBCXXABI_USE_LLVM_UNWINDER=YES \
-DBOOTSTRAP_LIBUNWIND_USE_COMPILER_RT=Yes \
-DBOOTSTRAP_LLVM_USE_LINKER=lld \
../llvm

(This also requires a tiny +1 patch to actually build the sanitizers.)

Running a test program

> /usr/local/bin/clang++ -fsanitize=address vecpush.cpp
> ./a.out
8 4 -1 9 6 9 
=================================================================
==10760==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x5030000000f0 at pc 0x557176289825 bp 0x7ffd86bac580 sp 0x7ffd86bac578
READ of size 4 at 0x5030000000f0 thread T0
    #0 0x557176289824 in get(std::__1::vector<int, std::__1::allocator<int>> const&, int) 

works as intended; compiles, and the program runs (and gives a nice stack trace at the deliberate bug).

However, when trying to compile a project using googletest, I get undefined references to some unwind functions when I use the sanitizer. Tests compile and pass when not using sanitizers.
E.g.

    ld.lld: error: undefined symbol: _Unwind_Backtrace
    >>> referenced by sanitizer_unwind_linux_libcdep.cpp:130 (/home/chriselrod/Documents/libraries/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130)
    >>>               sanitizer_unwind_linux_libcdep.cpp.o:(__sanitizer::BufferedStackTrace::UnwindSlow(unsigned long, unsigned int)) in archive /home/chriselrod/.local/stow/llvm/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a
    >>> referenced by sanitizer_unwind_linux_libcdep.cpp:130 (/home/chriselrod/Documents/libraries/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130)
    >>>               sanitizer_unwind_linux_libcdep.cpp.o:(__sanitizer::BufferedStackTrace::UnwindSlow(unsigned long, void*, unsigned int)) in archive /home/chriselrod/.local/stow/llvm/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a
Full
-- CPM: Adding package cmake-scripts@0 (1f822d1fc87c8d7720c074cde8a278b44963c354 at /home/chriselrod/.cache/CPM/cmake-scripts/934197b21713bb6a5e0c216cd5f2f228ca06e567)
-- Building with Address, Undefined sanitizers
-- The C compiler identification is Clang 17.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/local/bin/clang
-- Check for working C compiler: /usr/local/bin/clang - broken
CMake Error at /usr/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/usr/local/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-ofBllM'
    
    Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /bin/gmake -f Makefile cmTC_3a17c/fast
    /bin/gmake  -f CMakeFiles/cmTC_3a17c.dir/build.make CMakeFiles/cmTC_3a17c.dir/build
    gmake[1]: Entering directory '/home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-ofBllM'
    Building C object CMakeFiles/cmTC_3a17c.dir/testCCompiler.c.o
    /usr/local/bin/clang   -fuse-ld=lld -Wno-unused-command-line-argument -fno-omit-frame-pointer -fsanitize=address,undefined  -MD -MT CMakeFiles/cmTC_3a17c.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_3a17c.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_3a17c.dir/testCCompiler.c.o -c /home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-ofBllM/testCCompiler.c
    Linking C executable cmTC_3a17c
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3a17c.dir/link.txt --verbose=1
    /usr/local/bin/clang -fuse-ld=lld -Wno-unused-command-line-argument -fno-omit-frame-pointer -fsanitize=address,undefined  CMakeFiles/cmTC_3a17c.dir/testCCompiler.c.o -o cmTC_3a17c 
    ld.lld: error: undefined symbol: _Unwind_Backtrace
    >>> referenced by sanitizer_unwind_linux_libcdep.cpp:130 (/home/chriselrod/Documents/libraries/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130)
    >>>               sanitizer_unwind_linux_libcdep.cpp.o:(__sanitizer::BufferedStackTrace::UnwindSlow(unsigned long, unsigned int)) in archive /home/chriselrod/.local/stow/llvm/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a
    >>> referenced by sanitizer_unwind_linux_libcdep.cpp:130 (/home/chriselrod/Documents/libraries/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130)
    >>>               sanitizer_unwind_linux_libcdep.cpp.o:(__sanitizer::BufferedStackTrace::UnwindSlow(unsigned long, void*, unsigned int)) in archive /home/chriselrod/.local/stow/llvm/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a
    
    ld.lld: error: undefined symbol: _Unwind_GetIP
    >>> referenced by sanitizer_unwind_linux_libcdep.cpp:69 (/home/chriselrod/Documents/libraries/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:69)
    >>>               sanitizer_unwind_linux_libcdep.cpp.o:(__sanitizer::(anonymous namespace)::Unwind_Trace(_Unwind_Context*, void*)) in archive /home/chriselrod/.local/stow/llvm/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    gmake[1]: *** [CMakeFiles/cmTC_3a17c.dir/build.make:100: cmTC_3a17c] Error 1
    gmake[1]: Leaving directory '/home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-ofBllM'
    gmake: *** [Makefile:127: cmTC_3a17c/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  /home/chriselrod/.cache/CPM/googletest/96129d89f45386492ae46d6bb8c027bc3df5f949/CMakeLists.txt:18 (project)


-- Configuring incomplete, errors occurred!

I’m wondering if there is anything obvious, or perhaps at least a direction I can be pointed?