.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode
monajalal opened this issue ยท 15 comments
I get this error:
CXX examples/mnist/convert_mnist_data.cpp
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc3
/usr/bin/ld: cannot find -lcudnn
collect2: error: ld returned 1 exit status
Makefile:554: recipe for target '.build_release/lib/libcaffe.so.1.0.0-rc3' failed
Hence:
jalal@klein:~/computer_vision/py-faster-rcnn/caffe-fast-rcnn$ sudo cp -r /home/jalal/cudnn/cuda/lib64/* /usr/local/cuda/lib64
jalal@klein:~/computer_vision/py-faster-rcnn/caffe-fast-rcnn$ ls
build cmake CONTRIBUTING.md data docs include LICENSE Makefile.config matlab python scripts tools
caffe.cloc CMakeLists.txt CONTRIBUTORS.md distribute examples INSTALL.md Makefile Makefile.config.example models README.md src
jalal@klein:~/computer_vision/py-faster-rcnn/caffe-fast-rcnn$ make -j8 && make pycaffe
LD -o .build_release/lib/libcaffe.so.1.0.0-rc3
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/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/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 `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::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 `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
Makefile:607: recipe for target '.build_release/tools/compute_image_mean.bin' failed
make: *** [.build_release/tools/compute_image_mean.bin] Error 1
make: *** Waiting for unfinished jobs....
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::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 `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
Makefile:607: 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/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::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 `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
Makefile:607: recipe for target '.build_release/tools/convert_imageset.bin' failed
make: *** [.build_release/tools/convert_imageset.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::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 `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
Makefile:607: 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 `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::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 `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
Makefile:607: 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 `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::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 `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
Makefile:607: recipe for target '.build_release/tools/upgrade_solver_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_solver_proto_text.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::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 `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
Makefile:607: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1
jalal@klein:~/computer_vision/py-faster-rcnn/caffe-fast-rcnn$ ls /usr/local/cuda/lib64
libcublas_device.a libcudnn.so libcufftw.so.7.5.18 libcusolver.so libnppc.so.7.5.18 libnvblas.so libnvToolsExt.so.1
libcublas.so libcudnn.so.4 libcufftw_static.a libcusolver.so.7.5 libnppc_static.a libnvblas.so.7.5 libnvToolsExt.so.1.0.0
libcublas.so.7.5 libcudnn.so.4.0.7 libcuinj64.so libcusolver.so.7.5.18 libnppi.so libnvblas.so.7.5.18 libOpenCL.so
libcublas.so.7.5.18 libcudnn_static.a libcuinj64.so.7.5 libcusolver_static.a libnppi.so.7.5 libnvrtc-builtins.so stubs
libcublas_static.a libcufft.so libcuinj64.so.7.5.18 libcusparse.so libnppi.so.7.5.18 libnvrtc-builtins.so.7.5
libcudadevrt.a libcufft.so.7.5 libculibos.a libcusparse.so.7.5 libnppi_static.a libnvrtc-builtins.so.7.5.18
libcudart.so libcufft.so.7.5.18 libcurand.so libcusparse.so.7.5.18 libnpps.so libnvrtc.so
libcudart.so.7.5 libcufft_static.a libcurand.so.7.5 libcusparse_static.a libnpps.so.7.5 libnvrtc.so.7.5
libcudart.so.7.5.18 libcufftw.so libcurand.so.7.5.18 libnppc.so libnpps.so.7.5.18 libnvrtc.so.7.5.17
libcudart_static.a libcufftw.so.7.5 libcurand_static.a libnppc.so.7.5 libnpps_static.a libnvToolsExt.so
jalal@klein:~/computer_vision/py-faster-rcnn/caffe-fast-rcnn$ ls -ltr /usr/local/cuda/lib64
lrwxrwxrwx 1 root root 24 Aug 15 2015 /usr/local/cuda/lib64 -> targets/x86_64-linux/lib
I have Cuda7.5 and CuDNN V4 on Ubuntu 15.10 64bit. I have Python 3 and OpenCV3 (for Python) Installed!
Not sure if the correct solution but seemingly works:
add the second line in the Makefile:
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 \
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
Hi @monajalal Have you noticed the 21st line in Makefile.config.example which is
# OPENCV_VERSION := 3
To use OpenCV 3.X with Caffe, you should uncomment this line. You can refer to the 197th line in Makefile for the reason.
Please ask installation questions on the mailing list. If you're having trouble, you might want to try the Caffe Dockerfile to take care of installation for you.
From https://github.com/BVLC/caffe/blob/master/CONTRIBUTING.md:
Please do not post usage, installation, or modeling questions, or other requests for help to Issues.
Use the caffe-users list instead. This helps developers maintain a clear, uncluttered, and efficient view of the state of Caffe.
@xmfbit Hello! I get this error , please give me a help. Thank you!
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc5
/usr/bin/ld: cannot find -lopencv_imgcodecs
collect2: error: ld returned 1 exit status
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc5] Error 1
aicrobo@aicrobo:~/py-faster-rcnn/caffe-fast-rcnn$
@monajalal Hello! I get this error , please give me a help. Thank you!
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc5
/usr/bin/ld: cannot find -lopencv_imgcodecs
collect2: error: ld returned 1 exit status
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc5] Error 1
aicrobo@aicrobo:~/py-faster-rcnn/caffe-fast-rcnn$
@donghongwen Please ask installation questions on the mailing list. For your problem, I think maybe you are using OpenCV2.X, and you enabled OPENCV_VERSION := 3
@xmfbit thank you! I have commanded OPENCV_VERSION := 3, but the error is still there
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc5
/usr/bin/ld: cannot find -lopencv_imgcodecs
collect2: error: ld returned 1 exit status
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc5] Error 1
aicrobo@aicrobo:~/py-faster-rcnn/caffe-fast-rcnn$
@donghongwen Try make clean before you build the project.
make all -j4
LD -o .build_release/lib/libcaffe.so.1.0.0-rc5
clang: warning: argument unused during compilation: '-pthread'
ld: library not found for -lboost_python3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc5] Error 1
Any idea why this is happening?
I think the reason is you use make
to compile, which makes caffe's python port only find libraries in this catalog. Maybe you use cmake
to compile and it could work.
make clean
cd caffe-master
mkdir build
cd build
cmake ..
make all -j8
I hope I could help you!
@donghongwen hello i meet the same problem with you, do you know how to solve it now?
I have a similar problem:
CMU-Perceptual-Computing-Lab/caffe_train#16
The thing is that in my case is I am using OpenCV 2.7
??
Uncomment the following line in Makfile.config
USE_PKG_CONFIG := 1
Add the following line to your ~/.bashrc
PKG_CONFIG_PATH=/home/opencv/build/unix-install
OR wherever the configuration of your opencv is. The name of Opencv configuration file is opencv.pc.
This solved the issue for me.
if use Makefile for 1.0.0-RC, and add USE_PKG_CONFIG=1 at the top of Makefile, it works to me when I have different version , opencv2 and 3 .