Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何编译caffe2ncnn工具 #30

Closed
LiMilo84 opened this issue Jul 25, 2017 · 13 comments
Closed

如何编译caffe2ncnn工具 #30

LiMilo84 opened this issue Jul 25, 2017 · 13 comments

Comments

@LiMilo84
Copy link

我在ubuntu上编译caffe2ncnn.cpp的时候一直编译不成功,头文件都已经添加了。请问还有什么需要特别注意的地方吗?

@nihui
Copy link
Member

nihui commented Jul 25, 2017

错误是什么呢

@LiMilo84
Copy link
Author

打印的错误信息:
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.

应该是生成caffe.pb.h的PROTOBUF版本问题吧?

@nihui
Copy link
Member

nihui commented Jul 26, 2017

系统里有两个 protobuf ?
把 protobuf 卸载重装下,然后删除 build 重新编译

@ruyiwei-cas
Copy link

ruyiwei@ruyiwei:/code/ncnn/tools/build$ make
[ 66%] Built target caffe2ncnn
[ 83%] Linking CXX executable ncnn2mem
/usr/bin/ld: cannot find -lncnn
collect2: error: ld returned 1 exit status
CMakeFiles/ncnn2mem.dir/build.make:94: recipe for target 'ncnn2mem' failed
make[2]: *** [ncnn2mem] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/ncnn2mem.dir/all' failed
make[1]: *** [CMakeFiles/ncnn2mem.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
ruyiwei@ruyiwei:
/code/ncnn/tools/build$ upgrade_net_proto_text
upgrade_net_proto_text: command not found

@ruyiwei-cas
Copy link

ruyiwei@ruyiwei:/code/ncnn/tools/build$ make
[ 66%] Built target caffe2ncnn
[ 83%] Linking CXX executable ncnn2mem
/usr/bin/ld: cannot find -lncnn
collect2: error: ld returned 1 exit status
CMakeFiles/ncnn2mem.dir/build.make:94: recipe for target 'ncnn2mem' failed
make[2]: *** [ncnn2mem] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/ncnn2mem.dir/all' failed
make[1]: *** [CMakeFiles/ncnn2mem.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
ruyiwei@ruyiwei:/code/ncnn/tools/build$ upgrade_net_proto_text
upgrade_net_proto_text: command not found

## 这是什么错误呢?修改platform.h.in 为platform.h 里面三行换为#define XXX true

@akbarxie
Copy link

akbarxie commented Jul 27, 2017

遇到和楼上大叔同样的问题,求解??

@nihui
Copy link
Member

nihui commented Jul 27, 2017

用顶层的 CMakeLists.txt 编译....
编译完在 ncnn/build/tools 里头有

@LiMilo84
Copy link
Author

@nihui
现在报出一大堆这样的错误
caffe2ncnn.cpp:(.text.ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8[std::basic_string<char, std::char_traits, std::allocator > std::operator+<char, std::char_traits, std::allocator >(std::basic_string<char, std::char_traits, std::allocator > const&, std::basic_string<char, std::char_traits, std::allocator > const&)]+0x15): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' caffe2ncnn.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8_[std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x27): undefined reference to std::basic_string<char, std::char_traits, std::allocator >::append(std::basic_string<char, std::char_traits, std::allocator > const&)'
caffe2ncnn.cpp:(.text.ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8[std::basic_string<char, std::char_traits, std::allocator > std::operator+<char, std::char_traits, std::allocator >(std::basic_string<char, std::char_traits, std::allocator > const&, std::basic_string<char, std::char_traits, std::allocator > const&)]+0x36): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' /tmp/ccAH9QUS.o: In function std::_Rb_tree_iterator<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> >::operator++(int)':
caffe2ncnn.cpp:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEppEi[std::_Rb_tree_iterator<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> >::operator++(int)]+0x19): undefined reference to std::_Rb_tree_increment(std::_Rb_tree_node_base*)' /tmp/ccAH9QUS.o: In function std::_Rb_tree_iterator<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> >::operator++()':
caffe2ncnn.cpp:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEppEv[std::_Rb_tree_iterator<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> >::operator++()]+0xf): undefined reference to std::_Rb_tree_increment(std::_Rb_tree_node_base*)' /tmp/ccAH9QUS.o: In function bool std::operator==<char, std::char_traits, std::allocator >(std::basic_string<char, std::char_traits, std::allocator > const&, char const*)':
caffe2ncnn.cpp:(.text.ZSteqIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_EPKS3[bool std::operator==<char, std::char_traits, std::allocator >(std::basic_string<char, std::char_traits, std::allocator > const&, char const*)]+0x14): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const' /tmp/ccAH9QUS.o: In function google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler>(int) const':
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobProtoEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler>(int) const]+0x3c): undefined reference to google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobProtoEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<caffe::BlobProto>::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<caffe::BlobProto>::TypeHandler>(int) const]+0x54): undefined reference to google::protobuf::internal::LogMessage::operator<<(char const*)'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobProtoEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler>(int) const]+0x63): undefined reference to google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobProtoEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<caffe::BlobProto>::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<caffe::BlobProto>::TypeHandler>(int) const]+0x72): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobProtoEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobProto::TypeHandler>(int) const]+0xa1): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()' /tmp/ccAH9QUS.o: In function google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler>(int) const':
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldISsE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler>(int) const]+0x3c): undefined reference to google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldISsE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::TypeHandler>(int) const]+0x54): undefined reference to google::protobuf::internal::LogMessage::operator<<(char const*)'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldISsE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler>(int) const]+0x63): undefined reference to google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldISsE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::TypeHandler>(int) const]+0x72): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldISsE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<std::basic_string<char, std::char_traits, std::allocator > >::TypeHandler>(int) const]+0xa1): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()' /tmp/ccAH9QUS.o: In function google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler>(int) const':
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobShapeEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler>(int) const]+0x3c): undefined reference to google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobShapeEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<caffe::BlobShape>::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<caffe::BlobShape>::TypeHandler>(int) const]+0x54): undefined reference to google::protobuf::internal::LogMessage::operator<<(char const*)'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobShapeEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler>(int) const]+0x63): undefined reference to google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobShapeEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<caffe::BlobShape>::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<caffe::BlobShape>::TypeHandler>(int) const]+0x72): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe9BlobShapeEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::BlobShape::TypeHandler>(int) const]+0xa1): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()' /tmp/ccAH9QUS.o: In function google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler>(int) const':
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe14LayerParameterEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler>(int) const]+0x3c): undefined reference to google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe14LayerParameterEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<caffe::LayerParameter>::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<caffe::LayerParameter>::TypeHandler>(int) const]+0x54): undefined reference to google::protobuf::internal::LogMessage::operator<<(char const*)'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe14LayerParameterEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler>(int) const]+0x63): undefined reference to google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)' caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe14LayerParameterEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrField<caffe::LayerParameter>::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrField<caffe::LayerParameter>::TypeHandler>(int) const]+0x72): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()'
caffe2ncnn.cpp:(.text._ZNK6google8protobuf8internal20RepeatedPtrFieldBase3GetINS0_16RepeatedPtrFieldIN5caffe14LayerParameterEE11TypeHandlerEEERKNT_4TypeEi[google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler::Type const& google::protobuf::internal::RepeatedPtrFieldBase::Get<google::protobuf::RepeatedPtrFieldcaffe::LayerParameter::TypeHandler>(int) const]+0xa1): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()' /tmp/ccAH9QUS.o: In function float* std::vector<float, std::allocator >::_M_allocate_and_copy<float*>(unsigned int, float*, float*)':
caffe2ncnn.cpp:(.text.ZNSt6vectorIfSaIfEE20_M_allocate_and_copyIPfEES3_jT_S4[float* std::vector<float, std::allocator >::_M_allocate_and_copy<float*>(unsigned int, float*, float*)]+0x50): undefined reference to __cxa_end_catch' caffe2ncnn.cpp:(.text._ZNSt6vectorIfSaIfEE20_M_allocate_and_copyIPfEES3_jT_S4_[float* std::vector<float, std::allocator<float> >::_M_allocate_and_copy<float*>(unsigned int, float*, float*)]+0x62): undefined reference to __cxa_begin_catch'

@ruyiwei-cas
Copy link

@nihui 谢谢,问题解决了,我随后会出一个更详细的版本,多谢,而且,我并不是大叔啊楼上

@akbarxie
Copy link

@nihui 谢谢,nice。没事我就调戏大叔。

@ruyiwei-cas
Copy link

@akbarxie 我真的不是大叔

@akbarxie
Copy link

我知道的,大叔

@ruyiwei-cas
Copy link

http://blog.csdn.net/best_coder/article/details/76201275
这个是写的感觉比较详细的安装教程,可以参照的看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants