Caffe编译问题汇总

1. hdf5问题

fatal error: hdf5.h: No such file or directory compilation terminated.

解决方案:

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. Cuda版本问题(cuda-9.0)

Unsupported gpu architecture 'compute_20'

解决办法:

通常由于高版本cuda不支持导致,
将Makefile.config  文件中
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
             -gencode arch=compute_20,code=sm_21 \
             -gencode arch=compute_30,code=sm_30 \
             -gencode arch=compute_35,code=sm_35 \
             -gencode arch=compute_50,code=sm_50 \
             -gencode arch=compute_52,code=sm_52 \
             -gencode arch=compute_61,code=sm_61

前两行-gencode arch=compute_20,code=sm_20 \
     -gencode arch=compute_20,code=sm_21 \
删除即可
Check failed: error == cudaSuccess (48 vs. 0)  no kernel image is available for execution on the dev

解决办法:

通常由于CUDA_ARCH与cuda版本不符合导致,
将Makefile.config  文件中
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
             -gencode arch=compute_20,code=sm_21 \
             -gencode arch=compute_30,code=sm_30 \
             -gencode arch=compute_35,code=sm_35 \
             -gencode arch=compute_50,code=sm_50 \
             -gencode arch=compute_52,code=sm_52 \
             -gencode arch=compute_61,code=sm_61

最后添加一行
     -gencode arch=compute_61,code=compute_61
make clean后重新make即可

 

3. make py问题

fatal error: numpy/arrayobject.h: No such file or directory

解决办法:

确认Makefile.config  文件中
PYTHON_INCLUDE := /usr/include/python2.7 \
		/usr/local/lib/python2.7/dist-packages/numpy/core/include

numpy的头文件路径是对的,如果不对,修改至自己安装的位置

4. make runtest问题

*** Error in `.build_release/tools/caffe': free(): invalid pointer: 0x00000000013bc130 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f976962b7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f976963437a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f976963853c]
/usr/lib/x86_64-linux-gnu/libprotobuf.so.9(_ZN6google8protobuf8internal28DestroyDefaultRepeatedFieldsEv+0x1f)[0x7f976a1688af]
/usr/lib/x86_64-linux-gnu/libprotobuf.so.9(_ZN6google8protobuf23ShutdownProtobufLibraryEv+0x8b)[0x7f976a167b3b]
/usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3(+0x233b9)[0x7f97367c63b9]
/lib64/ld-linux-x86-64.so.2(+0x10de7)[0x7f976b90cde7]
/lib/x86_64-linux-gnu/libc.so.6(+0x39ff8)[0x7f97695edff8]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a045)[0x7f97695ee045]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf7)[0x7f97695d4837]
.build_release/tools/caffe[0x407dd9]
======= Memory map: ========
00400000-00418000 r-xp 00000000 fd:00 12984645                           /home/a/Documents/libtool/caffe/.build_release/tools/caffe.bin
00617000-00618000 r--p 00017000 fd:00 12984645                           /home/a/Documents/libtool/caffe/.build_release/tools/caffe.bin
00618000-00619000 rw-p 00018000 fd:00 12984645                           /home/a/Documents/libtool/caffe/.build_release/tools/caffe.bin
0139f000-01610000 rw-p 00000000 00:00 0                                  [heap]
7f971d3e2000-7f971d3e3000 ---p 00000000 00:00 0 
7f971d3e3000-7f971dbe3000 rw-p 00000000 00:00 0 
7f971fbe3000-7f971fbe4000 ---p 00000000 00:00 0 
7f971fbe4000-7f97203e4000 rw-p 00000000 00:00 0 
7f97203e4000-7f97203e5000 ---p 00000000 00:00 0 
7f97203e5000-7f9720be5000 rw-p 00000000 00:00 0 
7f9724be5000-7f9724be6000 ---p 00000000 00:00 0 
7f9724be6000-7f97253e6000 rw-p 00000000 00:00 0 
7f972c000000-7f972c021000 rw-p 00000000 00:00 0 
7f972c021000-7f9730000000 ---p 00000000 00:00 0 
7f9732bed000-7f9732bf0000 r-xp 00000000 fd:00 397972                     /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f9732bf0000-7f9732def000 ---p 00003000 fd:00 397972                     /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f9732def000-7f9732df0000 r--p 00002000 fd:00 397972                     /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f9732df0000-7f9732df1000 rw-p 00003000 fd:00 397972                     /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f9732df1000-7f9732dfb000 r-xp 00000000 fd:00 3547819                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f9732dfb000-7f9732ffa000 ---p 0000a000 fd:00 3547819                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f9732ffa000-7f9732ffb000 r--p 00009000 fd:00 3547819                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1

...

*** Aborted at 1552544426 (unix time) try "date -d @1552544426" if you are using GNU date ***
PC: @     0x7f97695e9428 gsignal
*** SIGABRT (@0x3e800003c84) received by PID 15492 (TID 0x7f976b9f9b00) from PID 15492; stack trace: ***
    @     0x7f97695e94b0 (unknown)
    @     0x7f97695e9428 gsignal
    @     0x7f97695eb02a abort
    @     0x7f976962b7ea (unknown)
    @     0x7f976963437a (unknown)
    @     0x7f976963853c cfree
    @     0x7f976a1688af google::protobuf::internal::DestroyDefaultRepeatedFields()
    @     0x7f976a167b3b google::protobuf::ShutdownProtobufLibrary()
    @     0x7f97367c63b9 (unknown)
    @     0x7f976b90cde7 (unknown)
    @     0x7f97695edff8 (unknown)
    @     0x7f97695ee045 exit
    @     0x7f97695d4837 __libc_start_main
    @           0x407dd9 _start
    @                0x0 (unknown)
Makefile:526: recipe for target 'runtest' failed
make: *** [runtest] Aborted (core dumped)

解决办法:

可能是缺少libtcmalloc-minimal4导致

安装libtcmalloc-minimal4库
sudo apt-get install libtcmalloc-minimal4

打开配置文件
vim ~/.bashrc

将下面一行添加到最后
export LD_PRELOAD="/usr/lib/libtcmalloc_minimal.so.4"

使之生效
source ~/.bashrc

 

参考:

https://blog.csdn.net/qq_38451119/article/details/81383266

https://blog.csdn.net/hunzhangzui9837/article/details/87986297

https://blog.csdn.net/hunzhangzui9837/article/details/87986297

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值