I've seen many solutions for that problem but no one helped me. I've tried to add opencv_imgcodecs in Makefile, use cmake etc.


CUDA_DIR := /usr/local/cuda
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
        -gencode arch=compute_20,code=sm_21 \
        -gencode arch=compute_30,code=sm_30 \
        -gencode arch=compute_35,code=sm_35 \
        -gencode arch=compute_50,code=sm_50 \
        -gencode arch=compute_52,code=sm_52 \
        -gencode arch=compute_60,code=sm_60 \
        -gencode arch=compute_61,code=sm_61 \
        -gencode arch=compute_61,code=compute_61

BLAS := atlas
PYTHON_INCLUDE := /usr/include/python2.7 \
PYTHON_LIB := /usr/lib
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
Q ?= @

when I execute make all I receive next error in output:

CXX/LD -o .build_release/tools/extract_features.bin
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::String::allocate(unsigned long)'
.build_release/lib/libcaffe.so: undefined reference to `cv::String::deallocate()'
.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&)'
collect2: error: ld returned 1 exit status
Makefile:635: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1

Ubuntu 18.04. That was the last guide I used Here

Judging by the output:

AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
CXX tools/extract_features.cpp
CXX/LD -o .build_release/tools/extract_features.bin
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'

it seems that we are going to dynamic library libcaffe.so and right after we use it to interact with extract_features.bin. If you were to learn what libcaffe.so compiled from, perhaps it would be possible to include an OpenCV connection in any of the source files. But how to determine the source files for creating libcaffe.so I cannot understand. I tried to look in the Makefile, feeling as if he was obfuscated, nothing is clear.

0 Answers