Pthread problem? Unable to understand the source / reason of failure

I install the driver for CUDA 3.2 on my Fedora 13 64-bit machine with GTX470 and had a small problem while compiling the NVIDIA SDK Sample programs as follows:

make[1]: Entering directory `/home/vaibhav/NVIDIA_GPU_Computing_SDK/C/src/simpleMultiGPU'

/usr/bin/ld: ../../lib/libcutil_x86_64.a(multithreading.cpp.o): undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'

/usr/bin/ld: note: 'pthread_cancel@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line

/lib64/libpthread.so.0: could not read symbols: Invalid operation

collect2: ld returned 1 exit status

I removed the directories which caused this problem (they were the multiGPU examples) and the compilation went fine after that. Then I tried to launch the compiled example and run the bandwidthTest program. It gave me another error as follows:

./bandwidthTest: error while loading shared libraries: libcudart.so.3: wrong ELF class: ELFCLASS32

I thought that this problem might have happned coz I removed the directories during SDK compilation. So I thought to test things myself using code from the book “CUDA by Example”. So I typed the program in the “CUDA by EXAMPLE” book to compile into a file named first.cu and am getting this error:

nvcc -o first.cu

nvcc fatal   : No input files specified; use option --help for more information

[vaibhav@localhost progs]$ nvcc -o first first.cu

/usr/bin/ld: /tmp/tmpxft_00006960_00000000-13_first.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'

/usr/bin/ld: note: 'pthread_cancel@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line

/lib64/libpthread.so.0: could not read symbols: Invalid operation

collect2: ld returned 1 exit status

I found that I need to fix something called DSO linking. can someone detail me about what it is and how to proceed?

PS: I am using this OS installation only for CUDA programming (and of course I would need the Graphical Desktop). Except that, I have other OS installations for other work.

I install the driver for CUDA 3.2 on my Fedora 13 64-bit machine with GTX470 and had a small problem while compiling the NVIDIA SDK Sample programs as follows:

make[1]: Entering directory `/home/vaibhav/NVIDIA_GPU_Computing_SDK/C/src/simpleMultiGPU'

/usr/bin/ld: ../../lib/libcutil_x86_64.a(multithreading.cpp.o): undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'

/usr/bin/ld: note: 'pthread_cancel@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line

/lib64/libpthread.so.0: could not read symbols: Invalid operation

collect2: ld returned 1 exit status

I removed the directories which caused this problem (they were the multiGPU examples) and the compilation went fine after that. Then I tried to launch the compiled example and run the bandwidthTest program. It gave me another error as follows:

./bandwidthTest: error while loading shared libraries: libcudart.so.3: wrong ELF class: ELFCLASS32

I thought that this problem might have happned coz I removed the directories during SDK compilation. So I thought to test things myself using code from the book “CUDA by Example”. So I typed the program in the “CUDA by EXAMPLE” book to compile into a file named first.cu and am getting this error:

nvcc -o first.cu

nvcc fatal   : No input files specified; use option --help for more information

[vaibhav@localhost progs]$ nvcc -o first first.cu

/usr/bin/ld: /tmp/tmpxft_00006960_00000000-13_first.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'

/usr/bin/ld: note: 'pthread_cancel@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line

/lib64/libpthread.so.0: could not read symbols: Invalid operation

collect2: ld returned 1 exit status

I found that I need to fix something called DSO linking. can someone detail me about what it is and how to proceed?

PS: I am using this OS installation only for CUDA programming (and of course I would need the Graphical Desktop). Except that, I have other OS installations for other work.

No one knows anything about this ? :(

No one knows anything about this ? :(

libcudart.so.3 is a 32-bit library, but you’re running a 64-bit system. Install a 64-bit version of cuda-toolkit, that should work.

I think this will probably solve your 2 other issues. In both cases, the linker tries to link against libpthread.so, a 64-bit library, but fails (“could not read symbols” in the correct .so file). This can be because you are trying to run a 32-bit nvcc on a 64-bit system.

libcudart.so.3 is a 32-bit library, but you’re running a 64-bit system. Install a 64-bit version of cuda-toolkit, that should work.

I think this will probably solve your 2 other issues. In both cases, the linker tries to link against libpthread.so, a 64-bit library, but fails (“could not read symbols” in the correct .so file). This can be because you are trying to run a 32-bit nvcc on a 64-bit system.

Thanks Schnouki, But I got the problem solved somehow before I read the reply. The problem was that I had pointed the $LD_LIBRARY _PATH variable to /usr/local/cuda/lib instead of /usr/local/cuda/lib64. Changing bash_profile did the necessary work.

Thanks anyway for the reply mate.

Thanks Schnouki, But I got the problem solved somehow before I read the reply. The problem was that I had pointed the $LD_LIBRARY _PATH variable to /usr/local/cuda/lib instead of /usr/local/cuda/lib64. Changing bash_profile did the necessary work.

Thanks anyway for the reply mate.