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

Build Issue with Protobuf v3.5.1 Related to c++11 #29

Open
amitfishy opened this issue Jun 18, 2018 · 4 comments
Open

Build Issue with Protobuf v3.5.1 Related to c++11 #29

amitfishy opened this issue Jun 18, 2018 · 4 comments

Comments

@amitfishy
Copy link

amitfishy commented Jun 18, 2018

Hi

I'm currently using Ubuntu 16 and trying to build maplab and my build is failing for protobuf_catkin because of the different version of protobuf version I am using. I know this for sure because I had the exact same problem while trying to install caffe which also uses google's protocol buffers and I was able to fix the problem by adding -std=c++11 to CXXFLAGS in the makefile. It seems that the build works out of the box when I use protobuf v2 which follows the c++98 standard, so how do I modify the existing makefiles of this package to put this flag?

Sorry that this question is more related to c++ CMakelists.txt and ROS in general and not actually a problem with the wrapper, but I just thought its better to put it out there if someone tries to use it with the latest version of protobuf.

EDIT: I've tried adding the following to the CMakelists.txt file (after 'project') but it is still giving the same error:

SET (CMAKE_CXX_FLAGS "-std=c++11")

Here is a small portion of the error log:

Errors     << protobuf_catkin:make /home/amitsinha/maplab_ws/logs/protobuf_catkin/build.make.000.log                                                                                  
+ sed -i -e s/RuntimeLibrary="5"/RuntimeLibrary="3"/g;
           s/RuntimeLibrary="4"/RuntimeLibrary="2"/g; gtest/msvc/gtest-md.vcproj gtest/msvc/gtest.vcproj gtest/msvc/gtest_main-md.vcproj gtest/msvc/gtest_main.vcproj gtest/msvc/gtest_prod_test-md.vcproj gtest/msvc/gtest_prod_test.vcproj gtest/msvc/gtest_unittest-md.vcproj gtest/msvc/gtest_unittest.vcproj
+ autoreconf -f -i -Wall,no-obsolete
configure.ac:27: installing 'build-aux/compile'
configure.ac:24: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
configure.ac:45: installing './compile'
configure.ac:32: installing './missing'
/usr/share/automake-1.15/am/ltlibrary.am: warning: 'libprotobuf-lite.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.15/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
src/Makefile.am:96:   while processing Libtool library 'libprotobuf-lite.la'
/usr/share/automake-1.15/am/ltlibrary.am: warning: 'libprotobuf.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.15/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
src/Makefile.am:96:   while processing Libtool library 'libprotobuf.la'
/usr/share/automake-1.15/am/ltlibrary.am: warning: 'libprotoc.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.15/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
src/Makefile.am:96:   while processing Libtool library 'libprotoc.la'
src/Makefile.am: installing './depcomp'
+ rm -rf autom4te.cache config.h.in~
+ exit 0
make[3]: warning: -jN forced in submake: disabling jobserver mode.
In file included from /usr/include/c++/5/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from /usr/local/include/google/protobuf/compiler/command_line_interface.h:41,
                 from google/protobuf/compiler/main.cc:33:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/c++/5/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/once.h:81,
                 from google/protobuf/stubs/once.cc:38:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/c++/5/atomic:38:0,
                 from /usr/local/include/google/protobuf/generated_message_util.h:42,
                 from google/protobuf/generated_message_util.cc:35:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from google/protobuf/stubs/once.cc:38:0:
/usr/local/include/google/protobuf/stubs/once.h:88:7: error: expected nested-name-specifier before ‘once_flag’
 using once_flag = std::once_flag;
       ^
/usr/local/include/google/protobuf/stubs/once.h:90:20: error: expected ‘,’ or ‘...’ before ‘&&’ token
 void call_once(Args&&... args ) {
                    ^
/usr/local/include/google/protobuf/stubs/once.h:90:31: error: parameter packs not expanded with ‘...’:
 void call_once(Args&&... args ) {
                               ^
/usr/local/include/google/protobuf/stubs/once.h:90:31: note:         ‘Args’
/usr/local/include/google/protobuf/stubs/once.h: In function ‘void google::protobuf::internal::call_once(<type error>)’:
/usr/local/include/google/protobuf/stubs/once.h:91:3: error: ‘call_once’ is not a member of ‘std’
   std::call_once(std::forward<Args>(args)...);
   ^
/usr/local/include/google/protobuf/stubs/once.h:91:3: note: suggested alternative:
/usr/local/include/google/protobuf/stubs/once.h:90:6: note:   ‘google::protobuf::internal::call_once’
 void call_once(Args&&... args ) {
      ^
/usr/local/include/google/protobuf/stubs/once.h:91:18: error: ‘forward’ is not a member of ‘std’
   std::call_once(std::forward<Args>(args)...);
                  ^
/usr/local/include/google/protobuf/stubs/once.h:91:35: error: expected primary-expression before ‘>’ token
   std::call_once(std::forward<Args>(args)...);
                                   ^
/usr/local/include/google/protobuf/stubs/once.h:91:37: error: ‘args’ was not declared in this scope
   std::call_once(std::forward<Args>(args)...);
                                     ^
/usr/local/include/google/protobuf/stubs/once.h: At global scope:
/usr/local/include/google/protobuf/stubs/once.h:97:7: error: expected nested-name-specifier before ‘ProtobufOnceType’
 using ProtobufOnceType = internal::once_flag;
       ^
/usr/local/include/google/protobuf/stubs/once.h:99:28: error: variable or field ‘GoogleOnceInit’ declared void
 inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) {
                            ^
/usr/local/include/google/protobuf/stubs/once.h:99:28: error: ‘ProtobufOnceType’ was not declared in this scope
/usr/local/include/google/protobuf/stubs/once.h:99:46: error: ‘once’ was not declared in this scope
 inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) {
                                              ^
/usr/local/include/google/protobuf/stubs/once.h:99:59: error: ‘init_func’ was not declared in this scope
 inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) {
                                                           ^
/usr/local/include/google/protobuf/stubs/once.h:104:31: error: variable or field ‘GoogleOnceInitArg’ declared void
 inline void GoogleOnceInitArg(ProtobufOnceType* once, void (*init_func)(Arg*),
                               ^
/usr/local/include/google/protobuf/stubs/once.h:104:31: error: ‘ProtobufOnceType’ was not declared in this scope
/usr/local/include/google/protobuf/stubs/once.h:104:49: error: ‘once’ was not declared in this scope
 inline void GoogleOnceInitArg(ProtobufOnceType* once, void (*init_func)(Arg*),
                                                 ^
/usr/local/include/google/protobuf/stubs/once.h:104:62: error: ‘init_func’ was not declared in this scope
 inline void GoogleOnceInitArg(ProtobufOnceType* once, void (*init_func)(Arg*),
                                                              ^
/usr/local/include/google/protobuf/stubs/once.h:104:76: error: expected primary-expression before ‘*’ token
 inline void GoogleOnceInitArg(ProtobufOnceType* once, void (*init_func)(Arg*),
                                                                            ^
/usr/local/include/google/protobuf/stubs/once.h:104:77: error: expected primary-expression before ‘)’ token
 inline void GoogleOnceInitArg(ProtobufOnceType* once, void (*init_func)(Arg*),
                                                                             ^
/usr/local/include/google/protobuf/stubs/once.h:104:77: error: void value not ignored as it ought to be
/usr/local/include/google/protobuf/stubs/once.h:105:34: error: expected primary-expression before ‘*’ token
                               Arg* arg) {
                                  ^
/usr/local/include/google/protobuf/stubs/once.h:105:36: error: ‘arg’ was not declared in this scope
                               Arg* arg) {
                                    ^
/usr/local/include/google/protobuf/stubs/once.h:120:3: error: ‘ProtobufOnceType’ does not name a type
   ProtobufOnceType state_;
   ^
/usr/local/include/google/protobuf/stubs/once.h: In member function ‘void google::protobuf::GoogleOnceDynamic::Init(void (*)(T*), T*)’:
/usr/local/include/google/protobuf/stubs/once.h:117:5: error: ‘GoogleOnceInitArg’ was not declared in this scope
     GoogleOnceInitArg<T>(&this->state_, func_with_arg, arg);
     ^
/usr/local/include/google/protobuf/stubs/once.h:117:24: error: expected primary-expression before ‘>’ token
     GoogleOnceInitArg<T>(&this->state_, func_with_arg, arg);
                        ^
/usr/local/include/google/protobuf/stubs/once.h:117:33: error: ‘class google::protobuf::GoogleOnceDynamic’ has no member named ‘state_’
     GoogleOnceInitArg<T>(&this->state_, func_with_arg, arg);
                                 ^
In file included from /usr/include/c++/5/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from ./google/protobuf/stubs/stringprintf.h:47,
                 from google/protobuf/stubs/stringprintf.cc:33:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/c++/5/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from /usr/local/include/google/protobuf/stubs/atomicops.h:59,
                 from google/protobuf/stubs/atomicops_internals_x86_gcc.cc:36:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/c++/5/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from google/protobuf/stubs/common.cc:33:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/c++/5/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from /usr/local/include/google/protobuf/stubs/atomicops.h:59,
                 from google/protobuf/stubs/atomicops_internals_x86_msvc.cc:37:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/c++/5/mutex:35:0,
                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,
                 from /usr/local/include/google/protobuf/stubs/common.h:52,
                 from /usr/local/include/google/protobuf/stubs/hash.h:39,
                 from google/protobuf/extension_set.cc:35:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from /usr/local/include/google/protobuf/compiler/command_line_interface.h:41,
                 from google/protobuf/compiler/main.cc:33:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
google/protobuf/compiler/main.cc:61:1: error: expected ‘}’ at end of input
 }
 ^
google/protobuf/compiler/main.cc:61:1: error: expected unqualified-id at end of input
google/protobuf/compiler/main.cc:61:1: error: expected ‘}’ at end of input
google/protobuf/compiler/main.cc:61:1: error: expected ‘}’ at end of input
google/protobuf/compiler/main.cc:61:1: error: expected ‘}’ at end of input
make[5]: *** [google/protobuf/compiler/main.o] Error 1
make[5]: *** Waiting for unfinished jobs....
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from /usr/local/include/google/protobuf/stubs/atomicops.h:59,
                 from google/protobuf/stubs/once.cc:48:
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
google/protobuf/stubs/once.cc:97:1: error: expected ‘}’ at end of input
 }  // namespace google
 ^
