Ubuntu 18.04 搭建caffe环境编译错误总结

由于Ubuntu系统较新,遇到错误较少。共2点:

错误1、hdf5.h No such file or directory

解决方法 :

1)在Makefile.config文件中,找到:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include

将其改为:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/

2)在Makefile文件中,找到:

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5

将其改为:

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

错误2、undefined reference to cv::imread(cv::String const&, int)

解决方法:

在Makefile文件中,找到:

LIBRARIES += opencv_core opencv_highgui opencv_imgproc

将其改为:

LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

第16天 make matcaffe 报错:

 解决方法:

NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

改为

NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

CXXFLAGS +=  -MMP -MD 

后面加上

CXXFLAGS += -std=C++11

然后执行make matcaffe -j8即可,忽略告警

之后make mattest报错如下:

解决方法:

可看出上图报错中指的是MATLAB/R2014b下边的libstdc++.so.6

执行ldd */caffe/matlab/caffe/caffe_.mexa64  可得

即caffe_.mexa64真正依赖的usr/lib下的libstdc++.so.6

在查看usr/lib下的libstdc++.so.6是否包含需要的CXXABI

发现包含,执行软连接

sudo rm /usr/local/Matlab/R2014b/sys/os/glnxa64/libstdc++.so.6

sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/Matlab/R2014b/sys/os/glnxa64/libstdc++.so.6

解决上述问题,出现如下,仍有链接 的不对的so,

解决方法同上,

查看上述报错中的libgdal.so.20对TIFFReadRGBATileExt的包含情况

是包含的。

那问题出在libtiff.so.5上

全局搜一下libtiff.so.5,共以下几处

分别查看MATLAB目录下和usr/lib目录下的对LIBTIFF_4.0的包含情况

可见usr/lib下的才包含

建立软链接

重新make mattest 

成功。

之后启动matlab报错

javax.media.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for :0
    at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:316)
    at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:295)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:597)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:518)
    at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:292)
    ... 2 more
>> 

尝试运行具有画图的脚本报错

运行一个画图程序报错
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.

解决方法:

使用software OpenGL

原因是nvida 官方说是显卡驱动367 有问题,不会支持hardware OpenGL

在maltab的命令行中输入opengl('save','software'),回车,重启maltab, 问题解决。

第16天绘制学习曲线

运行train_quick.sh将log记入cifar.log 时,cifar.log报错:

common.cpp:66] Cannot use GPU in CPU-only Caffe: check mode.

解决方法:

需要将cifar10_quick_solver.prototxt 及 cifar10_quick_solver_lr1.prototxt 中的 solver_mode: GPU 改为 solver_mode: CPU

修改后继续运行train_quick.sh 将log记入cifar.log ,cifar.log中有报错:

db_lmdb.hpp:15] Check failed: mdb_status == 0 (2 vs. 0) No such file or directory

解决方法:

确认cifar 的 lmdb文件已生成,即运行train_quick.sh之前,确认运行成功了create_cifar10.sh

发布了5 篇原创文章 · 获赞 0 · 访问量 6940

猜你喜欢

转载自blog.csdn.net/daobuxinzi/article/details/80727780