-
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
Undefined reference to google protobuf #3046
Comments
If you are using Ubuntu, maybe this will help:
|
I have already installed libprotobuf-dev and protobuf-compiler on my Ubuntu 14.04 yet still get those error messages. |
Perhaps add
|
@shibuyanorailgun I don't quite understand...
and -pthread is handled at line 352.
I tried to edit line 172 to
but that doesn't help. I don't know much about Makefile, so maybe I misunderstood. Could you explain more about how to compile it right? |
= =, I'm sorry I can't figure out what happend. |
I encountered trouble alike |
Hi @snavavf, @cwlseu, Better versions: [UPDATED, TRY THIS] Instead of my bad advice on deleting with system files, we can remove development files of libprotobuf but still keep library files in /usr/lib/x86_64-linux-gnu by this command
Then try to install newest version of protobuf. |
Thanks @howtobeahacker ! |
Can you explain me the solution? I am not sure to understand and I have a similar problem. |
FYI: This seems to be a perfect solution for me. |
Advising people to delete system libraries isn't an ideal solution. I tried to remove protobuf-lite in ubuntu 15.10 with Googling about this reminded me that I had previously tryed to make CUDA work by changing to gcc 4.9. Unfortunately the c++ ABI changed so compiling stuff with 4.9 and trying to link to system libraries built with gcc 5 won't work. On the mailing list people are suggesting to remove the gcc 5 error from the CUDA header |
remove the gcc 5 error from the CUDA header |
This appears to be a prevalent issue ob Ubuntu 15.10! Caffe used to work fine on 15.04! Also I'm using CUDA 7.5 so in theory I should be fine for the GCC version issue! |
Hi, Ubuntu 15.10 user here. Had the same issue, solved by patching CUDA (/usr/local/cuda/include/host_config.h). Diff:
|
apparently someone called hottobeahacker solved this but i don't see that user or comment anymore. Could anyone enlighten me? |
@michaeljs1990 It's me, I just changed my name. See my first comment in the thread, it might help you avoid the problem. |
@antran89 thanks for the response. Unfortunately I have to use protoc 2.5 with my project so that is a no go for me. It seems that this library no longer works with the stock ubuntu 14.04 packages and the website contains incorrect information for building this package as well. |
@antran89 Hi,following your guidance,I've successfully compiled Caffe,but there is another problem arising:when I reboot my machine,the leftside toolbar of my ubuntu 14.04 desktop is gone,then I typed ccsm in the command window,which reported an error, |
I encounter this problem too, but don't how to fix it |
This one works for me, in Ubuntu 16.04:
|
This still fails to link to protobuf on the latest Ubuntu 16.04 LTS with gcc-4.9 ( |
for me this problem was caused because I had |
@antran89 删了 |
@wenwei202 It works |
@antran89 Hi, I recently moved on the caffe. I encountered this problem on the ArchLinux. I am not quite familiar with caffe and protobuf so I do not quite understand how this problem happens. Could you help me? Thank you so much. |
@bragilee Sorry, I do not know how to fix safely. Some distributions of Linux have two version of Protobuf. You should figure out how to make Caffe only recognize one version of Protobuf. Sorry, my recommendations are not good. Please try out the methods of other people. Now it works fine for me all the time. I also do not know why they have this problem. |
@antran89 Thank you so much for your help. I will seek other methods. :) |
@samuelcesc thank you , “conda remove libprotobuf” is the right solution! |
To me, install protobuf from source and copy its library to anaconda can solver this problem. [Notice: keep two protobuf version the same] I fell confused. Anaconda's protobuf is not a complete version of protobuf? I forgot to compare two protobuf versions' file size... update: huzhan@huzhan ~/package ll /usr/local/lib | grep protobuf These two libs are not the same one even if they are the same version.. |
Actually I think all the undefined error has something to do with the gcc/g++ version on ubuntu side, simple test can be done on the protobuf(https://github.com/google/protobuf/tree/master/src) I am not sure whether downgrading gcc/g++4.7 beforehand is a good option for build caffe. |
@zchrissirhcz |
i have compiled caffe on Ubuntu 16.04 LTS both with python 2 and python, it is really a hectic process for beginners, for caffe with python 2.7 make sure that your /.local/lib/python2.7/site-packages only contains a version same as you protoc version. protoc version can be checked by entering
or another protobuf such as 3.5 version of protobuf. hope everything works OK for you. |
1 similar comment
i have compiled caffe on Ubuntu 16.04 LTS both with python 2 and python, it is really a hectic process for beginners, for caffe with python 2.7 make sure that your /.local/lib/python2.7/site-packages only contains a version same as you protoc version. protoc version can be checked by entering
or another protobuf such as 3.5 version of protobuf. hope everything works OK for you. |
My solution is to change the INCLUDE_DIRS and LIBRARY_DIRS in Makefile.config. In my case, After my modification, my makefile is: Note that the protoc need to be in front of the default paths |
For UBUNTU 17.10, CUDA 8 and cUDNN 5 what is the best solution for the same error :( |
ubuntu 16.04, problem solved by compiling protobuf 2.5.0 using gcc-4.8. |
I was able to install and run on Cuda 9.0 with protobuf 3.5.1. I still got the undefined reference error. On looking further there were some old proto.so files in
Doing so removed the undefined reference error for me. It is mot likely due to conflict in existing version of protobuf that you have in your system. |
|
it can't help |
@groakat Exactly! It works! This error is indeed caused by the conflict of anaconda installed libprotobuf and apt installed libprotobuf. So the final solution is that you need to uninstall all libprotobuf of anaconda, and then installed libprotobuf-dev and protobuf-compiler by apt! |
I have MATLAB installed as well and the |
in caffe makefile line 262: but I compile protobuf with /usr/local/bin/g++ |
I have the same situation as you.I tried a lot of methods, and finally I uninstalled gcc directly and then reinstalled it.
|
Tried almost all the answers above.
my OS is ubuntu 18.04(Linux Mint19.1), cuda9.0, cudnn7.0, RTX2080 Ti |
Works for ubuntu 18.04 [confirmed] |
A small tip may help you :) That is to say, if your google/protobuf/include comes from $HOME/anaconda3/include, then .so/.a files must comes from $HOME/anaconda3/lib , keeping both version correspond. |
Ubuntu 18.04, too. But this solution doesn't work. [ 65%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/hdf5.cpp.o
[ 65%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/im2col.cpp.o
[ 67%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/im_transforms.cpp.o
[ 67%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/insert_splits.cpp.o
[ 68%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o
[ 68%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/math_functions.cpp.o
[ 70%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/sampler.cpp.o
[ 70%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/signal_handler.cpp.o
[ 70%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o
[ 71%] Linking CXX shared library ../../lib/libcaffe.so
[ 71%] Built target caffe
Scanning dependencies of target convert_imageset
[ 71%] Building CXX object tools/CMakeFiles/convert_imageset.dir/convert_imageset.cpp.o
[ 73%] Linking CXX executable convert_imageset
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::RepeatedField<float>::Add(float const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::RepeatedField<unsigned int>::~RepeatedField()'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::WireFormatLite::UInt32Size(google::protobuf::RepeatedField<unsigned int> const&)'
....I remove because it's too long :))
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::RepeatedPtrField<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::~RepeatedPtrField()'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::RepeatedPtrField<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/convert_imageset.dir/build.make:135: recipe for target 'tools/convert_imageset' failed
make[2]: *** [tools/convert_imageset] Error 1
CMakeFiles/Makefile2:441: recipe for target 'tools/CMakeFiles/convert_imageset.dir/all' failed
make[1]: *** [tools/CMakeFiles/convert_imageset.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
|
I am struggling with similar errors as @cannguyen275 . Could someone please help out with this issue? I need it to work a bit urgently. I'm working with Debian 9. Would really appreciate the help! |
I solved my problem by compiling and installing the corresponding protobuf version with $ locate libprotobuf # List only those matters
# /opt/anaconda3/pkgs/libprotobuf-3.11.4-hd408876_0/lib/libprotobuf.so
# /opt/anaconda3/lib/libprotobuf.so.22
# /usr/local/lib/libprotobuf.so
# /usr/local/lib/libprotobuf.so.22
$ ls /usr/local/lib/libprotobuf.so -l
# /usr/local/lib/libprotobuf.so -> libprotobuf.so.22.0.4
cd protobuf-3.11.4
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
pkg-config --cflags --libs protobuf I have my own compiling caffe on |
Cmake link command
|
thank u very much!!!!!!!!!!it 's very very helpful for me! |
1 similar comment
thank u very much!!!!!!!!!!it 's very very helpful for me! |
这是来自QQ邮箱的假期自动回复邮件。
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
|
I got these errors saying there are undefined reference to google protobuf when
make all
in caffe dir.I wonder which file (like the Makefile?) I should modify, or where I should set up in my system.
I've already installed protobuf as the command provided in the link, and installed libprotobuf-dev and protobuf-compiler on my Ubuntu 14.04.
The text was updated successfully, but these errors were encountered: