Error when Building Caffe on Ubuntu 16.04

2,580 views
Skip to first unread message

Josh Mendoza

unread,
Nov 17, 2016, 12:25:50 PM11/17/16
to Caffe Users
I have been stuck trying to install Caffe on 16.04 for some time now. I have all the dependencies in place and even reinstalled all of them to ensure I was getting a clean build. However, now I get this error (I fixed it from giving me the protobuf errors):

CXX/LD -o .build_release/examples/cifar10/convert_cifar_data.bin

...build_releasebuild_releasebuild_release///libtoolstools.///build_releaselibcaffe.so.convert_imageset.oextract_features.o/::build_release:tools /  /Incompute_image_mean.oundefinedInexamples   /functionreference cpp_classificationfunction/  to`: In function `std:classification.o `::std`:string In:google* : stringfunction:google*:  base:googleMakeCheckOpString`:<:std::int:CheckOpMessageBuilderMakeCheckOpString,::< :stringNewStringunsignedint*( > long)(googleint,': 

 :const.intMakeCheckOpString&><build_release,( /intunsignedlibint,/  libcaffe.so const:long&int , undefined  charconstreference &const ,*to ) int`' cv::

const:&compute_image_mean.cppimread,:( std:(char:. text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKcstringconst [const*&_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc),'] std:+int

:0x50)convert_imageset.cpp:')string* 

:google:( undefined.build_release :./:libtext._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKcreferenceMakeCheckOpString/>[ <libcaffe.so_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc(toint: ]int ,`undefined+  googleint 0x50const:>reference)&:( ,base:intto : :  int`undefinedCheckOpMessageBuilderconst leveldb :&const::DB::reference:,NewString&Open  (int,(to)  leveldb 'constchar:`

&:, google.Optionsbuild_release constchar: const/* :&tools)constbase,:/'* )::std'compute_image_mean.oCheckOpMessageBuilder

::::classification.cpp:

 ::stringextract_features.cppInNewString( : (const.(function)&text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc .'text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc,[`

[ _ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKcstd._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKcleveldb]:build_release]/:+:+tools:0x50string0x50/DB)*)convert_imageset.o*: ::* google  )Inundefined:undefined'  : 

functionreferenceMakeCheckOpStringreference.  < unsignedbuild_release`toto long, int>(unsigned long const&, int const&/main  ,` googlelib'`char:/:google :libcaffe.so

:constbase:convert_imageset.cpp:base*:) :::'undefined(:CheckOpMessageBuilder:: .CheckOpMessageBuilder

:referencetext.startup:NewStringcompute_image_mean.cpp +:(:to0x347NewString) ()('`.:)

cvtext._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc '.:[undefined

build_release:_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc ./imencode]referencebuild_releasetools(+ //std0x50toexamplesextract_features.o:: In function `std:) /:::`cpp_classificationstringstring *google/ undefined :classification.oconst google::&reference:SetUsageMessage ,: (In MakeCheckOpStringto<stdunsigned cv : function:`:long :google::string,`_InputArraybase  std :constunsigned:const:& :&CheckOpMessageBuilder)longstring,:'* :

.build_releasestd NewString/:google(lib:/::libcaffe.so):vector'MakeCheckOpString <

undefined<unsigned. unsignedreferencebuild_release  to /charlong tools,,`/  cvcompute_image_mean.ointstd::>::(:allocator unsigned< imreadInunsignedlong (function  stdconst: :char&`>string>, main ( >'constunsignedint &:& ,long,

const   compute_image_mean.cpp&intconststd:,)&:( ',:.char

 vectortext.startup .unsigned<+intconstbuild_release 0x168,*/long) )stdlib :':/constlibcaffe.so :undefined:&:

 allocator, char classification.cppreference< undefined: intconst (to>*reference.  )> const& text._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc`')to[google:'

 _ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc:

.`]:extract_features.cppbuild_release/lib/leveldb+SetUsageMessage:(libcaffe.so:0x50(std:: ).:DBundefined:text._ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKc::string  [: referenceundefined_ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKcOpenconst  ](&toreference+leveldb)  0x51:':`to)

Options leveldb:.build_release/lib/ libcaffe.so`: const:google:undefined& :Status ,undefined::reference  base: stdreference:ToStringto: :( :toCheckOpMessageBuilder)`string : google `:const::baseconstcvNewString':&:(

:,:)CheckOpMessageBuilder imread':leveldb(

::stdNewString:.:(:build_releaseDB)string/*' examples*

)const/.'&cpp_classificationbuild_release

,//lib/libcaffe.so. classification.o:build_releaseint: /) undefinedlib'In /

 referencelibcaffe.so.function to:build_release   /``undefinedlibmaincv /':referencelibcaffe.so:: :

imreadto classification.cpp( undefined:std` (:cvreference.:: text.startupstring:to+ imencode 0x221const(`)&:stdleveldb, undefined reference :: to::int stringDB)` :'cvconst:

:&Open.:,(build_releaseimread leveldb/(cv:libstd::/::Optionslibcaffe.so:_InputArray :string const  const&undefinedconst&, &, reference,  stdstd to::int ::)`stringvector'leveldb <

:constunsigned.:& build_releaseDB,char /::Open,leveldblib( :/leveldbstd:libcaffe.so::DB:::*allocator Options*<undefined )'

.build_releaseunsigned const/ reference&libchar/ ,>libcaffe.soto  : std> `:&undefinedleveldb.:, :build_releasestring reference:./ std DBbuild_releaselibconst:to://&: vector:liblibcaffe.so,:`<Open/ libcaffe.so cvint(leveldb:undefined:,leveldb:  : ::undefinedDBreferenceimencode(stdstd: *reference ::Options* )to:: to' stringallocatorconst 

` <&`.googlebuild_release:/googleconstint,:libbase:&> /::, stdlibcaffe.so:base >::CheckOpMessageBuilder:cv : :::conststringundefined:CheckOpMessageBuilder:&  NewString:_InputArray const&,)const'reference(: &

 )toNewStringstd,.' (: build_release

`):leveldb/.cvbuild_release'vector<:lib:/:lib

unsigned:/imencode/(. DBlibcaffe.sostdlibcaffe.so:build_releasechar**)'

.build_release::: string/,/ undefined  constlib libundefinedreference&/std/libcaffe.so  ,libcaffe.so::referenceto ::   cv` allocatorundefinedto:cv:undefined<  :_InputArray unsignedreference`: reference  leveldbimreadconst(&std charto:,: :to> :stdstring  `Status: `>cv::constvectorcv&::&<:,:ToString,unsigned: imencode(  imreadstd()intchar(:std ),' 

std::conststd.:vector:string':build_release:< const&, 

:/allocatorstringintcvlib< ,:/unsignedconst :libcaffe.so &std_InputArray:char,:  >undefined   :const>reference&intallocator& ,to)<,  std'int `:leveldb

>std::. :vector:build_release>:<vectorDB/ int<:libconst,unsigned:/&  Openlibcaffe.so)stdchar(:':,leveldb 

: :undefined.allocatorstd: build_release<:Optionsreference/int:  lib>allocatorconstto/ <& libcaffe.so>unsigned ,`: const leveldb char&std:undefined>)::  ':DB>reference

string:& . :,tobuild_releaseconst/Open  &lib,(std`/ libcaffe.soleveldbleveldb:leveldb:: ::::undefinedDB:vector: *referenceOptions<Status*  int:)toconst,:' & ToString

`,std(.leveldb :)build_release:/:std: libconstStatus:allocator/':

:<libcaffe.so:stringint:ToString > (undefinedconst ) &> reference, const 'to const

 leveldb&`:)cv:':DB

