Caffe installation error when running make test

1,515 views
Skip to first unread message

Raghu Ram

unread,
Jan 23, 2016, 9:26:42 AM1/23/16
to Caffe Users
I am trying to install Caffe on a Ubuntu 14.04 system. When I run make all, the compilation runs smoothly. When I move onto the next step, make test, I get the following output:

CXX/LD -o .build_release/test/test_all.testbin src/caffe/test/test_caffe_main.cpp
/usr/bin/ld: warning: libopencv_core.so.3.0, needed by /usr/local/lib/libopencv_imgcodecs.so, may conflict with libopencv_core.so.2.4
/usr/bin/ld: warning: libopencv_imgproc.so.3.0, needed by /usr/local/lib/libopencv_imgcodecs.so, may conflict with libopencv_imgproc.so.2.4
.build_release/src/caffe/test/test_data_transformer.o: In function `caffe::MakeTempDir(std::string*)':
test_data_transformer.cpp:(.text._ZN5caffe11MakeTempDirEPSs[_ZN5caffe11MakeTempDirEPSs]+0x4a): undefined reference to `boost::filesystem::detail::temp_directory_path(boost::system::error_code*)'
test_data_transformer.cpp:(.text._ZN5caffe11MakeTempDirEPSs[_ZN5caffe11MakeTempDirEPSs]+0x60): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
test_data_transformer.cpp:(.text._ZN5caffe11MakeTempDirEPSs[_ZN5caffe11MakeTempDirEPSs]+0xe0): undefined reference to `boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*)'
test_data_transformer.cpp:(.text._ZN5caffe11MakeTempDirEPSs[_ZN5caffe11MakeTempDirEPSs]+0x107): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_code*)'
.build_release/src/caffe/test/test_data_transformer.o: In function `caffe::MakeTempFilename(std::string*)':
test_data_transformer.cpp:(.text._ZN5caffe16MakeTempFilenameEPSs[_ZN5caffe16MakeTempFilenameEPSs]+0x87): undefined reference to `boost::filesystem::path::codecvt()'
test_data_transformer.cpp:(.text._ZN5caffe16MakeTempFilenameEPSs[_ZN5caffe16MakeTempFilenameEPSs]+0x340): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
.build_release/src/caffe/test/test_layer_factory.o: In function `caffe::LayerFactoryTest_TestCreateLayer_Test<caffe::CPUDevice<double> >::TestBody()':
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv]+0x7eb): undefined reference to `boost::filesystem::detail::temp_directory_path(boost::system::error_code*)'
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv]+0x809): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv]+0x8a7): undefined reference to `boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*)'
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIdEEE8TestBodyEv]+0x8d1): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_code*)'
.build_release/src/caffe/test/test_layer_factory.o: In function `caffe::LayerFactoryTest_TestCreateLayer_Test<caffe::CPUDevice<float> >::TestBody()':
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv]+0x7eb): undefined reference to `boost::filesystem::detail::temp_directory_path(boost::system::error_code*)'
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv]+0x809): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv]+0x8a7): undefined reference to `boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*)'
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9CPUDeviceIfEEE8TestBodyEv]+0x8d1): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_code*)'
.build_release/src/caffe/test/test_upgrade_proto.o: In function `caffe::NetUpgradeTest_TestUpgradeV1LayerType_Test::TestBody()':
test_upgrade_proto.cpp:(.text+0xd8c): undefined reference to `boost::filesystem::detail::temp_directory_path(boost::system::error_code*)'
test_upgrade_proto.cpp:(.text+0xdaa): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
test_upgrade_proto.cpp:(.text+0xe47): undefined reference to `boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*)'
test_upgrade_proto.cpp:(.text+0xe71): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/test/test_all.testbin] Error 1

Any help on resolving this would be much appreciated.


S.Majid Azimi

unread,
Jan 23, 2016, 9:55:37 AM1/23/16
to Raghu Ram, Caffe Users
you have two versions of opencv which you have set the paths for both in your bash file.

removing one of them would solve the issue.

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/07907fc1-87b4-49ab-9c86-4d39abcbb367%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tuan Pham ngoc

unread,
Jan 23, 2016, 4:35:01 PM1/23/16
to Caffe Users

Some one tell in other theard that can change "DBUID-EFF=0" but i can't know how to change it in cmake

Raghu Ram

