远程服务器 ubuntu16.04 caffe+matlab r2014b+python+cpu-only配置(三)
2018-02-18 17:14
711 查看
Caffe配置过程中的一些问题
参考链接:https://groups.google.com/forum/#!topic/caffe-users/x8Y26vf-or8
http://blog.csdn.net/striker_v/article/details/52890747
http://www.echojb.com/cuda/2017/05/05/375103.html
http://www.caffecn.cn/?/question/1113
GCC版本太新
在make过程中可能 string.h ‘memcy’ was not declared in this scope的错误,这是因为ubuntu中gcc编译器版本太新,解决方法是打开Makefile文件,找到下面这行代码(大概在409行左右):NVCCFLAGS += -ccbin=(CXX)−Xcompiler−fPIC(COMMON_FLAGS)
将其改为:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=(CXX)−Xcompiler−fPIC(COMMON_FLAGS)
make matcaffe时报错
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp: In function ‘void delete_solver(int, mxArray**, int, const mxArray**)’: /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:3: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default] /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: error: no matching function for call to ‘remove_if(std::vector<boost::shared_ptr<caffe::Solver<float> > >::iterator, std::vector<boost::shared_ptr<caffe::Solver<float> > >::iterator, delete_solver(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Solver<float> >&)>)’ /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: note: candidate is: In file included from /usr/include/c++/4.7/algorithm:63:0, from ./include/caffe/blob.hpp:4, from ./include/caffe/caffe.hpp:7, from /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:18: /usr/include/c++/4.7/bits/stl_algo.h:1166:5: note: template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate) /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: error: template argument for ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’ uses local type ‘delete_solver(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Solver<float> >&)>’ /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: error: trying to instantiate ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’ /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp: In function ‘void delete_net(int, mxArray**, int, const mxArray**)’: /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:3: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default] /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: error: no matching function for call to ‘remove_if(std::vector<boost::shared_ptr<caffe::Net<float> > >::iterator, std::vector<boost::shared_ptr<caffe::Net<float> > >::iterator, delete_net(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Net<float> >&)>)’ /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: note: candidate is: In file included from /usr/include/c++/4.7/algorithm:63:0, from ./include/caffe/blob.hpp:4, from ./include/caffe/caffe.hpp:7, from /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:18: /usr/include/c++/4.7/bits/stl_algo.h:1166:5: note: template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate) /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: error: template argument for ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’ uses local type ‘delete_net(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Net<float> >&)>’ /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: error: trying to instantiate ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’ Makefile:518: recipe for target 'matlab/+caffe/private/caffe_.mexa64' failed make: *** [matlab/+caffe/private/caffe_.mexa64] Error 255
修改Makefile里面的CXXFLAGS,添加CXXFLAGS += -std=c++11.然后重新编译就可以了
注意: 是添加不是修改
make mattest时报错:
Invalid MEX-file 'caffe/matlab/+caffe/private/caffe_.mexa64': caffe/matlab/+caffe/private/caffe_.mexa64: undefined symbol: _ZN2cv8imencodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE。 Error in caffe.set_mode_cpu (line 5) caffe_('set_mode_cpu'); Error in caffe.run_tests (line 6) caffe.set_mode_cpu();
有些说法是要执行如下命令:
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 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
但是再次运行make
a088
mattest时会有新错误:
malloc: unknown:0: assertion botched free: called with unallocated block argument last command: (null) Aborting...find: ‘bash’ terminated by signal 6
虽然最后还是能运行成功,但发现在运行bash指令时无法成功执行,纠结了好久发现是这里没有彻底解决问题,解决方法是:
将 libopencv_imgproc.so.2.4, libopencv_core.so.2.4, libopencv_highgui.so.2.4三个文件拷贝到/usr/local/MATLAB/R2016b/bin/glnxa64/中
$ sudo mv /usr/local/MATLAB/R2016b/bin/glnxa64/libopencv_imgproc.so.2.4 /usr/local/MATLAB/R2016b/bin/glnxa64/libopencv_imgproc.so.2.4.old $ sudo cp /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4 /usr/local/MATLAB/R2016b/bin/glnxa64/ $ sudo mv /usr/local/MATLAB/R2016b/bin/glnxa64/libopencv_core.so.2.4 /usr/local/MATLAB/R2016b/bin/glnxa64/libopencv_core.so.2.4.old $ sudo cp /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4 /usr/local/MATLAB/R2016b/bin/glnxa64/ $ sudo mv /usr/local/MATLAB/R2016b/bin/glnxa64/libopencv_highgui.so.2.4 /usr/local/MATLAB/R2016b/bin/glnxa64/libopencv_highgui.so.2.4.old $ sudo cp /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4 /usr/local/MATLAB/R2016b/bin/glnxa64/
再执行
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
问题就解决啦,bash指令也没有问题啦
相关文章推荐
- 远程服务器 ubuntu16.04 caffe+matlab r2014b+python+cpu-only配置(二)
- 远程服务器 ubuntu16.04 caffe+matlab r2014b+python+cpu-only配置(一)
- Ubuntu 16.04远程登录服务器--ssh的安装和配置
- Ubuntu 16.04远程登录服务器--ssh的安装和配置
- Ubuntu16.04服务器安装配置MySQL并开启远程连接
- Ubuntu 16.04远程登录服务器--ssh的安装和配置
- Ubuntu配置SSH远程登录服务器
- Ubuntu 14.04远程登录服务器--ssh的安装和配置
- Ubuntu server 16.04 配置tftp服务器
- Ubuntu 16.04服务器之间配置无密码打通
- Ubuntu 12.10 配置远程桌面访问(不用配置VNC或RDP服务器)
- Ubuntu 14.04远程登录服务器---ssh的安装和配置
- Caffe学习(1):Ubuntu16.04上Caffe配置安装(Only CPU)
- 新手在Ubuntu16.04安装caffe(CPU only)并 配置Anaconda2步骤
- Ubuntu16.04系统中配置可远程连接的MySQL+PHP7.0
- 【总结】服务器上配置:Ubuntu14.04+cuda7.5+caffe+远程链接
- [eShopOnContainers 学习系列] - 03 - 在远程 Ubuntu 16.04 上配置开发环境
- Ubuntu16.04 server下配置MySQL,并开启远程连接
- Caffe + Ubuntu 15.04/16.04 + CUDA 7.5/8.0 在服务器上安装配置及卸载重新安装(已测试可执行)
- ubuntu16.04搭建FASTDFS图片服务器并配置nginx