【Caffe】Matlab接口(make编译通过,make mattest出错)

之前一直在用pycaffe,很少接触MatCaffe,然而几个论文上的demo需要用到Matcaffe,最近在编译的时候,出现不少错误,记录一下。

环境配置:Ubuntu16.04 + TitanX + Cuda7.5 + Cudnn V4

错误如下:

# make mattest
cd matlab; /usr/local/MATLAB/R2015b/bin/matlab -nodisplay -r 'caffe.run_tests(), exit()'

< M A T L A B (R) >
Copyright 1984-2015 The MathWorks, Inc.
R2015b (8.6.0.267246) 64-bit (glnxa64)
August 20, 2015


To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.

Invalid MEX-file '/usr/local/caffe/matlab/+caffe/private/caffe_.mexa64': /usr/local/caffe/matlab/+caffe/private/caffe_.mexa64: missing symbol:

中间一堆省略,反正是.mexa64各种missing symbol


Error in caffe.set_mode_cpu (line 5)
caffe_('set_mode_cpu');

Error in caffe.run_tests (line 6)
caffe.set_mode_cpu();

经我各种搜索,应该是Matlab的链接库和编译出来的.mexa64有冲突。

exit() #结束之前的错误
在当前的终端环境下输入:

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/usr/local/cuda-7.5/lib64 
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libfreetype.so.6

然后再次make mattest即可

但每次编译都需要输入,一个好的办法就是写入到~/.bashrc文件中,然后记得source ~/.bashrc以使得立即生效

参考:http://blog.csdn.net/rt5rte54654/article/details/54742981

你可能感兴趣的:(caffe)