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

Caffe 1.0.0-rc3 make failed on Ubuntu 16.04 / CUDA 8.0 #4492

Closed
jianghaitao opened this issue Jul 20, 2016 · 14 comments
Closed

Caffe 1.0.0-rc3 make failed on Ubuntu 16.04 / CUDA 8.0 #4492

jianghaitao opened this issue Jul 20, 2016 · 14 comments

Comments

@jianghaitao
Copy link

I am trying to build caffe based on the update to date version in the Github. I have installed

  • Base OS: Ubuntu 16.04
  • CUDA 8.0 / cuDDN 5.05
  • Caffe 1.0.0-rc3 (rc3-216-g42cd785-dirty)
  • C++ 4.9.3

cmake . runs fine and found / confirmed all dependencies.

make failed with following error

[ 83%] Linking CXX executable caffe
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `train()':
caffe.cpp:(.text+0x286a): undefined reference to `google::protobuf::internal::StringTypeHandlerBase::New()'
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `std::string* google::MakeCheckOpString<cudaError, cudaError>(cudaError const&, cudaError const&, char const*)':
caffe.cpp:(.text._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPSsRKT_RKT0_PKc]+0x50): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `std::string* google::MakeCheckOpString<unsigned long, int>(unsigned long const&, int const&, char const*)':
caffe.cpp:(.text._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc]+0x50): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `main':
caffe.cpp:(.text.startup+0x53): undefined reference to `google::SetVersionString(std::string const&)'
caffe.cpp:(.text.startup+0x86): undefined reference to `google::SetUsageMessage(std::string const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::Message::InitializationErrorString() const'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::Message::GetTypeName() const'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::Message::DebugString() const'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::empty_string_'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::MessageLite::ParseFromString(std::string const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `cv::imread(std::string const&, int)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `cv::imencode(std::string const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `leveldb::Status::ToString() const'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/caffe.bin.dir/build.make:133: recipe for target 'tools/caffe' failed
make[2]: *** [tools/caffe] Error 1
CMakeFiles/Makefile2:435: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed
make[1]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Would appreciate any help on this.

@Solomon1588
Copy link

Your compiler is GCC 4.9 but the libraries in Ubuntu 15.10 ,16.04 repository is compiled with higher version(e.g. 5.2), so the protobuf lib is not compatible with your caffe.
You can recompile CUDA and Caffe with GCC5.2,
in addition, you can compile the protobuf, glog, gflags and boost .etc(maybe include levledb , lmdb?) manually.
If you want to learn more information, you can browse my post:
#4499 ubuntu 15.10 /16.04 runtest : Segmentation fault (core dumped)—— Be sure to link with compatible libraries

@shelhamer
Copy link
Member

For 16.04 compile Caffe master and see #4046.

From https://github.com/BVLC/caffe/blob/master/CONTRIBUTING.md:

Please do not post usage, installation, or modeling questions, or other requests for help to Issues.
Use the caffe-users list instead. This helps developers maintain a clear, uncluttered, and efficient view of the state of Caffe.

@internetcoffeephone
Copy link

I had a similar error which was not caused by an old GCC, but by an old protobuf version in my Anaconda install.
It was solved with conda install protobuf, which updated the install.

@hszhoushen
Copy link

I successfully solve the problem by recompile the protof with changed gcc ( I changed gcc from gcc5.4 to gcc4.8.5)

@danfouer
Copy link

[ 76%] Linking CXX executable ../bin/batch_matmul_op_gpu_test

../lib/libcaffe2.so: undefined reference to google::SetUsageMessage(std::string const&)' ../lib/libcaffe2.so: undefined reference to leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
../lib/libcaffe2_gpu.so: undefined reference to google::base::CheckOpMessageBuilder::NewString()' ../lib/libcaffe2.so: undefined reference to leveldb::Status::ToString() const'

@danfouer
Copy link

I changed gcc from gcc5.4 to gcc4.8.5), then I got:

