cmake编译caffe matlab接口---ubuntu16.04.7
cmake编译caffe matlab接口
sinat_21190681
于 2018-09-13 17:27:39 发布
844
收藏 1
版权
打开caffe/CMakeLists.txt
caffe_option(BUILD_matlab "Build Matlab wrapper" OFF IF UNIX OR APPLE)
1
改为
caffe_option(BUILD_matlab "Build Matlab wrapper" ON IF UNIX OR APPLE)
1
打开caffe/cmake/Modules/FindMatlabMex.cmake
find_program(Matlab_mex NAMES mex mex.bat HINTS ${Matlab_DIR} PATH_SUFFIXES bin NO_DEFAULT_PATH)
find_program(Matlab_mexext NAMES mexext mexext.bat HINTS ${Matlab_DIR} PATH_SUFFIXES bin NO_DEFAULT_PATH)
1
2
3
改为
find_program(Matlab_mex NAMES mex mex.bat HINTS /usr/local/matlab2015b PATH_SUFFIXES bin NO_DEFAULT_PATH)
find_program(Matlab_mexext NAMES mexext mexext.bat HINTS /usr/local/matlab2015b PATH_SUFFIXES bin NO_DEFAULT_PATH)
1
2
3
make报错
CMake Error at cmake/Utils.cmake:357(message):
Logic error. Need to update cmake script
Call Stack (most recent call first):
matlab/CMakeList.txt:38 (caffe_parse_linker_libs)
解决方法:
将caffe/cmake/Utils.cmake 357行
message(FATAL_ERROR "Logic error. Need to update cmake script")
1
改为
message(WARNING "Logic error. Need to update cmake script")
1
错误:/home/wangfeng/sphereface-master/tools/caffe-sphereface/matlab/+caffe/private/caffe_.cpp:18:27: fatal error: caffe/caffe.hpp: 没有那个文件或目录
/home/wangfeng/sphereface-master/tools/caffe-sphereface/include/caffe/util/device_alternate.hpp:34:23: fatal error: cublas_v2.h: 没有那个文件或目录
解决方法:
打开caffe/build/matlab/CmakeFiles/matlab.dir/build.cmake
大约61行
加入caffe/include路径
加入/usr/local/cuda/include路径
错误:Invalid MEX-file ‘…/caffe/matlab/+caffe/private/caffe_.mexa64’:libcaffe.so.1.0.0:无法打开共享对象文件:没有那个文件或目录
把caffe/build/lib添加到环境变量
错误:Invalid MEX-file ‘…/caffe/matlab/+caffe/private/caffe_.mexa64’:
/usr/local/matlab2015b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version ‘CXXABI_1.3.9’ not found (required by /home/wangfeng/anaconda2/lib/libhdf5_cpp.so.101)
原因是matlab自带的glibc库版本过低
解决方法:将高版本的libstdc++.so.6链接到matlab下的libstdc++.so.6
但是服务器下没有权限链接高版本的libstdc++.so.6
在matlab窗口中执行system('echo $LD_LIBARARY_PATH'),发现matlab环境中matlab路径在前面,而anaconda2/lib路径在后面
发现caffe/matlab/demo/classification_demo.m里面提到
% You may need to do the following before you start matlab:
% $ export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64:/usr/local/cuda-5.5/lib64
% $ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
1
2
3
解决方法:
export LD_PRELOAD=/home/wangfeng/anaconda2/lib/libstdc++.so.6
————————————————
版权声明:本文为CSDN博主「sinat_21190681」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_21190681/article/details/82691617
每一个不曾起舞的日子,都是对生命的辜负。
But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采