mardi 28 juin 2016

CUDA separate compilation + building and using a static library = binary linking trouble


I'm using CUDA 7.5 with GCC 4.9.3, and building a binary using CMake. First there's a library I add with cuda_add_library; then there's the cuda_add_executable - which uses some direct g++ compilation and some nvcc compilation. The compilation itself passes fine, but during the final linking of the binary, which uses g++ rather than nvcc, I get the error message: libktkernels.a(ktkernels_intermediate_link.o): In function `__cudaRegisterLinkedBinary_66_tmpxft_00007a5f_00000000_16_cuda_device_runtime_compute_52_cpp1_ii_8b1a5d37': /tmp/tmpxft_00003cf9_00000000-2_ktkernels_intermediate_link.reg.c:25: multiple definition of `__cudaRegisterLinkedBinary_66_tmpxft_00007a5f_00000000_16_cuda_device_runtime_compute_52_cpp1_ii_8b1a5d37' CMakeFiles/tester.dir/tester_intermediate_link.o:/tmp/tmpxft_00003d0f_00000000-2_tester_intermediate_link.reg.c:24: first defined here collect2: error: ld returned 1 exit status In case you're not a CMake person, I'll mention that the local library, libktkernels.a is generated from the object code like so: /usr/bin/ar cq libktkernels.a lots.cu.o of.cu.o files.cu.o here.cu.o Now, it's true that I have some cude which is compiled both into the library and into the binary directly. But is that what triggers this error message, or can it be something else? What is that symbol that's defined multiple times? Can I demangle it somehow to realize what it's associated with? It's not quite clear to me whether the problem

Aucun commentaire:

Enregistrer un commentaire