0

I am setting up cuda 5.0 on centOS 6.2, I have already set up successfully, because I do command queryDevice and I got passed. When I enter /root/NVIDIA_CUDA-5.0_Samples, and I make the project,I got the errors below:

make[1]: Entering directory `/root/NVIDIA_CUDA-5.0_Samples/7_CUDALibraries/conjugateGradientPrecond'
g++ -m64  -I/usr/local/cuda-5.0/include -I. -I.. -I../../common/inc -o main.o -c main.cpp
g++ -m64 -o conjugateGradientPrecond main.o -L/usr/local/cuda-5.0/lib64 -lcudart -lcublas -lcusparse 
/usr/local/cuda-5.0/lib64/libcusparse.so: undefined reference to `std::bad_alloc::what() const@GLIBCXX_3.4.9'
collect2: ld returned 1 exit status
make[1]: *** [conjugateGradientPrecond] Error 1

My compiler is gcc44, which is got from below steps:

1.sudo rm gcc
2.sudo ln -s /usr/bin/gcc-4.4 gcc

before I do upper operation of 1 and 2, my compiler is gcc 4.1.7,I got the errors like the title, so I do operation of 1 and 2, but there is error either

1 Answer 1

2

CentOS 6.2 ships with version 4.4.6 of gcc. Niether 4.1.7 nor 4.4 are the correct compilers for that distro. I'm not saying they can't be made to work somehow, but you'll have better results with the compiler that ships with the distro. (You may also have a messed up compiler installation.)

Since libcusparse.so is delivered in binary form from the toolkit, it is tailored for a particular set of libraries associated with your compiler (GLIBC). If you change these due to compiler change, you're going to have trouble.

The solution is to use the compiler packages (gcc, g++) that ship with the distro.

EDIT: In response to a question below, I have a "clean" CentOS6.2 install.

When I run:

strings /usr/lib64/libstdc++.so.6 |grep GLIBC 

I get:

$ strings /usr/lib64/libstdc++.so.6 |grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.4
GLIBC_2.3.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
$

And you can see that GLIBCXX_3.4.9 is in there. So I think you have a messed up install.

2
  • I do the command as "strings /usr/lib/libstdc++.so.6 | grep GLIBC", then the OS return "GLIBCXX_3.4,GLIBCXX_3.4.1,GLIBCXX_3.4.2,GLIBCXX_3.4.3,GLIBCXX_3.4.4,GLIBCXX_3.4.5,GLIBCXX_3.4.6,GLIBCXX_3.4.7,GLIBCXX_3.4.8,GLIBC_2.3,GLIBC_2.0,GLIBC_2.3.2,GLIBC_2.4,GLIBC_2.1,GLIBC_2.1.3,GLIBC_2.2,GLIBCXX_FORCE_NEW". there is not package named GLIBCXX_3.4.9 ?
    – taoyuanjl
    Jul 11, 2013 at 6:41
  • you are right, I check the OS further, and my OS is centos 5.8. so after I install with cuda 5.0 for RHEL5.0, the error dispear.thanks a lot!
    – taoyuanjl
    Jul 11, 2013 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.