Compile Caffe2 #1597
Comments
Can you please post the CMake summary output? There is likely a mismatch of some sorts with the protobuf library that is compiled against and the protobuf library that is loaded at runtime. |
@pietern I attach the these files as follows. Thank you very much. |
What instructions are you following to install? Are you using anaconda? This looks like a problem with conflicting protobuf versions on your machine. I've seen this before when trying to install with conda's latest protobuf version while system libprotobuf-dev or protobuf-compiler versions where installed. Can you run |
@pjh5 I am install Caffe2 based on the official instructions. I use the anaconda since I also work on caffe1. beans@Beans:~/caffe2$ which protoc |
Your installation is being confused by the multiple versions of protobuf (similar to the problem here https://stackoverflow.com/questions/7752609/cmake-ordering-of-include-directories-how-to-mix-system-and-user-based-includ ). The best thing to do would be to uninstall all of the protobufs except for the one you want, and then reinstalling any other versions of protobuf you need after caffe2 is installed. The instructions have been updated recently for Anaconda on mac; that process may work for you too. |
A change just merged which should make this earlier. If you remove your build directory to remove any cached files, pull the latest caffe2 from github, and then call cmake with -DCMAKE_PREFIX_PATH=<path/to/your/anaconda/env>, then cmake should use Anaconda's protobuf throughout the entire installation |
@pjh5 Okay, I will try it. Thank you very much. |
I still have the same issue on centos 7 using anaconda and having installed multiple versions of protobuf. -DCMAKE_PREFIX_PATH doesn't help. |
have the same problem, have to use protobuf in the thirdparty folder |
protobuf issue is resolved, but now I got ../lib/libcaffe2_gpu.so: undefined reference to |
@fliman your problem is #1980 . @qwert1337 can you use https://caffe2.ai/docs/getting-started.html?platform=mac&configuration=compile#anaconda-install-path , it should still work on centos. |
@pjh5 thanks for your reply, I tried your solution as in #1980 by adding flags in cmake call ../lib/libcaffe2.so: undefined reference to |
@filman try using protobuf 3.4.0 from conda |
When I install the caffe2, the following errors occurred, so anyone who knows the solution. Thank you very much. (gcc version 5.4.1, Protoc version 3.4.0)
make[3]: Leaving directory
/home/beans/caffe2/build' make[3]: Entering directory
/home/beans/caffe2/build'[ 87%] Building CXX object caffe2/CMakeFiles/blob_gpu_test.dir/core/blob_gpu_test.cc.o
Linking CXX executable ../bin/blob_gpu_test
../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::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void ()(void))'../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::DecrementRecursionDepthAndPopLimit(int)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::WireFormatLite::UInt32Size(google::protobuf::RepeatedField<unsigned int> const&)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::OnShutdownDestroyMessage(void const*)'../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::internal::WireFormatLite::WriteFloatArray(float const*, int, google::protobuf::io::CodedOutputStream*)'../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::ReadVarint64Fallback()' ../lib/libcaffe2.so: undefined reference to
google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, long*, long*)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns(google::protobuf::io::CodedInputStream*, unsigned int, bool (*)(int), google::protobuf::UnknownFieldSet*, google::protobuf::RepeatedField<int>*)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::IncrementRecursionDepthAndPushLimit(int)'../lib/libcaffe2.so: undefined reference to
google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::WireFormatLite::Int32Size(google::protobuf::RepeatedField const&)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::OnShutdownDestroyString(std::string const*)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedOutputStream::WriteVarint64SlowPath(unsigned long)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedOutputStream::WriteVarint32SlowPath(unsigned int)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::InitProtobufDefaults()' ../lib/libcaffe2.so: undefined reference to
google::protobuf::Message::SpaceUsedLong() const'../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::SkipFallback(int, int)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::ArenaImpl::AllocateAligned(unsigned long)' ../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::WireFormatLite::WriteDoubleArray(double const*, int, google::protobuf::io::CodedOutputStream*)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::ArenaImpl::AddCleanup(void*, void (*)(void*))' ../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::BytesUntilTotalBytesLimit() const'../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::ReadVarintSizeAsIntFallback()' ../lib/libcaffe2.so: undefined reference to
google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)'../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::fixed_address_empty_string' ../lib/libcaffe2.so: undefined reference to
google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int)'../lib/libcaffe2_gpu.so: undefined reference to
google::FlagRegisterer::FlagRegisterer<std::string>(char const*, char const*, char const*, std::string*, std::string*)' ../lib/libcaffe2.so: undefined reference to
google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, int*, int*)'collect2: error: ld returned 1 exit status
make[3]: *** [bin/blob_gpu_test] Error 1
make[3]: Leaving directory
/home/beans/caffe2/build' make[2]: *** [caffe2/CMakeFiles/blob_gpu_test.dir/all] Error 2 make[2]: Leaving directory
/home/beans/caffe2/build'make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/beans/caffe2/build'
make: *** [all] Error 2
The text was updated successfully, but these errors were encountered: