首页 > 解决方案 > Caffe 链接错误,但 ldd 没有给出错误

问题描述

我正在使用 Ubuntu 16.04 在 Odroid 上构建 caffe,但出现链接错误:

[ 77%] Linking CXX executable compute_image_mean
CMakeFiles/compute_image_mean.dir/compute_image_mean.cpp.o: In function `std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)':
compute_image_mean.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x28): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
CMakeFiles/compute_image_mean.dir/compute_image_mean.cpp.o: In function `std::string* google::MakeCheckOpString<unsigned int, int>(unsigned int const&, int const&, char const*)':
compute_image_mean.cpp:(.text._ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc]+0x28): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
CMakeFiles/compute_image_mean.dir/compute_image_mean.cpp.o: In function `main':
compute_image_mean.cpp:(.text.startup+0xe6): undefined reference to `google::SetUsageMessage(std::string const&)'
../lib/libcaffe.so.1.0.0: undefined reference to `cv::imread(std::string const&, int)'
../lib/libcaffe.so.1.0.0: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
../lib/libcaffe.so.1.0.0: 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: undefined reference to `leveldb::Status::ToString() const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/compute_image_mean.dir/build.make:130: recipe for target 'tools/compute_image_mean' failed
make[2]: *** [tools/compute_image_mean] Error 1
CMakeFiles/Makefile2:467: recipe for target 'tools/CMakeFiles/compute_image_mean.dir/all' failed
make[1]: *** [tools/CMakeFiles/compute_image_mean.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

这是的输出sudo ld lib/libcaffe.so.1.0.0

sudo ld lib/libcaffe.so.1.0.0 
ld: warning: cannot find entry symbol _start; defaulting to 000101ec
lib/libcaffe.so.1.0.0: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
lib/libcaffe.so.1.0.0: undefined reference to `cv::imread(std::string const&, int)'
lib/libcaffe.so.1.0.0: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
lib/libcaffe.so.1.0.0: 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: undefined reference to `leveldb::Status::ToString() const'

根据ldd lib/libcaffe.so.1.0.0,已找到所有必需的库。如何识别问题?

标签: ubuntulinkercaffeodroid

解决方案


推荐阅读