:*.imencode*build_release()/std'lib:

/:.libcaffe.sostringbuild_release: / constlibundefined&/ ,libcaffe.so reference:cv  :toundefined:  _InputArray`reference  leveldbtoconst: &:`,Statuscv :std:::imencode::(ToStringvectorstd(<:)unsigned:  stringconstchar 'const,

& ,std :cv::allocator:<_InputArrayunsigned  constchar&>,  >std&:,: vectorstd<::unsignedvector <charint,,  stdstd::::allocatorallocator<<unsignedint >char >>  >const&&,) 'std

:.:build_releasevector/<libint/,libcaffe.so :std :undefined: allocatorreference< intto>  `>leveldb :const:&Status):':

ToString.(build_release)/ libconst/'libcaffe.so

: undefined reference to `leveldb::Status::ToString() const'

collect2: error: ld returned 1 exit status

collect2: error: ld returned 1 exit status

Makefile:619: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed

make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1

make: *** Waiting for unfinished jobs....

Makefile:619: recipe for target '.build_release/tools/compute_image_mean.bin' failed

make: *** [.build_release/tools/compute_image_mean.bin] Error 1

collect2: error: ld returned 1 exit status

Makefile:619: recipe for target '.build_release/tools/upgrade_solver_proto_text.bin' failed

