NVIDIA / CUDALibrarySamples

CUDA Library Samples
Other
1.5k stars 311 forks source link

"undefined reference" in building cuDSS examples #179

Open alephchang opened 5 months ago

alephchang commented 5 months ago

Hi, I follow cuDSS/examples/README.md to build the example(linux). When I run "cmake --build build --verbose", it reports unrefined reference error:

[ 4%] Linking CXX executable cudss_memory_handlers_static cmake -E cmake_link_script CMakeFiles/cudss_memory_handlers_static.dir/link.txt --verbose=1 /usr/bin/c++ -O3 -DNDEBUG CMakeFiles/cudss_memory_handlers_static.dir/cudss_memory_handlers.cpp.o -o cudss_memory_handlers_static -L/depot/cuda/cuda-12.2/targets/x86_64-linux/lib/stubs -L/depot/cuda/cuda-12.2/targets/x86_64-linux/lib libcudss-0.2.0.12_cuda12/lib/libcudss_static.a -lcudadevrt -lcudart_static -lrt -lpthread -ldl libcudss-0.2.0.12_cuda12/lib/libcudss_static.a(handle.cu.o): In function _cLt__ZN3fmt2v619basic_memory_bufferIcLm500ESaIcEED0Ev': (.text._ZN3fmt2v619basic_memory_bufferIcLm500ESaIcEED0Ev[_cLt__ZN3fmt2v619basic_memory_bufferIcLm500ESaIcEED5Ev]+0x2e): **undefined reference tooperator delete(void, unsigned long)' libcudss-0.2.0.12_cuda12/lib/libcudss_static.a(handle.cu.o): In function `_cLtZN3fmt2v619basic_memory_bufferIjLm32ESaIjEED0Ev': (.text._ZN3fmt2v619basic_memory_bufferIjLm32ESaIjEED0Ev[_cLtZN3fmt2v619basic_memory_bufferIjLm32ESaIjEED5Ev]+0x2e): undefined reference to `operator delete(void, unsigned long)**'

Thanks, aleph

kvoronin commented 5 months ago

Hi! What OS and compiler did you use? I suspect, that you need to pass -lstdc++ additionally but I am curious to learn your setup. Current CMakeLists.txt expects a compiler which can link -lstdc++ implicitly.

Thanks, Kirill

alephchang commented 5 months ago

Hi Kirill, The default compiler is too old: c++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) I change a new one and add -lstdc++. The undefined reference fixed. Thanks, Yijiang