Error: 'make all' 'make test' #2348

Closed
ankitdhall opened this Issue Apr 22, 2015 · 31 comments

Projects

None yet
@ankitdhall

I ran

cd caffe
cp Makefile.config.example Makefile.config
make all
make test
make runtest

as suggested on a website to complete the installation.
I am a beginner and have recently installed Ubuntu 14.04 and I am running Caffe without CUDA/GPU.
Most of the tests seem to be running without a problem. Help would be greatly appreciated.
I encountered the following(seems to show some kind of error):

ankit@Ankit:~/caffe$ make all
CXX/LD -o .build_release/tools/convert_imageset.bin
.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)' .build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/convert_imageset.bin] Error 1

ankit@Ankit:~/caffe$ make test
CXX/LD -o .build_release/test/test_all.testbin src/caffe/test/test_caffe_main.cpp

LD .build_release/src/caffe/test/test_threshold_layer.o
.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)' .build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/test/test_threshold_layer.testbin] Error 1
ankit@Ankit:~/caffe$

What could possibly be the problem here. Seems like some dependency error or incorrect path.(OpenCV maybe)
Thanks!
Regards,
Ankit

@jmozah
jmozah commented Apr 22, 2015

is opencv installed?

On Wed, Apr 22, 2015 at 5:01 PM, Ankit Dhall notifications@github.com
wrote:

I ran

cd caffe
cp Makefile.config.example Makefile.config
make all
make test
make runtest

as suggested on a website to complete the installation.
I am a beginner and have recently installed Ubuntu 14.04 and I am running
Caffe without CUDA/GPU.
Most of the tests seem to be running without a problem. Help would be
greatly appreciated.
I encountered the following(seems to show some kind of error):

ankit@Ankit:~/caffe$ make all
CXX/LD -o .build_release/tools/convert_imageset.bin
.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String
const&, int)'
.build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String
const&, cv::_InputArray const&, std::vector >&, std::vector > const&)'
.build_release/lib/libcaffe.so: undefined reference to
`cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/convert_imageset.bin] Error 1

ankit@Ankit:~/caffe$ make test
CXX/LD -o .build_release/test/test_all.testbin
src/caffe/test/test_caffe_main.cpp

LD .build_release/src/caffe/test/test_threshold_layer.o
.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String
const&, int)'
.build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String
const&, cv::_InputArray const&, std::vector >&, std::vector > const&)'
.build_release/lib/libcaffe.so: undefined reference to
`cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/test/test_threshold_layer.testbin] Error 1
ankit@Ankit:~/caffe$

What could possibly be the problem here. Seems like some dependency error
or incorrect path.(OpenCV maybe)
Thanks!
Regards,
Ankit


Reply to this email directly or view it on GitHub
#2348.

@StevenLOL

Yes, it is OpenCV

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler libatlas-base-dev
sudo apt-get install python-dev python-pip gfortran

Caffe documentation can be improved.

Later someone will come and say, you should post this in user groups...

@ankitdhall

@jmozah yes OpenCV is installed. @StevenLOL I ran that command and the terminal says all are the newest versions and didn't install anything. Any other suggestions?

@StevenLOL

Not sure about your problem, by the way, I build caffe by

cd caffe
cp Makefile.config.example Makefile.config
and change setting in Makefile.config
mkdir build
cd build
cmake ..
./configure (??not sure??)
make all

without using a build folder, for me there will be linking problem says libcaffe.o cant not find "xxx"

@jmozah
jmozah commented Apr 22, 2015

i remember my system had some confusion on cv and cv2... forgot what that
was,...

On Wed, Apr 22, 2015 at 5:57 PM, Steven notifications@github.com wrote:

Not sure, your problem, by the way, I build caffe by

cd caffe
cp Makefile.config.example Makefile.config
mkdir build
cd build
cmake ..
./configure (??not sure??)
make all

without using a build folder, for me there will be linking problem says
libcaffe.o cant not find "xxx"


Reply to this email directly or view it on GitHub
#2348 (comment).

@ankitdhall

@StevenLOL tried your way, not showing errors anymore :) . I'll try to run some sample code and hopefully it should work. Thanks!

@ankitdhall ankitdhall closed this Apr 22, 2015
@zhangtemplar

@ankitdhall I have the same problem, but it is solved after using cmake to configure your project.

@hongzhenwang

