Добрый день, возникла проблема при сборке проекта с opencv. При установке билдрута использовал gst_config и с помощью make menuconfig поставил галочку opencv4, больше никаких действий с библиотекой не производил. При сборке выдает следующее сообщение:
arm-none-linux-gnueabihf-g++: предупреждение: /: входные файлы компоновки не использованы, поскольку компоновка не выполнялась
/home/vlad/starterkit/buildroot-2021.08-sk/output/host/bin/arm-none-linux-gnueabihf-g++ OBJ/*.o -o object_detector -lm -lpthread -lasound -lpng -ljpeg -lturbojpeg -lg2d -lopencv_core
/home/vlad/starterkit/buildroot-2021.08-sk/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-none-linux-gnueabihf/10.2.1/../../../../arm-none-linux-gnueabihf/bin/ld: OBJ/Object_detector.o: in function `draw_label(cv::Mat&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int)':
Object_detector.cpp:(.text+0x130): undefined reference to `cv::getTextSize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, double, int, int*)'
/home/vlad/starterkit/buildroot-2021.08-sk/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-none-linux-gnueabihf/10.2.1/../../../../arm-none-linux-gnueabihf/bin/ld: Object_detector.cpp:(.text+0x178): undefined reference to `cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
/home/vlad/starterkit/buildroot-2021.08-sk/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-none-linux-gnueabihf/10.2.1/../../../../arm-none-linux-gnueabihf/bin/ld: Object_detector.cpp:(.text+0x1c2): undefined reference to `cv::putText(cv::_InputOutputArray const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)'
И дальше ошибки 'undefined reference to' к разным функциям.
collect2: ошибка: выполнение ld завершилось с кодом возврата 1
Makefile:29: recipe for target 'all' failed
Makefile выглядит следующим образом:
BRDIR ?= /home/vlad/starterkit/buildroot-2021.08-sk
TOOLSROOT = $(BRDIR)/output/host
TOOLS = $(TOOLSROOT)/bin/arm-none-linux-gnueabihf-
CROSS=$(TOOLS)
TARGET=object_detector
CC=$(CROSS)gcc
CPP=$(CROSS)g++
STRIP=$(CROSS)strip
OCV_DIR ?= /home/vlad/starterkit/buildroot-2021.08-sk/output/build/opencv4-4.5.3/include
OCV_DNN ?= /home/vlad/starterkit/buildroot-2021.08-sk/output/build/opencv4-4.5.3/modules/dnn/include
MOD_DIR ?= /home/vlad/starterkit/buildroot-2021.08-sk/output/build/opencv4-4.5.3/buildroot-build
COR_DIR ?= /home/vlad/starterkit/buildroot-2021.08-sk/output/build/opencv4-4.5.3/modules/core/include
IMGPROC_DIR ?= /home/vlad/starterkit/buildroot-2021.08-sk/output/build/opencv4-4.5.3/modules/imgproc/include
VIDEOIO_DIR ?= /home/vlad/starterkit/buildroot-2021.08-sk/output/build/opencv4-4.5.3/modules/videoio/include
HIGGUI_DIR ?= /home/vlad/starterkit/buildroot-2021.08-sk/output/build/opencv4-4.5.3/modules/highgui/include
CFLAGS = -O3 -g0 -I$(OCV_DIR)/ -I$(OCV_DNN)/ -I$(MOD_DIR)/ -I$(COR_DIR)/ -I$(IMGPROC_DIR)/ -I$(VIDEOIO_DIR)/ -I$(HIGGUI_DIR)/ -fomit-frame-pointer -Wall -fno-strict-aliasing
LIBS = -lm -lpthread -lasound -lpng -ljpeg -lturbojpeg -lg2d -lopencv_core
INCLUDE=
OBJS= OBJ/
all:
$(CPP) $(CFLAGS) -c Object_detector.cpp -o $(OBJS)Object_detector.o -fno-rtti -fno-exceptions -std=c++11
$(CPP) $(OBJS)*.o -o $(TARGET) $(LIBS)
$(STRIP) $(TARGET)
clean:
rm *.o $(OBJS)*.o $(TARGET)
Библиотеки в .cpp файле подключаю следующим образом:
#include <iostream>
#include <fstream>
#include <opencv2/dnn.hpp>
#include <opencv2/dnn/all_layers.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
В чем может быть проблема? |