make: *** [.build_release/tools/upgrade_solver_proto_text.bin] Error 1

collect2: error: ld returned 1 exit status

Makefile:624: recipe for target '.build_release/examples/cpp_classification/classification.bin' failed

make: *** [.build_release/examples/cpp_classification/classification.bin] Error 1

collect2: error: ld returned 1 exit status

Makefile:619: recipe for target '.build_release/tools/upgrade_net_proto_binary.bin' failed

make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1

collect2: error: ld returned 1 exit status

Makefile:619: recipe for target '.build_release/tools/convert_imageset.bin' failed

make: *** [.build_release/tools/convert_imageset.bin] Error 1

collect2: error: ld returned 1 exit status

Makefile:619: recipe for target '.build_release/tools/extract_features.bin' failed

make: *** [.build_release/tools/extract_features.bin] Error 1

.build_release/examples/siamese/convert_mnist_siamese_data.o: In function `convert_dataset(char const*, char const*, char const*)':

convert_mnist_siamese_data.cpp:(.text+0x4cf): undefined reference. tobuild_release /`toolsleveldb/:caffe.o::DB :In: Openfunction( .leveldb`:std:build_release:Options/:lib string/const*libcaffe.so& :,google  :undefinedstd: :MakeCheckOpStringreference:< stringcudaErrorto , const `&cudaErrorgoogle,> :(leveldb:cudaError:base ::constDB:&*, CheckOpMessageBuilder*:cudaError): 'NewStringconst

(&.),build_release' /

charexamples. build_release/const/siamese*)'lib/:/convert_mnist_siamese_data.o

libcaffe.so::caffe.cpp : In(undefined . functiontext._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPSsRKT_RKT0_PKcreference [ `_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPSsRKT_RKT0_PKctostd] :+`:0x50cvstring):*::  imreadundefinedgoogle( :stdreference:: :MakeCheckOpStringtostring< unsigned ` constgoogleint&:,,:  baseintint:>():'unsignedCheckOpMessageBuilder

 :.int:build_release NewString(/const)lib&'/,

libcaffe.so .:intbuild_release  /undefinedconsttools &/reference,caffe.o:   tocharIn   `constfunctionleveldb* :)`:'stdDB:::

::convert_mnist_siamese_data.cppstring*Open: ((googleleveldb.::text._ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc::[MakeCheckOpStringOptions_ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc< ]unsignedconst+ &long0x50),,:   stdintundefined:> :(referencestringunsigned   consttolong&  ,`const google&leveldb:,:: :baseintDB: *:const*CheckOpMessageBuilder&):':,

NewString .(charbuild_release) /'constlib

*/.libcaffe.so)build_release:'/ :examplesundefined

/ caffe.cppsiamesereference:/ (convert_mnist_siamese_data.oto.: text._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc `[Incv_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc :]function:+ imencode0x50`()stdstd::: ::undefinedstringstring  *referenceconst  &googleto,:  :`cvMakeCheckOpStringgoogle:<::unsigned:_InputArray base int:const,:& CheckOpMessageBuilder,unsigned:  :stdintNewString:>(:()vectorunsigned'< 

intunsigned.  build_releasecharconst/,&tools ,/std caffe.o:unsigned: : int allocatorInconst< &unsignedfunction,   char`char>main  'const>:*&

),caffe.cpp' ::std(

:.convert_mnist_siamese_data.cpp:text.startup:vector+<(0x53int.)text._ZN6google17MakeCheckOpStringIjjEEPSsRKT_RKT0_PKc,:[  _ZN6google17MakeCheckOpStringIjjEEPSsRKT_RKT0_PKcstdundefined]: +:referenceallocator0x50 <)toint: > ` undefinedgoogle> : reference:const SetVersionString&to() std'`:

