Sample from the cmake output:
Change Dir: '/home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-siaNVZ'
Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /bin/gmake -f Makefile cmTC_a67a8/fast
/bin/gmake -f CMakeFiles/cmTC_a67a8.dir/build.make CMakeFiles/cmTC_a67a8.dir/build
gmake[1]: Entering directory '/home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-siaNVZ'
Building C object CMakeFiles/cmTC_a67a8.dir/testCCompiler.c.o
/usr/local/bin/clang -fno-omit-frame-pointer -fsanitize=address,undefined -MD -MT CMakeFiles/cmTC_a67a8.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_a67a8.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_a67a8.dir/testCCompiler.c.o -c /home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-siaNVZ/testCCompiler.c
Linking C executable cmTC_a67a8
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a67a8.dir/link.txt --verbose=1
/usr/local/bin/clang -fno-omit-frame-pointer -fsanitize=address,undefined CMakeFiles/cmTC_a67a8.dir/testCCompiler.c.o -o cmTC_a67a8
/bin/ld: /home/chriselrod/.local/stow/llvm/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a(sanitizer_unwind_linux_libcdep.cpp.o): in function `__sanitizer::BufferedStackTrace::UnwindSlow(unsigned long, unsigned int)':
/home/chriselrod/Documents/libraries/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130:(.text._ZN11__sanitizer18BufferedStackTrace10UnwindSlowEmj+0x40): undefined reference to `_Unwind_Backtrace'
The problem is that
a) Running /usr/local/bin/clang -fsanitize=address;undefined
from the command line works. It also works from CMake when not using sanitizers.
b) CMake wipes the CMakeScratch directory after the failure so that I can’t investigate what went wrong.
> ls /home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/
>
The fact that the undefined references all come from libunwind make it seem like something is going wrong there from CMake, or perhaps my example when compiling from the command line is too minimal.
I have little idea of what is going on, and finding out would be easier if I had an example.