Build errors, undefined cv::imread() cv::imencode() ...
Any ideas?
Scotts-iMac:caffe-master scottkrig$ make all
LD -o .build_release/lib/libcaffe.so
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/opt/local/lib'
Undefined symbols for architecture x86_64:
"cv::imread(std::__1::basic_string<char, std::__1::char_traits
See my answer in #2286. Seems like libc++ related problem.
Please ask on the caffe-users group.
@sakrig I have the same problem, but it is solved after using cmake to configure your project.
.build_release/lib/libcaffe-nv.so: undefined reference to cv::imread(cv::String const&, int)' .build_release/lib/libcaffe-nv.so: undefined reference tocv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator
change Makefile:
LIBRARIES += glog gflags protobuf leveldb snappy
lmdb boost_system hdf5_hl hdf5 m
opencv_core opencv_highgui opencv_imgproc
add :opencv_imgcodecs solve my problem
@northeastsquare I'm having the same issue. When I add opencv_imgcodec, I get the following error: /usr/bin/ld: warning: libopencv_core.so.3.0, needed by /opt/lib/libopencv_imgcodecs.so, may conflict with libopencv_core.so.2.4
@fabioperez Had the same issue. For me, uninstalling opencv-3.0.0 (using a make uninstall) and installing opencv-2.4.11, followed by building caffe again worked.
It seems like sticking to opencv-<2.4.11 is a good option for now.
Try to use Cmake build
add opencv_imgcodecs to LIBRARIES in Makefile solved my problems too
@northeastsquare oh! thank you !! it's work !
i solved this problem by adding -lopencv_imgcodecs to my makefile as follows OPCV = -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_features2d -lopencv_flann -lopencv_imgproc -lopencv_imgcodecs
and the $(OPCV) must be placed after the objects needing them
cmake solved it for me!!!
oh sorry.. i'm late
2015-10-22 10:22 GMT+09:00 colek42 [email protected]:
cmake solved it for me!!!
— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/2288#issuecomment-150070651.
@bhack : how does one do it?!
@northeastsquare,Thanks to you,I have solved the problem used your method.
same here! Thanks for the help!
@northeastsquare : thank you. It worked
Hey make all worked fine. But when I ran make test it gave mountain of errors.
..build_release/src/caffe/test/test_image_data_layer.obuild_release/src/caffe/:test/test_layer_factory.o In: functionIn function caffe:caffe:MakeTempDir::(stdLayerFactoryTest_TestCreateLayer_Test::<caffestring*::)'GPUDevice<:
double>test_image_data_layer.cpp >:(::.TestBodytext._ZN5caffe11MakeTempDirEPSs[()_ZN5caffe11MakeTempDirEPSs':]+
test_layer_factory.cpp0x49):(: .undefined text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEvreference [to_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEv] boost+0x7eb::):filesystem: undefined:detail reference:: totemp_directory_path(boost:boost::system:filesystem::::error_code_detail:)':temp_directory_path
test_image_data_layer.cpp(boost:(::.text._ZN5caffe11MakeTempDirEPSssystem:[ZN5caffe11MakeTempDirEPSs:error_code]+)0x5f)'
: test_layer_factory.cpp:undefined (reference.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEv to[ _ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEv]boost+0x809::):filesystem: undefined:path reference:: tooperator/=(boost:boost::filesystem:filesystem::::path:path :operatorconst&/=)'
(boosttest_image_data_layer.cpp:::(filesystem:.text._ZN5caffe11MakeTempDirEPSs:path[ZN5caffe11MakeTempDirEPSs const]+&)0xe4)'
: test_layer_factory.cppundefined :(reference .to text.ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEv[boost_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEv::]+filesystem:0x8a7):detail: ::undefined unique_path(reference boost:to :filesystemboost::::path filesystem:const&:detail, ::boost:unique_path(:systemboost::::filesystemerror_code::)'path
test_image_data_layer.cppconst&:(, .boost:text.ZN5caffe11MakeTempDirEPSs[:system_ZN5caffe11MakeTempDirEPSs]::+0x112error_code):)' undefined
test_layer_factory.cpp reference:( to. text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEvboost:[:_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIdEEE8TestBodyEv]filesystem:+0x8d1:detail)::: undefinedcreate_directory( referenceboost: to:filesystem::boost:path :filesystemconst&::, boostdetail::::create_directorysystem:(boost:error_code::)filesystem:'
:path.build_release const/src&,/caffe boost/test::/test_image_data_layer.osystem:: :error_codeIn )function '
caffe.build_release::/srcMakeTempFilename(/caffestd:/test:string/test_layer_factory.o_): ':In test_image_data_layer.cppfunction :(caffe.text._ZN5caffe16MakeTempFilenameEPSs::[_ZN5caffe16MakeTempFilenameEPSsLayerFactoryTest_TestCreateLayer_Test<]+caffe:0x87):GPUDevice: boost)'::: test_layer_factory.cppfilesystem::(:path.::text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEvcodecvt([)_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEv]' +0x7ebtest_image_data_layer.cpp:):(. undefinedtext._ZN5caffe16MakeTempFilenameEPSs[ reference_ZN5caffe16MakeTempFilenameEPSs to]+ 0x334)boost:: :filesystemundefined ::reference detail:to :temp_directory_pathboost(boost::::filesystem:system::path:error_code::_)operator/' =(test_layer_factory.cppboost::(:filesystem.::text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEv[path _ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEvconst&]+)'0x809) : undefined reference to boost::filesystem::path::operator/=(boost::filesystem::path const&)'
test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEv]+0x8a7): undefined reference toboost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code_)' test_layer_factory.cpp:(.text._ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEv[_ZN5caffe37LayerFactoryTest_TestCreateLayer_TestINS_9GPUDeviceIfEEE8TestBodyEv]+0x8d1): undefined reference to boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_codecaffe::LayerFactoryTest_TestCreateLayer_Testcaffe::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 toboost::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 toboost::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::CPUDeviceboost::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 toboost::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)'
collect2: error: ld returned 1 exit status
LD .build_release/src/caffe/test/test_protobuf.o
LD .build_release/src/caffe/test/test_random_number_generator.o
collect2: error: ld returned 1 exit status
LD .build_release/src/caffe/test/test_pooling_layer.o
LD .build_release/src/caffe/test/test_threshold_layer.o
make: *** [.build_release/test/test_image_data_layer.testbin] Error 1
make: *** Waiting for unfinished jobs....
make: *** [.build_release/test/test_layer_factory.testbin] Error 1
Please ask installation queries on caffe-users.
It looks like you don't have boost linked. Try reinstalling boost and linking it again.
I had to link boost_filesystem in the libraries in make file. Now its working. Thank you