[Rtk-users] CUDA linking problem

Jan Hoskovec jean.hoskovec at gmail.com
Wed Dec 18 08:39:32 EST 2013


Hello,

I have recently encountered a linking error while recompiling RTK on a
Linux 64bit machine with CUDA 5.5 and GCC 4.7. The output was as
follows:

 /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
CMakeFiles/cuda_compile.dir/./cuda_compile_generated_rtkCudaCropImageFilter.cu.o:
relocation R_X86_64_32 against `.rodata' can not be used when making a
shared object; recompile with -fPIC
CMakeFiles/cuda_compile.dir/./cuda_compile_generated_rtkCudaCropImageFilter.cu.o:
could not read symbols: Bad value

The error message speaks about the -fPIC option, but this was only
half the solution.

After searchnig devtalk.nvidia.com, I found a solution which worked
smoothly for me: During configuration, add

-Xcompiler -fPIC

to your NVCC flags. After that, the compilation worked just fine again.

I hope this can be helpful for someone having run into the same
problem as I did.

Best regards,

Jan



More information about the Rtk-users mailing list