cproblems compiling the CUDA-Matlab example - libstdc++

Hello!

I have a problem with the Matlab example for cuda, which I downloaded from nvidia.

First of all some details about my computer:

Ubuntu 9.04 64bit

Matlab R2009b 64bit

When I try to run the makefile I get the following error:

[codebox]

/usr/local/matlab2009b/bin/mex CFLAGS=‘-fPIC -D_GNU_SOURCE -pthread -fexceptions’ COPTIMFLAGS=‘-O3 -funroll-loops -msse2’ fft2_cuda.c \

    -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lcufft -Wl,-rpath,/usr/local/cuda/lib64

/usr/bin/ld: cannot find -lstdc++

collect2: ld returned 1 exit status

mex: link of ’ “fft2_cuda.mexa64”’ failed.

make: *** [fft2_cuda.mexa64] Error 1

[/codebox]

Can anyone tell me what I’m doing wrong?

CUDA itself works perfectly and I already compiled a cuda mex file which I created myself with success using the nvmex directly (without makefile) .

I really would appreciate any help!

Markus

Have you installed your distributions libstdc++ package?

That’s what it’s called on Fedora, Ubuntu should have a similar one that contains /usr/lib64/libstdc++.so

On 64bit Fedora 11 here, same problem. Fixed by

cd /usr/lib64/

sudo ln -s libstdc++.so.6.0.12 libstdc++.so

(look in /usr/lib64 for files starting with “libstdc++.so” and symlink them to just libstdc++.so)

I have the same problem with ubuntu 9.10 and i’ve instaled libstdc++6-4.4-dev and gcc (GCC) 4.2.4 (Ubuntu 4.2.4-5ubuntu1).

I am following this guide Matlab_CUDA_Tutorial_8_08.pdf.

/usr/local/matlab/bin/mex CFLAGS='-fPIC -D_GNU_SOURCE -pthread -fexceptions' COPTIMFLAGS='-O3 -funroll-loops -msse2' fft2_cuda.c \

		-I/usr/local/cuda/include -L/usr/local/cuda/lib -lcufft -Wl,-rpath,/usr/local/cuda/lib

/usr/bin/ld: cannot find -lstdc++

collect2: ld returned 1 exit status

	mex: link of ' "fft2_cuda.mexglx"' failed.

make: *** [fft2_cuda.mexglx] Error 1