Skip to content

Instantly share code, notes, and snippets.

@shi-yan
Created October 12, 2016 03:24
Show Gist options
  • Save shi-yan/a244514c50d1e149ce66bcc83f0b19b2 to your computer and use it in GitHub Desktop.
Save shi-yan/a244514c50d1e149ce66bcc83f0b19b2 to your computer and use it in GitHub Desktop.
Build Caffe on Ubuntu 16 with Cuda 8
Building Caffe on Ubuntu 16 with Cuda 8.0 wasn't smooth for me.
I googled, many people saw the same problem. I want to briefly document what I did to build Caffe.
symptoms, you might see errors like this, this is because of gcc 5.
a new feature added to gcc5 called abi_tag will cause problems like this:
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
.build_release/tools/extract_features.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)':
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x50): undefined reference to `google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()'
.build_release/tools/extract_features.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* google::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)':
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringImmEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImmEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x51): undefined reference to `google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()'
Undefined symbols for architecture x86_64:
"cv::imread(std::__1::basic_string, std::__1::allocator > const&, int)", referenced from:
caffe::WindowDataLayer::InternalThreadEntry() in window_data_layer.o
caffe::WindowDataLayer::InternalThreadEntry() in window_data_layer.o
caffe::ReadImageToCVMat(std::__1::basic_string, std::__1::allocator > const&, int, int, bool) in io.o
"cv::imencode(std::__1::basic_string, std::__1::allocator > const&, cv::_InputArray const&, std::__1::vector >&, std::__1::vector > const&)", referenced from:
caffe::ReadImageToDatum(std::__1::basic_string, std::__1::allocator > const&, int, int, int, bool, std::__1::basic_string, std::__1::allocator > const&, caffe::Datum) in io.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: ** [.build_release/lib/libcaffe.so] Error 1
Scotts-iMac:caffe-master scottkrig$ ls /opt/local/lib
ls: /opt/local/lib: No such file or directory
undefined cv::imread()
undefined cv::imencode()
https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-OpenCV-3.1-Installation-Guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment