在编译matlab caffe完成之后:
make mattest
的时候出错:
错误提示: _ZN2cv8imencodeERKNSt7_cxx1112basic_string
其中imencode是opencv_highgui里的函数
这个错误也就是说matlab自带的opencv库和caffe依赖的opencv不一致.
解决方法如下:
写一个matlibs.sh的脚本:
rm -rf /usr/local/MATLAB/R2016a/sys/os/glnxa64/libstdc++.so.6
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 /usr/local/MATLAB/R2016a/sys/os/glnxa64/libstdc++.so.6
rm -rf /usr/local/MATLAB/R2016a/bin/glnxa64/libopencv_core.so.2.4
ln -s /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4.9 /usr/local/MATLAB/R2016a/bin/glnxa64/libopencv_core.so.2.4
rm -rf /usr/local/MATLAB/R2016a/bin/glnxa64/libopencv_imgproc.so.2.4
ln -s /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4.9 /usr/local/MATLAB/R2016a/bin/glnxa64/libopencv_imgproc.so.2.4
rm -rf /usr/local/MATLAB/R2016a/bin/glnxa64/libopencv_highgui.so.2.4
ln -s /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9 /usr/local/MATLAB/R2016a/bin/glnxa64/libopencv_highgui.so.2.4
然后在控制台中执行该脚本,同时还要注意路径.
sudo sh ./matlibs.sh