I meet the same problem and make a solution.
add "opencv_imgcodecs" in Makefile.(LIBRARIES += glog gflags protobuf leveldb snappy
lmdb boost_system hdf5_hl hdf5 m
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs)
If you input "make all",the problem is the same again.But if you delete all the file in build(rm -rf ./build/*) before "make all",you will success.I just success

@sinb
sinb commented May 5, 2015

@hongzhenwang Many thanks! I just made it.

@ghost
ghost commented May 18, 2015

Thanks Alot @StevenLOL it solved my problem and at last I'm done with caffe installation.

@kalyanvasudev

@hongzhenwang even after adding those lines to make file it doesnt work. DOes the location in makefile also matter?
And I am getting this error when I lay Anconda python paths instead of default python paths in caaffe makefile.

@zchengquan

thx @hongzhenwang, your solution works well.

@patsimm
patsimm commented Jul 8, 2015

@hongzhenwang 's solution did it for me too.

@binary42

Problem with the makefile still missing the opencv_imgcodecs in the library list in the Makefile. This needs to be added to the project. Otherwise, all users who pull down the latest version will have to tread through the issues to find the solution listed here. @hongzhenwang is correct, though I would not follow his exact procedure, use make clean to zap the previous failed build. rm -rf is very dangerous, especially if your a newb and can potentially zap root and what not...

@vipuldivyanshu92 vipuldivyanshu92 added a commit to vipuldivyanshu92/caffe that referenced this issue Sep 6, 2015
@vipuldivyanshu92 vipuldivyanshu92 Update Makefile
Added opencv_imgcodecs to LIBRARIES , line 174.
This solves the make all error reported in BVLC#2348 and suggested by  @hongzhenwang and @binary42.
b305674
@aseempatni

Thanks @hongzhenwang. That helped.

Added LIBRARIES += glog gflags protobuf leveldb snappy \ lmdb boost_system hdf5_hl hdf5 m \ opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs to Makefile.config

I used make clean instead of rm -rf ./build

Then did make all and everything worked fine.

@zdx3578
zdx3578 commented Dec 27, 2015

did you install opencv3 ??

@james1i
james1i commented Dec 31, 2015

I just installed and went through make all/tests/runtest successfully (only other hitch was a simple export error for the cuda libraries).

Makefile.config has this:

# Uncomment if you're using OpenCV 3
# OPENCV_VERSION := 3

It worked for me on Ubuntu 14.04/OpenCV 3.1/ Cuda 7.5/CuDNN v.3/980 Ti

@tczuo
tczuo commented Feb 19, 2016

Using wang @hongzhenwang 's solution, I still can't solve this problem.
Then I try to create soft links for opencv_imgcodecs using follow commands, it success!

$ sudo cp imgcodecs_c.h /usr/local/include
$ sudo cp libopencv_imgcodecs.so /usr/local/lib
$ sudo cp libopencv_imgcodecs.so.3.0 /usr/local/lib
$ sudo cp libopencv_imgcodecs.so.3.0.0 /usr/local/lib
$ sudo ln -sf /usr/local/lib/libopencv_imgcodecs.so.3.0.0 /usr/local/lib/libopencv_imgcodecs.so.3.0
$ sudo ln -sf /usr/local/lib/libopencv_imgcodecs.so.3.0 /usr/local/lib/libopencv_imgcodecs.so
$ sudo ldconfig -v

@jas0n1ee

I got a similar error. Solved by using cmake.

@yashrahmed

Thanks @hongzhenwang...It worked for me. However I'd like to point out that if you have openCV 3 installed and have enabled building with the same by using "OPENCV_VERSION := 3" in your makefile.config file, those extra dependencies are automatically added.

@PrashantChauhan

Thanks
@StevenLOL

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler libatlas-base-dev
sudo apt-get install python-dev python-pip gfortran

This worked for me.

@gaush123

@StevenLOL Hi Steven, I was able to solve this issue by method you suggested, and compiled caffe successfully. But while I am trying to train the network, I am getting the error below:

./build/tools/caffe: symbol lookup error: /home/ubuntu/Downloads/caffe/.build_release/tools/../lib/libcaffe.so: undefined symbol: _ZN5caffe5cudnn8dataTypeIdE4zeroE
Could you please suggest a way out of this
Thanks,
Gaurav

@ZlodeiBaal ZlodeiBaal referenced this issue in Russell91/apollocaffe Aug 12, 2016
Open

Some bugs with Ubuntu 16 | GTX 1080 #55

@hana9090

@hojonathanho
I have uncomment these paths and the make all is going well.
but when i make the make test, i have these errors:


CXX src/caffe/test/test_roi_pooling_layer.cpp
src/caffe/test/test_roi_pooling_layer.cpp:28:26: error: ‘FloatGPU’ was not declared in this scope
 typedef ::testing::Types<FloatGPU, DoubleGPU> TestDtypesGPU;
                          ^
src/caffe/test/test_roi_pooling_layer.cpp:28:36: error: ‘DoubleGPU’ was not declared in this scope
 typedef ::testing::Types<FloatGPU, DoubleGPU> TestDtypesGPU;
                                    ^
src/caffe/test/test_roi_pooling_layer.cpp:28:45: error: template argument 1 is invalid
 typedef ::testing::Types<FloatGPU, DoubleGPU> TestDtypesGPU;
                                             ^
src/caffe/test/test_roi_pooling_layer.cpp:28:45: error: template argument 2 is invalid
In file included from src/caffe/test/test_roi_pooling_layer.cpp:21:0:
./include/caffe/test/test_caffe_main.hpp: In instantiation of ‘class caffe::MultiDeviceTest<int>’:
src/caffe/test/test_roi_pooling_layer.cpp:31:7:   required from ‘class caffe::ROIPoolingLayerTest<int>’
src/caffe/test/test_roi_pooling_layer.cpp:90:1:   required from ‘class caffe::ROIPoolingLayerTest_TestGradient_Test<int>’
./src/gtest/gtest.h:7334:28:   required from ‘static bool testing::internal::TypeParameterizedTest<Fixture, TestSel, Types>::Register(const char*, const char*, const char*, int) [with Fixture = caffe::ROIPoolingLayerTest; TestSel = testing::internal::TemplateSel<caffe::ROIPoolingLayerTest_TestGradient_Test>; Types = testing::internal::Types1<int>]’
src/caffe/test/test_roi_pooling_layer.cpp:90:1:   required from here
./include/caffe/test/test_caffe_main.hpp:33:37: error: ‘int’ is not a class, struct, or union type
   typedef typename TypeParam::Dtype Dtype;
                                     ^
@monajalal

On Ubuntu 15.10 using Python2.7 and make clean before the command get this error:

jalal@klein:~/computer_vision/py-faster-rcnn/caffe-fast-rcnn$ make -j8 && make pycaffe
blah blah
CXX/LD -o .build_release/tools/compute_image_mean.bin
CXX/LD -o .build_release/tools/upgrade_net_proto_binary.bin
CXX/LD -o .build_release/tools/test_net.bin
CXX/LD -o .build_release/tools/convert_imageset.bin
CXX/LD -o .build_release/tools/upgrade_net_proto_text.bin
CXX/LD -o .build_release/tools/train_net.bin
CXX/LD -o .build_release/tools/device_query.bin
CXX/LD -o .build_release/tools/finetune_net.bin
CXX/LD -o .build_release/tools/caffe.bin
CXX/LD -o .build_release/tools/extract_features.bin
CXX/LD -o .build_release/tools/upgrade_solver_proto_text.bin
CXX/LD -o .build_release/tools/net_speed_benchmark.bin
.build_release/lib/libcaffe.so: undefined reference to `boost::python::throw_error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::import(boost::python::str)'
.build_release/lib/libcaffe.so: undefined reference to `PyEval_CallFunction'
.build_release/lib/libcaffe.so: undefined reference to `typeinfo for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `PyErr_Print'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::error_already_set::~error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::api::getattr(boost::python::api::object const&, char const*)'
.build_release/lib/libcaffe.so: undefined reference to `_Py_NoneStruct'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `vtable for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `Py_Initialize'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup_shared_ptr(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage2(_object*, .boost::python::converter::rvalue_from_python_stage1_data&, boost::python::converter::registration const&)'
build_release/.build_release/liblib//libcaffe.so:libcaffe.so undefined : reference toundefined ` referenceboost:: topython: `:converterboost:::detail:python::arg_to_python_base::::arg_to_python_basethrow_error_already_set()'
(void .const volatilebuild_release/*, lib/libcaffe.so: boost:undefined:python reference::converter to::registration ` const&boost::python::import(boost::python::str)'
)'
.build_release/lib/libcaffe.so: undefined reference to `PyEval_CallFunction'collect2: error: ld returned 1 exit status

.build_release/lib/libcaffe.so: undefined reference to `typeinfo for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `PyErr_Print'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::error_already_set::~error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
.build_release/lib/Makefile:609: recipe for target '.build_release/tools/convert_imageset.bin' failed
libcaffe.so: undefined reference to `boost::python::api::getattr(make: *** [.build_release/tools/convert_imageset.bin] Error 1
boost::python::api::object const&,make: *** Waiting for unfinished jobs....
 char const*)'
.build_release/lib/libcaffe.so: undefined reference to `_Py_NoneStruct'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `vtable for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `Py_Initialize'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup_shared_ptr(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage2(_object*, boost::python::converter::rvalue_from_python_stage1_data&, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::detail::arg_to_python_base::arg_to_python_base(void const volatile*, boost::python::converter::registration const&)'
collect2: error: ld returned 1 exit status
Makefile:609: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `boost::python::throw_error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::import(boost::python::str)'
.build_release/lib/libcaffe.so: undefined reference to `PyEval_CallFunction'
.build_release/lib/libcaffe.so: undefined reference to `typeinfo for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `PyErr_Print'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::error_already_set::~error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::api::getattr(boost::python::api::object const&, char const*)'
.build_release/lib/libcaffe.so: undefined reference to `_Py_NoneStruct'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `vtable for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `Py_Initialize'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup_shared_ptr(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage2(_object*, boost::python::converter::rvalue_from_python_stage1_data&, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::detail::arg_to_python_base::arg_to_python_base(void const volatile*, boost::python::converter::registration const&)'
collect2: error: ld returned 1 exit status
Makefile:609: recipe for target '.build_release/tools/compute_image_mean.bin' failed
make: *** [.build_release/tools/compute_image_mean.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `boost::python::throw_error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::import(boost::python::str)'
.build_release/lib/libcaffe.so: undefined reference to `PyEval_CallFunction'
.build_release/lib/libcaffe.so: undefined reference to `typeinfo for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `PyErr_Print'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::error_already_set::~error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::api::getattr(boost::python::api::object const&, char const*)'
.build_release/lib/libcaffe.so: undefined reference to `_Py_NoneStruct'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `vtable for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `Py_Initialize'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup_shared_ptr(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage2(_object*, boost::python::converter::rvalue_from_python_stage1_data&, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::detail::arg_to_python_base::arg_to_python_base(void const volatile*, boost::python::converter::registration const&)'
collect2: error: ld returned 1 exit status
Makefile:609: recipe for target '.build_release/tools/upgrade_net_proto_binary.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1
.build_release/tools/caffe.o: In function `main':
caffe.cpp:(.text.startup+0x334): undefined reference to `vtable for boost::python::error_already_set'
caffe.cpp:(.text.startup+0x347): undefined reference to `PyErr_Print'
caffe.cpp:(.text.startup+0x351): undefined reference to `boost::python::error_already_set::~error_already_set()'
caffe.cpp:(.text.startup+0x395): undefined reference to `boost::python::error_already_set::~error_already_set()'
.build_release/tools/caffe.o: In function `_GLOBAL__sub_I_caffe.cpp':
caffe.cpp:(.text.startup+0x40e): undefined reference to `_Py_NoneStruct'
.build_release/tools/caffe.o:(.data.DW.ref._ZTIN5boost6python17error_already_setE[DW.ref._ZTIN5boost6python17error_already_setE]+0x0): undefined reference to `typeinfo for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::throw_error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::import(boost::python::str)'
.build_release/lib/libcaffe.so: undefined reference to `PyEval_CallFunction'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::api::getattr(boost::python::api::object const&, char const*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `Py_Initialize'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup_shared_ptr(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage2(_object*, boost::python::converter::rvalue_from_python_stage1_data&, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::detail::arg_to_python_base::arg_to_python_base(void const volatile*, boost::python::converter::registration const&)'
collect2: error: ld returned 1 exit status
Makefile:609: recipe for target '.build_release/tools/caffe.bin' failed
make: *** [.build_release/tools/caffe.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `boost::python::throw_error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::import(boost::python::str)'
.build_release/lib/libcaffe.so: undefined reference to `PyEval_CallFunction'
.build_release/lib/libcaffe.so: undefined reference to `typeinfo for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `PyErr_Print'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::error_already_set::~error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::api::getattr(boost::python::api::object const&, char const*)'
.build_release/lib/libcaffe.so: undefined reference to `_Py_NoneStruct'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `vtable for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `Py_Initialize'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup_shared_ptr(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage2(_object*, boost::python::converter::rvalue_from_python_stage1_data&, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::detail::arg_to_python_base::arg_to_python_base(void const volatile*, boost::python::converter::registration const&)'
collect2: error: ld returned 1 exit status
Makefile:609: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `boost::python::throw_error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::import(boost::python::str)'
.build_release/lib/libcaffe.so: undefined reference to `PyEval_CallFunction'
.build_release/lib/libcaffe.so: undefined reference to `typeinfo for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `PyErr_Print'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::error_already_set::~error_already_set()'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::api::getattr(boost::python::api::object const&, char const*)'
.build_release/lib/libcaffe.so: undefined reference to `_Py_NoneStruct'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage1(_object*, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `vtable for boost::python::error_already_set'
.build_release/lib/libcaffe.so: undefined reference to `Py_Initialize'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::registry::lookup_shared_ptr(boost::python::type_info)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::rvalue_from_python_stage2(_object*, boost::python::converter::rvalue_from_python_stage1_data&, boost::python::converter::registration const&)'
.build_release/lib/libcaffe.so: undefined reference to `boost::python::converter::detail::arg_to_python_base::arg_to_python_base(void const volatile*, boost::python::converter::registration const&)'
collect2: error: ld returned 1 exit status
Makefile:609: recipe for target '.build_release/tools/upgrade_solver_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_solver_proto_text.bin] Error 1
jalal@klein:~/computer_vision/py-faster-rcnn/caffe-fast-rcnn$ 

@aabobakr

@monajalal have you installed boost ?
sudo apt-get install --no-install-recommends libboost-all-dev

@soupault
soupault commented Sep 2, 2016

I'm getting the same error as OP does. Solution from @StevenLOL has helped.

@monajalal

When I installed Boost from source-code in Ubuntu 15.10 the problem was fixed. In Ubuntu 14.04 I didn't come across this problem.

@aleksartamonov
aleksartamonov commented Oct 3, 2016 edited

I can make all but whrn i call
make test
I have an error

LD .build_debug/src/caffe/test/test_tile_layer.o
/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so: undefined reference to cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, double&, bool, double (cv::Algorithm::*)(), void (cv::Algorithm::*)(double), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference tocv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, int)'
/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so: undefined reference to cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, int&, bool, int (cv::Algorithm::*)(), void (cv::Algorithm::*)(int), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so: undefined reference tocv::AlgorithmInfo::nameabi:cxx11 const'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to cv::tempfile[abi:cxx11](char const*)' /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so: undefined reference tocv::AlgorithmInfo::AlgorithmInfo(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cv::Algorithm* ()())'
/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so: undefined reference to `cv::format[abi:cxx11](char const
, ...)'

@lijingszu

On Ubuntu 16.04 using Python2.7 and make clean before the command get this error:

g++ .build_release/tools/net_speed_benchmark.o .build_release/lib/libcaffe.a -o .build_release/tools/net_speed_benchmark.bin -fPIC -DCPU_ONLY -DNDEBUG -O2 -DUSE_MKL -I/home/lijing/anaconda2/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/home/lijing/Softwares/intel/mkl/include -Wall -Wno-sign-compare -L/home/lijing/anaconda2/lib -L/usr/local/lib -L/usr/lib -L/home/lijing/Softwares/intel/mkl/lib -lglog -lgflags -lpthread -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_highgui -lopencv_imgproc -lmkl_rt
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_erase(unsigned long, unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char, unsigned long) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned long, unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned long) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21'
collect2: error: ld returned 1 exit status
Makefile:445: recipe for target '.build_release/tools/net_speed_benchmark.bin' failed
make: *** [.build_release/tools/net_speed_benchmark.bin] Error 1
make: *** Waiting for unfinished jobs....
@hritt
hritt commented Dec 26, 2016

the reason is that 'make' can't find opencv files.
if you compile opencv youself, try to uncomment "USE_PKG_CONFIG := 1" in Makefile.config

@Jayhello

@StevenLOL
cd build
cmake ..
./configure (??not sure??)
make all

after that ,what to do?
if i
cd ..
make test
there is still error
where to ( the following steps https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide )
make test
make runtest
make pycaffe -should be finished already, so you can omit this one
make distribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment