user582184
user582184

Reputation: 1

Errors during make of Cuda-5.0 SDK(Ubuntu 64), undefined reference to 'dlsym'

The toolkit and items 1-6 of the NVIDIA_CUDA SDK have been installed and compiled , but when it gets to '6_Advanced/cdpLUDecomposition' the following error message appears.

  /usr/local/cuda-5.0/bin/nvcc -m64 -Xcompiler -fopenmp -gencode arch=compute_35,code=sm_35  -o cdpLUDecomposition dlaswp.o dgetf2.o dgetrf.o cdp_lu.o cdp_lu_main.o -L/usr/local/cuda-5.0/lib64 -lcublas -lcublas_device -lcudadevrt -lgomp 
/usr/local/cuda-5.0/lib64/libcublas.so: error: undefined reference to 'dlsym'
/usr/local/cuda-5.0/lib64/libcublas.so: error: undefined reference to 'dlopen'
/usr/local/cuda-5.0/lib64/libcublas.so: error: undefined reference to 'dlclose'
collect2: ld returned 1 exit status
make[1]: *** [cdpLUDecomposition] Error 1

I am new to both Ubuntu and Cuda, but did try adding LD_FLAGS=-ldl before the make which was no help, and set the PATH and LD_LIBRARY_PATH to the Nvidia recommendations. Also I updated all drivers and was able to get a valid result from the SDK deviceQuery Program.

Any help would be appreciated as everything else I have tried did not yet work.

Upvotes: 0

Views: 912

Answers (1)

Narcolessico
Narcolessico

Reputation: 1941

Adding -ldl should be sufficient. Enter in the directory of the sample (cd 6_Advanced/cdpLUDecomposition) and check the build command with make. On my machine it is

/usr/local/cuda-5.0/bin/nvcc -m64 -Xcompiler -fopenmp -gencode arch=compute_35,code=sm_35 -o cdpLUDecomposition dlaswp.o dgetf2.o dgetrf.o cdp_lu.o cdp_lu_main.o -L/usr/local/cuda-5.0/lib64 -lcublas -lcublas_device -lcudadevrt -lgomp

You can either

  • Run the build command manually appending -ldl, or
  • Fix the Makefile in the directory by appending -ldl to the proper LDFLAGS (line 89), which is cleaner and safer for next rebuilds

ldd cdpLUDecomposition then shows it is linked to /lib/x86_64-linux-gnu/libdl.so.2.

Upvotes: 1

Related Questions