google/protobuf/stubs/once.cc:97:1: error: expected unqualified-id at end of input
google/protobuf/stubs/once.cc:97:1: error: expected ‘}’ at end of input
google/protobuf/stubs/once.cc:97:1: error: expected ‘}’ at end of input
google/protobuf/stubs/once.cc:97:1: error: expected ‘}’ at end of input
make[5]: *** [google/protobuf/stubs/once.lo] Error 1
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from ./google/protobuf/stubs/stringprintf.h:47,
                 from google/protobuf/stubs/stringprintf.cc:33:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
google/protobuf/stubs/stringprintf.cc:175:1: error: expected ‘}’ at end of input
 }  // namespace google
 ^
google/protobuf/stubs/stringprintf.cc:175:1: error: expected unqualified-id at end of input
google/protobuf/stubs/stringprintf.cc:175:1: error: expected ‘}’ at end of input
google/protobuf/stubs/stringprintf.cc:175:1: error: expected ‘}’ at end of input
google/protobuf/stubs/stringprintf.cc:175:1: error: expected ‘}’ at end of input
make[5]: *** [google/protobuf/stubs/stringprintf.lo] Error 1
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from /usr/local/include/google/protobuf/stubs/atomicops.h:59,
                 from google/protobuf/stubs/atomicops_internals_x86_gcc.cc:36:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
google/protobuf/stubs/atomicops_internals_x86_gcc.cc:133:1: error: expected ‘}’ at end of input
 }  // namespace google
 ^
google/protobuf/stubs/atomicops_internals_x86_gcc.cc:133:1: error: expected unqualified-id at end of input
google/protobuf/stubs/atomicops_internals_x86_gcc.cc:133:1: error: expected ‘}’ at end of input
google/protobuf/stubs/atomicops_internals_x86_gcc.cc:133:1: error: expected ‘}’ at end of input
google/protobuf/stubs/atomicops_internals_x86_gcc.cc:133:1: error: expected ‘}’ at end of input
make[5]: *** [google/protobuf/stubs/atomicops_internals_x86_gcc.lo] Error 1
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from /usr/local/include/google/protobuf/generated_message_util.h:48,
                 from google/protobuf/generated_message_util.cc:35:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
In file included from /usr/local/include/google/protobuf/arena.h:48:0,
                 from /usr/local/include/google/protobuf/implicit_weak_message.h:35,
                 from /usr/local/include/google/protobuf/generated_message_util.h:51,
                 from google/protobuf/generated_message_util.cc:35:
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected unqualified-id before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected declaration before end of line
make[5]: *** [google/protobuf/generated_message_util.lo] Error 1
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from google/protobuf/stubs/common.cc:33:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
google/protobuf/stubs/common.cc:395:1: error: expected ‘}’ at end of input
 }  // namespace google
 ^
google/protobuf/stubs/common.cc:395:1: error: expected unqualified-id at end of input
google/protobuf/stubs/common.cc:395:1: error: expected ‘}’ at end of input
google/protobuf/stubs/common.cc:395:1: error: expected ‘}’ at end of input
google/protobuf/stubs/common.cc:395:1: error: expected ‘}’ at end of input
make[5]: *** [google/protobuf/stubs/common.lo] Error 1
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from /usr/local/include/google/protobuf/stubs/atomicops.h:59,
                 from google/protobuf/stubs/atomicops_internals_x86_msvc.cc:37:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