[ 76%] Linking CXX executable ../bin/batch_matmul_op_gpu_test
/usr/bin/cmake: /home/danfouer/anaconda3/envs/PY27/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4)
/usr/bin/cmake: /home/danfouer/anaconda3/envs/PY27/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4)
/usr/bin/cmake: /home/danfouer/anaconda3/envs/PY27/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4)
/usr/bin/cmake: /home/danfouer/anaconda3/envs/PY27/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4)
CMakeFiles/batch_matmul_op_gpu_test.dir/operators/batch_matmul_op_gpu_test.cc.o: In function caffe2::(anonymous namespace)::BatchMatMulOpGPUTest::SetUp()': batch_matmul_op_gpu_test.cc:(.text+0x9ca): undefined reference to google::protobuf::internal::fixed_address_empty_string'
CMakeFiles/batch_matmul_op_gpu_test.dir/operators/batch_matmul_op_gpu_test.cc.o: In function caffe2::(anonymous namespace)::BatchMatMulOpGPUTest_BatchMatMulOpGPUBroadcastTest_Test::TestBody()': batch_matmul_op_gpu_test.cc:(.text+0x2c7f): undefined reference to google::protobuf::internal::fixed_address_empty_string'
../lib/libcaffe2.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../lib/libcaffe2.so: undefined reference to google::SetUsageMessage(std::string const&)'
../lib/libcaffe2.so: undefined reference to google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)' ../lib/libcaffe2.so: undefined reference to google::protobuf::internal::AssignDescriptors(std::string const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)'
../lib/libcaffe2.so: undefined reference to google::protobuf::Message::GetTypeName() const' ../lib/libcaffe2.so: undefined reference to google::protobuf::MessageLite::SerializeToString(std::string*) const'
../lib/libcaffe2.so: undefined reference to google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))' ../lib/libcaffe2.so: undefined reference to leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
../lib/libcaffe2.so: undefined reference to google::protobuf::TextFormat::ParseFromString(std::string const&, google::protobuf::Message*)' ../lib/libcaffe2.so: undefined reference to google::protobuf::Message::DebugString() const'
../lib/libcaffe2_gpu.so: undefined reference to google::base::CheckOpMessageBuilder::NewString()' ../lib/libcaffe2.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteBytes(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../lib/libcaffe2.so: undefined reference to google::protobuf::internal::OnShutdownDestroyString(std::string const*)' ../lib/libcaffe2.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../lib/libcaffe2_gpu.so: undefined reference to google::protobuf::Message::ShortDebugString() const' ../lib/libcaffe2_gpu.so: undefined reference to google::protobuf::MessageLite::ParseFromString(std::string const&)'
../lib/libcaffe2.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../lib/libcaffe2_gpu.so: undefined reference to google::protobuf::internal::ParseNamedEnum(google::protobuf::EnumDescriptor const*, std::string const&, int*)'
../lib/libcaffe2.so: undefined reference to leveldb::Status::ToString() const' ../lib/libcaffe2_gpu.so: undefined reference to google::protobuf::MessageLite::SerializeAsString() const'
../lib/libcaffe2.so: undefined reference to google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)' ../lib/libcaffe2.so: undefined reference to google::protobuf::Message::InitializationErrorString() const'
collect2: error: ld returned 1 exit status

@metalaman
Copy link

metalaman commented Feb 2, 2018

Ubuntu 16.04, Caffe with CPU Only.
Getting g++5 and having this CUSTOM_CXX := /usr/bin/g++-5 in my Makefile.config, then building solved the issue for me. Also, follow steps in this.
I didn't compile any Google library manually.

@hana9090
Copy link

hana9090 commented Apr 9, 2018

@internetcoffeephone How you make caffe consider this protobuf from conda?

@internetcoffeephone
Copy link

@hana9090 It did this automatically, I made no effort to do it. I don't know how caffe found my Anaconda installation and decided it was the default python installation (it wasn't), sorry.

@sunbinbin1991
Copy link

use this commad and show your g++ version, switch g++ version 5 works for me
sudo update-alternatives --config gcc

@mrgloom
Copy link

mrgloom commented Nov 24, 2018

What if I want to compile on Ubuntu 16 with gcc 4.8 for some reason, how to understand which versions of libs I need and which libs should be compiled from source?

@toby5box
Copy link
Contributor

toby5box commented Jan 30, 2019

gcc 5 isn't a viable avenue if you hit this: #6010 (which is why I am using gcc-4.8 and hit the OP's issue today).

Also rebuilding selected libraries with a different gcc may cause runtime issues with previously installed software? (e.g. other ML frameworks)

@adataylor
Copy link

@toby5box did you ever find a solution for this? I'm hitting the same

@toby5box
Copy link
Contributor

Sorry @adataylor I do not think I did.

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