-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
enabled -std=c++11 #6359
Comments
I think this issue is related to protobuf, which uses C++ 11 features. |
Hello my friend. what did you do to get this to work ? i have encountered the same issue, any help would be much appreciated. |
@EmpireofKings Generally there are two options: 1. use up-to-date protobuf, and add -std=c++11 to CXXFAGS in makefile, which could be a bit painful; 2. use protobuf 2.x, which is c++ 98 compatible. |
I meet the same problem. Have you fixed it?@yaxinshen |
@shallyxxxx
Modify
|
@manifoldQAQ
|
@manifoldQAQ Good job! |
@amitfishy Hi, I follow your advice, and remove *.pb, then make it, it works well. How to solve the problem? I find some information about 'this program require a version of protobuf' # 5711, most solutions are to rollback protoc version to 2.6, but we need protoc version3.6, So how to make caffe support protobuf 3.6? |
Firstly I followed the standard procedure for building caffe. Also I don't recall saying anything about the .pb files here. I never came across this error specifically but came across similar things.
You should see 2.6.1 which is your current protobuf version which you must have installed with apt-get. You must be using cuda 9 which I believe needs v3.6, you can try installing the google protobuf by source. Following the install instructions will install in the default place which should be different from where your apt-get libraries are stored. Be careful if you try to remove the old libs or upgrade them, they can cause issues while booting. Once you install by source, make sure it is being picked up correctly by checking with the version command or edit the order of the path variables as I've mentioned above in #3046 . |
@amitfishy I have installed protoc version3.6 |
So I am confused, |
Find the .so and .a libs (probably in /usr/local/lib) for your v3.6 and add them to LD_LIBRARY_PATH and LIBRARY_PATH env variables respectively. Make sure to add them in the beginning like:
Probably your makefile was pointing to those directories correctly and during runtime it's finding the other version. |
Thank you for your reply @amitfishy, |
Could you please try in the build folder:
And share the output? |
It might be picking up the first one(v2.5) instead of the second (v3.6). Try the following if you're still up for it:
|
Try rebuilding it such that it gets linked with the right .so and .a libs. Don't forget the:
After exporting the LD path. |
When I export LIBRARY_PATH, it has the error '/etc/profile: 30: bad assignment'. |
@amitfishy It works! |
Good to hear, the problem was the build was linked with the older libs, while the runtime libs were fine. |
In summary, the build was linked with older protoc version, I forget to make clean, and LIBRARY_PATH has no effect. |
Can you check what
gives you now? |
CXX .build_release/src/caffe/proto/caffe.pb.cc anybody plz help me libprotoc 3.6.0 |
i used both above stated solution BUT both did not worked for me |
Check the g++ specified in your makefile. Try:
Scroll down and look whether -std flag has option for c++11. If it doesn't, try changing the g++ compiler version. I'm using:
|
When will this be merged into Caffe?? |
@soulslicer I guess Caffe is no longer actively maintained. You can either hack with Caffe source code or use Caffe2. If you don't want to use Caffe, then some dirty job has to be done to the Makefile in order to use Protobuf 3.x. |
No you dont you just need to add that one word into the cmakelists. |
I also encountered this error, and the solutions didn't work for me. How to solve this problem? make all -j8 |
I meet the same error(complie NVCC) with you. How do you solve it? |
@amitfishy 威武霸气 |
I use python=3.5 on anaconda .when protobuf =3.6 on anaconda, meeting the same problem. so change the protobuf =3.2 ,it will be OK! |
I added below codes in Makefile since this solution did not work for some reason.
|
PROTOC src/caffe/proto/caffe.proto
CXX .build_release/src/caffe/proto/caffe.pb.cc
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 .build_release/src/caffe/proto/caffe.pb.h:9,
from .build_release/src/caffe/proto/caffe.pb.cc:4:
/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 .build_release/src/caffe/proto/caffe.pb.h:9,
from .build_release/src/caffe/proto/caffe.pb.cc:4:
/usr/local/include/google/protobuf/stubs/mutex.h:58: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:51:17: error: ‘mu_’ was not declared in this scope
void Lock() { 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:52:19: error: ‘mu_’ was not declared in this scope
void Unlock() { mu_.unlock(); }
^
/usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
/usr/local/include/google/protobuf/stubs/mutex.h:61:7: error: expected nested-name-specifier before ‘Mutex’
using Mutex = WrappedMutex;
^
/usr/local/include/google/protobuf/stubs/mutex.h:66:28: error: expected ‘)’ before ‘*’ token
explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
^
/usr/local/include/google/protobuf/stubs/mutex.h:69: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:67: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:80:33: error: expected ‘)’ before ‘’ token
explicit MutexLockMaybe(Mutex *mu) :
^
In file included from /usr/local/include/google/protobuf/arena.h:48:0,
from .build_release/src/caffe/proto/caffe.pb.h:23,
from .build_release/src/caffe/proto/caffe.pb.cc:4:
/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
Makefile:588: recipe for target '.build_release/src/caffe/proto/caffe.pb.o' failed
make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1
Tried solutions
add 'CXXFLAGs += -std=c++11' in Makefile didn't solve it
System configuration
The text was updated successfully, but these errors were encountered: