Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am attempting to verify the installation of CUDA and am running into some issues. I have successfully built all of the examples that come with the GPU computing SDK. When I try to run deviceQuery however, I get an error saying that libcudart.so.4 can not be found.

However:

echo $LD_LIBRARY_PATH

returns

/usr/local/cuda/lib64

Inside of that directory is a file:

libcudart.so.4

What other sort of errors could be causing the library to not be located?

EDIT for Fran's answer:

  1. Yes, I am exporting the variable
  2. I am not sure if the program is 64-bit, however it came as part of a 64-bit SDK install, so I would like to assume it is
  3. Output of ldd:

    #ldd deviceQuery
    linux-vdso.so.1 =>  (0x00007fff94ecc000)
    libcudart.so.4 => /usr/local/cuda/lib64/libcudart.so.4 (0x00007f2d4658a000)
    libcuda.so.1 => /usr/lib64/libcuda.so.1 (0x00007f2d45b1e000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000037f1200000)
    libm.so.6 => /lib64/libm.so.6 (0x00000037e5e00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000037f0600000)
    libc.so.6 => /lib64/libc.so.6 (0x00000037e5600000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00000037e5a00000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00000037e5200000)
    librt.so.1 => /lib64/librt.so.1 (0x00000037e6200000)
    libz.so.1 => /lib64/libz.so.1 (0x00000037e6e00000)
    /lib64/ld-linux-x86-64.so.2 (0x00000037e4e00000)
    

I have found that I can run it as a normal user, but doing so causes it to fail since the user does not have access to the GPU. Running it with sudo causes the missing file error.

Running:

sudo ldd deviceQuery

confirms the missing libcudart.so.4 on the second line of the output.

share|improve this question

2 Answers 2

up vote 1 down vote accepted
  1. Did you export LD_LIBRARY_PATH from the shell in which you are running the program?

  2. Are both the program and shared library 64-bit binaries (or both 32-bit binaries)?

  3. What is the output of ldd program, where program is the program that can't find the library at runtime?

share|improve this answer
    
I have updated the question with the information you requested. –  Godric Seer May 30 '12 at 23:48
    
I found that the drivers were not being initialized on boot, so what I thought was an error for the user was in-fact correct. Creating a startup script to initialize the driver solved the issue and gives the proper result. –  Godric Seer May 31 '12 at 0:29

If you are building from source, you have the option to build it such that it uses an existing library path via --prefix= or --libdir=. Otherwise you can:

  • add /usr/local/cuda/lib64 to the LD_LIBRARY_PATH in /etc/profile
  • move it manually (to /usr/local/ for example) and make a symlink for /usr/local/cuda to /usr/local
  • use LDPRELOAD to preload the missing libs manually

Just a quick reminder on LD_LIBRARY_PATH - keep in mind that the more paths you add, the more the dynamic linker has to look through to find it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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