leovandriel / caffe2_cpp_tutorial

C++ transcripts of the Caffe2 Python tutorials and other C++ example code
BSD 2-Clause "Simplified" License
431 stars 94 forks source link

compile issus! #71

Closed BIGBALLON closed 6 years ago

BIGBALLON commented 6 years ago

Hello, everyone!!

I have an issue during building the repo.

bg@bg-CGI:~/Desktop/caffe2_cpp_tutorial$ mkdir -p build
bg@bg-CGI:~/Desktop/caffe2_cpp_tutorial$ cd build
bg@bg-CGI:~/Desktop/caffe2_cpp_tutorial/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Protobuf: /usr/local/lib/libprotobuf.so  
../caffe2: warning: directory does not exist.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bg/Desktop/caffe2_cpp_tutorial/build
bg@bg-CGI:~/Desktop/caffe2_cpp_tutorial/build$ make
Scanning dependencies of target caffe2_cpp
[  1%] Building CXX object CMakeFiles/caffe2_cpp.dir/src/caffe2/util/net_operator.cc.o
In file included from /usr/local/include/caffe2/core/logging.h:11:0,
                 from /usr/local/include/caffe2/core/blob.h:13,
                 from /usr/local/include/caffe2/core/operator.h:12,
                 from /home/bg/Desktop/caffe2_cpp_tutorial/include/caffe2/util/net.h:4,
                 from /home/bg/Desktop/caffe2_cpp_tutorial/src/caffe2/util/net_operator.cc:1:
/usr/local/include/caffe2/proto/caffe2.pb.h:230:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:353:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:665:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:863:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:976:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:1140:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:1253:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:1483:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:1674:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:1950:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:2180:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:2458:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:2602:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:2800:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/usr/local/include/caffe2/proto/caffe2.pb.h:6878:109: error: expected class-name before ‘{’ token
 template <> struct is_proto_enum< ::caffe2::TensorProto_DataType> : ::google::protobuf::internal::true_type {};
                                                                                                             ^
/usr/local/include/caffe2/proto/caffe2.pb.h:6883:99: error: expected class-name before ‘{’ token
 template <> struct is_proto_enum< ::caffe2::DeviceType> : ::google::protobuf::internal::true_type {};
                                                                                                   ^
CMakeFiles/caffe2_cpp.dir/build.make:62: recipe for target 'CMakeFiles/caffe2_cpp.dir/src/caffe2/util/net_operator.cc.o' failed
make[2]: *** [CMakeFiles/caffe2_cpp.dir/src/caffe2/util/net_operator.cc.o] Error 1
CMakeFiles/Makefile2:256: recipe for target 'CMakeFiles/caffe2_cpp.dir/all' failed
make[1]: *** [CMakeFiles/caffe2_cpp.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

need helps!!! plz!

BIGBALLON commented 6 years ago

I have solved it!!! Just uninstall protobuf(version 3.5.1), then install 3.5.0. It works well.