Error during compilation (make runtest): "error while loading shared libraries: libcudart.so.6.5"

19,549 views
Skip to first unread message

Daniel Orf

unread,
Oct 25, 2014, 9:37:52 PM10/25/14
to caffe...@googlegroups.com
I solved the problem while writing this up, but I thought I'd submit my issue anyway:

Hardware:  i5 CPU, GTX970 GPU
Software:  Ubuntu 14.04 x64, Cuda v6.5; Anaconda Python only, ATLAS

I am able to run 'make all' and 'make test' with no issue.  When I run 'make runtest' I immediately get the following error:

.build_release/test/test_all.testbin 0 --gtest_shuffle 
.build_release/test/test_all.testbin: error while loading shared libraries: libcudart.so.6.5: cannot open shared object file: No such file or directory
make: *** [runtest] Error 127


Solution:  Run 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64' before running 'make all/test/runtest'.

Robert Griesmeyer

unread,
May 5, 2015, 7:26:58 PM5/5/15
to caffe...@googlegroups.com
Thanks for posting!

Thomas

unread,
May 14, 2015, 12:49:32 PM5/14/15
to caffe...@googlegroups.com
I have a similar error.

Software:  Ubuntu 14.04 x64, Cuda v7.0; ATLAS, ...

My LD_LIBRARY_PATH points to /usr/local/cuda-7.0/lib64

make runtest produces the same error: "error while loading shared libraries: libcudart.so.6.5"

Thomas

unread,
May 14, 2015, 2:29:18 PM5/14/15
to caffe...@googlegroups.com
I had an old version of opencv. By removing it I got rid of my problem.

Jumabek Alikhanov

unread,
Jun 13, 2015, 2:03:04 AM6/13/15
to caffe...@googlegroups.com
Thanks that worked for me too. However I have to 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64' run this command before  before caffe tries to use GPU every time. Do know any solution to these? 

chaabouni souad

unread,
Nov 25, 2014, 4:51:58 AM11/25/14
to caffe...@googlegroups.com
Thanks , it's work  :)))))))

gokul krishnan

unread,
Jul 11, 2015, 10:12:00 PM7/11/15
to caffe...@googlegroups.com
Add it to your .bashrc file

Prathamesh Kulkarni

unread,
Aug 4, 2015, 4:10:50 PM8/4/15
to Caffe Users
I also have the same error: libcudart.so.7.5: cannot open shared object file: No such file or directory

I have added the paths to the baschrc file. 

Any help will be appreciated.

Rohan Jain

unread,
Aug 7, 2015, 3:26:05 PM8/7/15
to Caffe Users
I got this additional error when I had only added '/usr/local/cuda/lib' to my $LD_LIBRARY_PATH.
error while loading shared libraries: libcudart.so.7.0: wrong ELF class: ELFCLASS32
The solution was to include '/usr/local/cuda/lib64' as well.


On Saturday, October 25, 2014 at 6:37:52 PM UTC-7, Daniel Orf wrote:

Joaquim Silvestre

unread,
Sep 15, 2015, 7:26:05 AM9/15/15
to Caffe Users
Software:  Ubuntu 14.04 x64, Cuda v7.5;

Hello I have the same problem but the solution doesn't work for me.
When I type
echo $LD_LIBRARY_PATH
I get :
/home/at0mb0y/torch/install/lib:/home/at0mb0y/torch/install/lib::/home/at0mb0y/usr/local/cuda-7.5/targets/x86_64-linux/lib:/usr/local/cuda-7.5/targets/x86_64-linux/lib:/usr/local/cuda7.5/lib64
so it seems ok but when i run
sudo make runtest
same error
1) is it important to do :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 before everything ?
it makes 10 times i build everything by trying small changes founded on forums and it's boring to do " make clean/all/test/" each time i try a new way..


I've try to put this path :  " /usr/local/cuda-7.5/targets/x86_64-linux/lib/"
sudo gedit /etc/ld.so.conf.d/randomLibs.conf
and when i do
sudo ldconfig
I have
/sbin/ldconfig.real: /usr/local/cuda-7.5/targets/x86_64-linux/lib/libcudnn.so.7.0 is not a symbolic link
when i put : "/usr/local/cuda7.5/lib64"
no problem with "sudo ldconfig"
but nothing work...
Any Idea ? I have checked libcudart.so.7.5 is in the directory but the runtest can't find it

best regards
joaquim silvestre

Joaquim Silvestre

unread,
Sep 16, 2015, 10:02:19 PM9/16/15
to Caffe Users
ok I understood my error.
it's because i use sudo for make all/test/runtest !!

Srujana Gattupalli

unread,
Oct 14, 2015, 2:29:34 PM10/14/15
to Caffe Users
Hi.. why shouldn't you use sudo? And what to do if you do not have privileges then?

Yi Zili

unread,
Oct 14, 2015, 2:32:34 PM10/14/15
to Caffe Users
I was operating on Ubuntu 15.04.
I was  faced with the same problem. I fixed it as this article instructed. Thanks great.

在 2014年10月25日星期六 UTC-2:30下午11:07:52,Daniel Orf写道:

Licheng Yu

unread,
Nov 1, 2015, 10:44:39 PM11/1/15
to Caffe Users
The same!
Weird, it works without sudo...

Alper Alimoglu

unread,
Nov 12, 2015, 3:15:14 AM11/12/15
to Caffe Users
Thanks it worked!

Dhawal Arora

unread,
Dec 29, 2015, 4:05:41 AM12/29/15
to Caffe Users
Sounds strange but it worked for me without sudo.

Ankit Shah

unread,
Jan 31, 2016, 2:27:29 AM1/31/16
to Caffe Users
Thanks it works perfectly.

Du Guowei

unread,
Mar 1, 2016, 6:34:58 AM3/1/16
to Caffe Users
Thanks a lot. it worked!

Jan C Peters

unread,
Mar 1, 2016, 7:30:21 AM3/1/16
to Caffe Users
As long as you are compiling caffe in a directory you have write-access to, you do not need to use sudo. You should have read privileges to /usr/local/cuda, and that is enough. The only thing you have to do is telling the linker where to find the cuda libs at runtime, because they are not in the standard lib paths. So a simple

$ LD_LIBRARY_PATH=/usr/local/cuda/lib64 make runtest

should do the trick (if you have an installed and activated nvidia driver and GPU in your system, of course). If you need to use sudo for compilation or running of caffe, you are doing something wrong. The only part where you might need sudo is for the installation of caffe's dependencies, if you install them to the standard paths and/or through your distro's packaging system.

Jan

P.S. Understanding why these errors happen and how to solve them brings you a lot farther in understanding development in and the inner workings of the linux operating system, which in turn will prevent you from making such errors in the future or at least solving them with ease. Nobody is a pro from the start, but you should always strive to improve your knowledge and skills. Just saying. (because we get a lot of questions like this on this forum, which are actually only basic linux development questions, not really caffe-specific.)

Xiduo Xu

unread,
Mar 8, 2016, 5:44:50 AM3/8/16
to Caffe Users
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
make runtest
unset LD_LIBRARY_PATH

or

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 && make runtest && unset LD_LIBRARY_PATH

在 2014年10月26日星期日 UTC+8上午9:37:52,Daniel Orf写道:
Message has been deleted

Yashrahmed Dekh

unread,
Mar 24, 2016, 4:16:27 AM3/24/16
to Caffe Users, dani...@gmail.com
For all the other folks who stop by looking for a solution : 

try:

32-bit: sudo ldconfig /usr/local/cuda/lib

64-bit: sudo ldconfig /usr/local/cuda/lib64


source : http://stackoverflow.com/questions/10808958/why-cant-libcudart-so-4-be-found-when-compiling-the-cuda-samples-under-ubuntu

Amit Kumar

unread,
Apr 26, 2016, 6:23:49 AM4/26/16
to Caffe Users
Thanks Joaquim. I had the same problem, 'sudo'.

James Lee

unread,
Jun 3, 2016, 3:28:31 AM6/3/16
to Caffe Users, dani...@gmail.com
Thank you very much!!! It's working!!!


在 2014年10月26日星期日 UTC+8上午9:37:52,Daniel Orf写道:
I solved the problem while writing this up, but I thought I'd submit my issue anyway:

McCaffe

unread,
Sep 5, 2016, 12:54:23 PM9/5/16
to Caffe Users, dani...@gmail.com
I had the same problem and solved it as follows. I had a customly compiled opencv 2.4.11 which was linked via `pkg-config --libs opencv`. Now I had changed my cuda version in the meantime from cuda 7.5 to cuda 8.0. That means while loading caffe some opencv-libraries were loaded as well but could not find the old version of Cuda.

As a solution I had to remove the link to my manually installed opencv:

sudo rm /usr/local/pkgconfig/opencv.pc
sudo ldconfig

After restarting the terminal pkg-config --libs was pointing to the global path in `/usr/local/lib` which has opencv 2.4.8 but without any link to any Cuda version

fet...@gmail.com

unread,
Dec 2, 2016, 9:00:18 AM12/2/16
to Caffe Users
I come across another error after tpye make run test:
[----------] Global test environment tear-down
[==========] 2122 tests from 287 test cases ran. (563394 ms total)
[  PASSED  ] 2119 tests.
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] DetectNetTransformationLayerTest/1.TestDesaturation, where TypeParam = caffe::CPUDevice<double>
[  FAILED  ] DetectNetTransformationLayerTest/1.TestAllAugmentation, where TypeParam = caffe::CPUDevice<double>
[  FAILED  ] DetectNetTransformationLayerTest/1.TestHueRotation, where TypeParam = caffe::CPUDevice<double>

is there any solutions, many thanks

在 2016年3月1日星期二 UTC+1下午1:30:21,Jan写道:
Reply all
Reply to author
Forward
0 new messages