unread,
Jan 24, 2016, 8:40:32 PM1/24/16
to Caffe Users, raghu...@gmail.com
Hi Majid, can you please let me know how to do it? I edited the Makefile as per the instructions given here (http://stackoverflow.com/questions/34125052/caffe-with-opencv-3-and-nvidia-digits-opencv-version-conflict-2-4-vs-3-0/34211100). When I do that, I get errors like this.

/usr/bin/ld: cannot find -llibopencv_core.so.2.4
/usr/bin/ld: cannot find -llibopencv_highgui.so.2.4
/usr/bin/ld: cannot find -llibopencv_imgproc.so.2.4
/usr/bin/ld: cannot find -llibopencv_imgcodecs.so.2.4
/usr/bin/ld: cannot find -llibopencv_core.so.2.4
/usr/bin/ld: cannot find -llibopencv_highgui.so.2.4
/usr/bin/ld: cannot find -llibopencv_imgproc.so.2.4
collect2: error: ld returned 1 exit status
make: *** [.build_release/test/test_all.testbin] Error 1

Jan C Peters

unread,
Jan 25, 2016, 9:21:52 AM1/25/16
to Caffe Users, raghu...@gmail.com
Seems you are missing boost too.

Well the safest way for the OpenCV problem is to have only one version installed. If you need both, install only one into the standard paths (with your package manager) and install the other manually to some other path (e.g. /usr/local/opencv-3.0). Then use only one of both in the Makefile.config.

Jan

S.Majid Azimi

unread,
Jan 25, 2016, 9:38:53 AM1/25/16
to Jan C Peters, Caffe Users, Raghu Ram
include the pkg-config path for your opencv installation and remove others and also do for ld_library_path

do both of them in your bash file
and check with
$pkg-config --libs opencv
$pkg-config --cflags opencv

to check if you've done correctly.

Raghu Ram

unread,
Jan 27, 2016, 9:29:34 AM1/27/16
to Caffe Users, jcpet...@gmail.com, raghu...@gmail.com
Thanks for the help, but I am ending up with the same errors over and over again. I removed all the versions of OpenCV and reinstalled OpenCV 2.4.9 following the instructions outlined here (http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in-ubuntu-14-04-lts/). Next, I type this in the terminal
 export LD_LIBRARY_PATH =/usr/local/lib and when I run make test, I get the following:

CXX/LD -o .build_release/test/test_all.testbin src/caffe/test/test_caffe_main.cpp

/usr/bin/ld: cannot find -llibopencv_core.so.2.4
/usr/bin/ld: cannot find -llibopencv_highgui.so.2.4
/usr/bin/ld: cannot find -lopencv_imgproc.so.2.4

/usr/bin/ld: cannot find -llibopencv_imgcodecs.so.2.4
/usr/bin/ld: cannot find -llibopencv_core.so.2.4
/usr/bin/ld: cannot find -llibopencv_highgui.so.2.4
/usr/bin/ld: cannot find -llibopencv_imgproc.so.2.4
collect2: error: ld returned 1 exit status
make: *** [.build_release/test/test_all.testbin] Error 1

The output of pkg-config --libs opencv gives me /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so /usr/local/lib/libopencv_viz.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -ltbb -lrt -lpthread -lm -ldl.

Similarly, the output of pkg-config --cflags opencv gives me the following -I/usr/local/include/opencv -I/usr/local/include. From this, I am assuming that opencv installation has gone smoothly and I have followed what you have asked me to do. I did not set the LD_LIBRARY_PATH in a path file, because I came across multiple websites warning against permanently setting the LD_LIBRARY_PATH. Is there something I am not picking up here or doing wrong?

Jan C Peters

unread,
Jan 27, 2016, 10:28:28 AM1/27/16
to Caffe Users, jcpet...@gmail.com, raghu...@gmail.com
Is there a specific reason you compiled opencv from source? If not you should rather stick to the stock version provided by your package manager. On Ubuntu 14.04 this would be the package libopencv-dev. This will install OpenCV 2.4.8. You can do a source build, but then you'll have to provide all the include and lib paths for compilation and linking, and also the respective LD_LIBRARY_PATH when running a program that uses the OpenCV libs. Stock version is much easier in that regard.

As for your problems: the LD_LIBRARY_PATH is not used during compilation and linking, so that export LD_LIBRARY_PATH=... won't do you any good here. It is needed when you are _runnning_ (or loading) a program that uses the opencv libs.

The output that pkg-config gives you is intended to be provided to the compiler (in the case of --cflags) and the linker (in the case of --libs), when compiling and linking some program that wants to use OpenCV.

Conveniently, the pkg-config based inclusion of the OpenCV library is already arranged for you in the Makefile.config of caffe. Just uncomment the USE_PKG_CONFIG := 1 line to make it take effect. The compilation should go smoothly then.

Jan

S Gupta

unread,
Oct 5, 2017, 1:45:01 AM10/5/17
to Caffe Users
Hi Raghu,

Have you found some solution for this issue ? I am also having same error while running make test while i already have installed boost 1.58 .
Thank you in anticipation

Reply all
Reply to author
Forward
0 new messages