Undefined symbol when trying to link cufft_static

Hi guys,

I already tried a couple of stuff. I link with culibos also, just like it’s specified in the cuFFT documentation. But whatever I tried, I end up always with this:

undefined symbol: __cudaRegisterLinkedBinary_72_tmpxft_00002256_00000000_15_fft_dimension_class_multi_compute_60_cpp1_ii_466e44ab

And that symbol can be found in libcufft_static.a.

Here’s the list of gencodes that I use:

-gencode arch=compute_35,"code=sm_35" -gencode arch=compute_50,"code=sm_50" -gencode arch=compute_52,"code=sm_52" -gencode arch=compute_60,"code=sm_60" -gencode arch=compute_60,"code=compute_60" -gencode arch=compute_61,"code=sm_61" -gencode arch=compute_61,"code=compute_61"

if that can help find the source of the problem!

Any ideas?

Thanks
J

NOTE it’s been linked inside a shared object, not an executable. And it fails when that object is being loaded by an executable.

what are the commands you use to compile and link the shared object?

what are the commands you use to compile and link the executable?

If you are linking your executable without using nvcc, then you will need to link against -lcudart

So, this is what I used in the CMakeLists.txt:

CUDA_ADD_LIBRARY(
  ${PROJECT_NAME} SHARED
  ${c_sources}
  ${cuda_sources}
  ${includes}
)
target_link_libraries(${PROJECT_NAME} "cuda" "cufft_static" "cudart_static" "culibos")

I tried also listing the _static files in the CUDA_ADD_LIBRARY as source also.

So I tried to extract the best I could the verbose data from make:

This is when compiling one of the file:

/usr/local/cuda/bin/nvcc -M -D__CUDACC__ /SRC/core/Example.cu -o /SRC/build/core/Debug/CMakeFiles/OUTPUT.dir/src/core/OUTPUT_generated_Example.cu.o.NVCC-depend -ccbin /usr/bin/g++-5 -m64 -D_DEBUG -DLINUX -DOUTPUT_EXPORTS -Xcompiler ,\"-fPIC\" -D_FORCE_INLINES -std=c++11 -Xcompiler -fPIC -Wno-deprecated-gpu-targets -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61 -O3 -Xcompiler -rdynamic -Xcompiler -O3 -Xcompiler -g -DNVCC -I/usr/local/cuda/include -I/SRC/include -I/SRC/src -I/usr/local/cuda/include

And this is the final linking:

/usr/bin/g++-5  -fPIC  -std=c++11 -ffast-math -Wall -fPIC -O3 -D_FORCE_INLINES -g -g
-shared -Wl,-soname,libOUTPUT.so -o libOUTPUT.so
file1.o file2.o file3.o Example.o
/usr/local/cuda/lib64/libcudart_static.a -lpthread -ldl -lrt -lcuda -lcufft_static -lcudart_static -lculibos

I can see that the final linking is done strictly with g++ and not nvcc. That could be the source of the problem, but I have no idea how to use that one explicitly.

NOTE had to edit those outputs to not reveal any code at all!

I’m not a CMake expert. Perhaps someone else will be able to help.

If you want to provide an example that builds things not using CMake, I should be able to help you get it working.