I'm trying to build, using CMake, a program involving C++ and CUDA-C++ code. It used to build file, several months ago, but - now am getting a linker error I'm not familiar with:
in function `main.cold': ... undefined reference to `__cxa_call_terminate'`
I'll attach the full link command and output below. Naturally, my program does not contain this sort of a function; and its double-underscore prefix suggests it's internal to the standard library or even the compiler. So - why is this symbol used in my program, on the one hand, and not available, on the other hand? And how can I get my program to link and run?
Notes:
- The distribution is Devuan Excalibur GNU/Linux.
- CUDA version is 12.8 (released March 3rd 2025; nvcc 12.8.93)
- My default system compiler is GCC 14, but the CMake toolchain uses g++-13 for C++ compilation, for reasons.
- CMake version 4.0.2
The command line:
/usr/bin/c++ -O3 -DNDEBUG \
-Wl,--dependency-file=examples/CMakeFiles/jacobiCudaGraphs.dir/link.d \
examples/CMakeFiles/jacobiCudaGraphs.dir/modified_cuda_samples/jacobiCudaGraphs/main.cpp.o \
examples/CMakeFiles/jacobiCudaGraphs.dir/modified_cuda_samples/jacobiCudaGraphs/jacobi.cu.o \
-o examples/bin/jacobiCudaGraphs \
-L/usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs \
-L/usr/local/cuda-12.8/targets/x86_64-linux/lib \
-L/usr/lib/gcc/x86_64-linux-gnu/13 -Wl,-rpath,/usr/local/cuda-12.8/lib64 \
/usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so \
/usr/local/cuda-12.8/lib64/libcudart.so \
/usr/lib/x86_64-linux-gnu/librt.a \
-ldl -lm -lrt \
/usr/local/cuda-12.8.1/targets/x86_64-linux/lib/libcufilt.a \
-lcudadevrt -lcudart_static -lrt -lpthread -ldl
yields the following errors:
/usr/bin/ld: examples/CMakeFiles/jacobiCudaGraphs.dir/modified_cuda_samples/jacobiCudaGraphs/main.cpp.o: in function `main.cold':
main.cpp:(.text.unlikely+0x119f): undefined reference to `__cxa_call_terminate'
/usr/bin/ld: main.cpp:(.text.unlikely+0x1653): undefined reference to `__cxa_call_terminate'
/usr/bin/ld: main.cpp:(.text.unlikely+0x1882): undefined reference to `__cxa_call_terminate'
/usr/bin/ld: main.cpp:(.text.unlikely+0x197d): undefined reference to `__cxa_call_terminate'
/usr/bin/ld: main.cpp:(.text.unlikely+0x1a1b): undefined reference to `__cxa_call_terminate'
/usr/bin/ld: examples/CMakeFiles/jacobiCudaGraphs.dir/modified_cuda_samples/jacobiCudaGraphs/main.cpp.o:main.cpp:(.text.unlikely+0x1b54): more undefined references to `__cxa_call_terminate' follow
collect2: error: ld returned 1 exit status