In file included from /usr/local/include/google/protobuf/stubs/atomicops.h:194:0,
                 from google/protobuf/stubs/atomicops_internals_x86_msvc.cc:37:
/usr/local/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h:289:1: error: expected ‘}’ at end of input
 }  // namespace google
 ^
/usr/local/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h:289:1: error: expected unqualified-id at end of input
/usr/local/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h:289:1: error: expected ‘}’ at end of input
/usr/local/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h:289:1: error: expected ‘}’ at end of input
/usr/local/include/google/protobuf/stubs/atomicops_internals_x86_gcc.h:289:1: error: expected ‘}’ at end of input
In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
                 from /usr/local/include/google/protobuf/stubs/hash.h:39,
                 from google/protobuf/extension_set.cc:35:
/usr/local/include/google/protobuf/stubs/mutex.h:70:8: error: ‘mutex’ in namespace ‘std’ does not name a type
   std::mutex mu_;
        ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:63:43: error: ‘mu_’ was not declared in this scope
   void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
                                           ^
/usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:64:45: error: ‘mu_’ was not declared in this scope
   void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
                                             ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:73:7: error: expected nested-name-specifier before ‘Mutex’
 using Mutex = WrappedMutex;
       ^
/usr/local/include/google/protobuf/stubs/mutex.h:78:28: error: expected ‘)’ before ‘*’ token
   explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
                            ^
/usr/local/include/google/protobuf/stubs/mutex.h:81:3: error: ‘Mutex’ does not name a type
   Mutex *const mu_;
   ^
/usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
/usr/local/include/google/protobuf/stubs/mutex.h:79:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
   ~MutexLock() { this->mu_->Unlock(); }
                        ^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:92:33: error: expected ‘)’ before ‘*’ token
   explicit MutexLockMaybe(Mutex *mu) :
                                 ^
In file included from /usr/local/include/google/protobuf/arena.h:48:0,
                 from /usr/local/include/google/protobuf/repeated_field.h:60,
                 from /usr/local/include/google/protobuf/extension_set.h:51,
                 from google/protobuf/extension_set.cc:38:
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected unqualified-id before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
/usr/include/c++/5/typeinfo:39:37: error: expected declaration before end of line
make[5]: *** [google/protobuf/stubs/atomicops_internals_x86_msvc.lo] Error 1
make[5]: *** [google/protobuf/extension_set.lo] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all] Error 2
make[2]: *** [protobuf_src-prefix/src/protobuf_src-stamp/protobuf_src-build] Error 2
make[1]: *** [CMakeFiles/protobuf_src.dir/all] Error 2
make: *** [all] Error 2

@deji04
Copy link

deji04 commented Sep 27, 2018

Hi @amitfishy

I am encountering the same issue in Protobuf v3.6.1 and I cant compile C++. I've read that adding this "-std=c++ 11" would make it work.

On which folder should I add this? Because I have CMakelists.txt in protobuf-master/cmake/ and protobuf-master/examples. I've added this to both but I still encounter the same error.

Please help!!
Thanks

@amitfishy
Copy link
Author

Hi @deji04

This was my problem as well, sorry I can't help you with it. I tried adding it in a few places (like where I mentioned in my post), but it didn't really work. By my understanding, it should work when you add the flag to the makefile.

Also, it seems there's only a single CMakeLists in the main folder, and when I look at the repo there is no folder called 'examples' and cmake does not have anything in it (apart from one file). Maybe you should remove the files that were generated after the first failed build before starting again (or start from scratch with the clean repo).

It's also possible that it does not support c++11 yet, unfortunately, I've not got a reply here to confirm this. In any case, if you really need it to work, try downgrading to v2 of the protobuf. That is what I did.

Thanks
Amit

@deji04
Copy link

deji04 commented Oct 1, 2018

Thanks Amit for the response!

I have a question though. I just installed protobuf 2weeks ago, I assume that I have v3 protobuf and libprotoc v3.6.1. I built it from Source and follow every single step of the installation. So how do I install v2 of protobuf?

I've checked with my gcc version, I have v4.8.5 since that is the default version for Centos7. I've been updating the gcc version since Thurs, and it is not done yet (i'm looking at CPU issue here). I hope that it would finish today so I can proceed with my testing of C++.

Anyways, the "examples" folder is included during installation of protoc v3.6.1.

I've tried putting -std=c++11 in Makefile but the error its throwing now is "/bash/sh: add_person.cc: command not found". This got me confused more. :(

Thanks!

@deji04
Copy link

deji04 commented Oct 1, 2018

Hi Amit,

I solved my issue now and finished testing.

What I did is i installed the gcc version 6.3.1 and run "make cpp" as instructed. And it ran without any errors.

Thanks!

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

2 participants