google:.:stringbuild_release: /baseconstlib:&/:)libcaffe.soCheckOpMessageBuilder'::

 :caffe.cppundefinedNewString: ((reference). 'text.startupto

+ .0x86`build_release)leveldb/::lib :/undefinedStatuslibcaffe.so ::reference:  ToStringundefinedto(  )reference`  googleconstto:' :

`SetUsageMessagecv(:std::imread:(stringstd :const:&string) 'const

&.,build_release /intlib)/'libcaffe.so

:. build_releaseundefined/ libreference/ libcaffe.soto:  `cvundefined: :referenceimread (tostd :`:cvstring: :constimencode&(,std :int:)string' 

const.&build_release,/ libcv/:libcaffe.so::_InputArray  undefinedconst &reference,  tostd :`:leveldbvector:<:unsignedDB :char:,Open (stdleveldb::::allocatorOptions< unsignedconst &char,>  std>:&:,string  conststd&:,: vectorleveldb<:int:,DB *std*:):'allocator

<.intbuild_release>/ lib>/ libcaffe.soconst:& )undefined' 

reference. build_releaseto/ lib`/cvlibcaffe.so::: imencodeundefined( stdreference: :tostring  `constleveldb&:,: Statuscv::::ToString_InputArray( )const &const,' 

std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'

.build_release/lib/libcaffe.so: undefined reference to `leveldb::Status::ToString() const'

collect2: error: ld returned 1 exit status

Makefile:624: recipe for target '.build_release/examples/siamese/convert_mnist_siamese_data.bin' failed

make: *** [.build_release/examples/siamese/convert_mnist_siamese_data.bin] Error 1

collect2: error: ld returned 1 exit status

Makefile:624: recipe for target '.build_release/examples/cifar10/convert_cifar_data.bin' failed

make: *** [.build_release/examples/cifar10/convert_cifar_data.bin] Error 1

collect2: error: ld returned 1 exit status

Makefile:619: recipe for target '.build_release/tools/caffe.bin' failed

make: *** [.build_release/tools/caffe.bin] Error 1

.build_release/examples/mnist/convert_mnist_data.o: In function `std::string* google::MakeCheckOpString<unsigned int, int>(unsigned int const&, int const&, char const*)':

convert_mnist_data.cpp:(.text._ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc]+0x50): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'

.build_release/examples/mnist/convert_mnist_data.o: In function `std::string* google::MakeCheckOpString<unsigned int, unsigned int>(unsigned int const&, unsigned int const&, char const*)':

convert_mnist_data.cpp:(.text._ZN6google17MakeCheckOpStringIjjEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIjjEEPSsRKT_RKT0_PKc]+0x50): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'

.build_release/examples/mnist/convert_mnist_data.o: In function `main':

convert_mnist_data.cpp:(.text.startup+0x124): undefined reference to `google::SetUsageMessage(std::string const&)'

.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::string const&, int)'

.build_release/lib/libcaffe.so: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'

.build_release/lib/libcaffe.so: 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&)'

.build_release/lib/libcaffe.so: undefined reference to `leveldb::Status::ToString() const'

collect2: error: ld returned 1 exit status

Makefile:624: recipe for target '.build_release/examples/mnist/convert_mnist_data.bin' failed

make: *** [.build_release/examples/mnist/convert_mnist_data.bin] Error 1 

When I run make again from the last build I get just this back: 

CXX/LD -o .build_release/tools/upgrade_net_proto_binary.bin

.build_release/lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'

.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::string const&, int)'

.build_release/lib/libcaffe.so: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'

.build_release/lib/libcaffe.so: 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&)'

.build_release/lib/libcaffe.so: undefined reference to `leveldb::Status::ToString() const'

collect2: error: ld returned 1 exit status

Makefile:619: recipe for target '.build_release/tools/upgrade_net_proto_binary.bin' failed

make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1


If anyone could help me understand what may be happening that would be great. I'm using cuda 8 cudnn 5 opencv 2.4 and libprotoc 3.1.0



mczenfold

unread,
Dec 28, 2016, 9:11:26 PM12/28/16
to Caffe Users
Any idea what the issue was?? I am running into this same error, also on Ubuntu 16.04...am trying to compile in CPU only mode.

Guofeng Hu

unread,
Dec 29, 2016, 2:46:06 AM12/29/16
to Caffe Users
I had the same problem like you. I thought this was because I didn't install the protobuf right, but when I reinstall the protobuf, It still showed the error. At last I had no idea, so I reinstalled the ubuntu 14.04, it  didn't show again.I don't know why.

在 2016年11月18日星期五 UTC+8上午1:25:50,Josh Mendoza写道:

mczenfold

unread,
Dec 29, 2016, 3:40:05 PM12/29/16
to Caffe Users
To those who it might help:

I fixed it, this helped me debug the library issues:

ldd .build_release/lib/libcaffe.so (run from CAFFE_HOME directory)

I had libhdf5 libraries that were too old, had to add libgcc to anaconda python, had to use the system libtiff.so.5 rather than anaconda libtiff, and had to reset the LD_LIBRARY_PATH to point to anaconda libs in addition to system libs...
Reply all
Reply to author
Forward
0 new messages