SSD(old)版本caffe安装在已安装新版本caffe的服务器,出现的问题及解决方案

我出现的问题和下面引用别人的方案很相似,解决方案相同,下面把该方案列出,主要体会提解决问题的思路!

原文地址:http://blog.csdn.net/jonaspku/article/details/72637523


weiliu大神的ssd框架是很好用的,但在服务器重装之后,ssd编译却出现了奇怪的bug:

CXX src/caffe/data_transformer.cpp
In file included from src/caffe/data_transformer.cpp:8:0:
./include/caffe/data_transformer.hpp:69:24: error: ‘AnnotatedDatum’ does not name a type
   void Transform(const AnnotatedDatum& anno_datum,
                        ^
./include/caffe/data_transformer.hpp:71:35: error: ‘AnnotationGroup’ was not declared in this scope
                  RepeatedPtrField<AnnotationGroup>* transformed_anno_vec);
                                   ^
./include/caffe/data_transformer.hpp:71:50: error: template argument 1 is invalid
                  RepeatedPtrField<AnnotationGroup>* transformed_anno_vec);
                                                  ^
./include/caffe/data_transformer.hpp:72:24: error: ‘AnnotatedDatum’ does not name a type
   void Transform(const AnnotatedDatum& anno_datum,
                        ^
......


一步一步来。

error: ‘AnnotatedDatum’ does not name a type 说明没找到定义,去看一下  “./include/caffe/data_transformer.hpp:69:24:”

void Transform(const AnnotatedDatum& anno_datum,
                 Blob<Dtype>* transformed_blob,
                 RepeatedPtrField<AnnotationGroup>* transformed_anno_vec);

结论同样:没有定义。

grep 一下,看看AnnotatedDatum定义到底在哪,很快,找到:

“caffe/proto/caffe.pb.h”

于是看看这个caffe.pb.h 怎么来的,发现是make 的第一步

PROTOC src/caffe/proto/caffe.proto

的产物,事实上,caffe.proto--→caffe.pb.h  这个过程是成功的,caffe.pb.h 也包含在路径之中。


那么问题来了:

CXX src/caffe/data_transformer.cpp找到了头文件caffe.pb.h而且,caffe.pb.h也给了AnnotatedDatum定义,那么为什么编译的时候报错AnnotatedDatum没定义(而非找不到caffe.pb.h)????



经过一系列痛苦的debug,原因在于Makefile 里面的一句话:

COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-isystem $(includedir))


注意蓝色字部分,

-isystem 是gcc的参数,表示引用路径,但是但是但是:

If a standard system include directory, or a directory specified with-isystem, is also specified with-I, the -Ioption is ignored. The directory is still searched but as asystem directory at its normal position in the system include chain. This is to ensure that GCC's procedure to fix buggy system headers andthe ordering for theinclude_next directive are not inadvertently changed. If you really need to change the search order for system directories,use the-nostdinc and/or -isystem

 options. 

大意就是-isystem里面如果和-I里面的头文件有冲突,会忽略-I!!!!!!!!


也就是,如果系统中(比如/usr/local/include)等地方有同名文件,会不进行本地(比如/home/XXX/caffe/include)的头文件搜索。

巧合的是,我之前安装caffe的时候又一次用了cmake,手贱写了make install。。。。。。于是我系统里确实有一套基础caffe环境,和ssd不同。。。。。。

至此,


改了几个字母:-isystem ---->-I

问题解决。


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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值