Darknet makefile error when opencv=1, ubuntu 18.04

asked 2020-12-08 21:23:12 -0600

ryan227 gravatar image

updated 2020-12-09 06:39:18 -0600

Hi, when i did this command:

sudo apt install libopencv-dev

And then, at the makefile of darknet: Opencv=1 (from opencv=0)

After pressing the make command

I get this:

makefile:176: recipe for target 'darknet' failed make: *** [darknet] error 1

when i do this: pkg-config --modversion opencv

3.4.13

What can i do to resolve this? Thank you.

In the compiler:

make: Warning: File 'Makefile' has modification time 4205 s in the future

chmod +x .sh g++ -std=c++11 -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -DCUDNN_HALF -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -fopenmp -DGPU -DCUDNN -I/usr/local/cudnn/include -DCUDNN_HALF obj/image_opencv.o obj/http_stream.o obj/gemm.o obj/utils.o obj/dark_cuda.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/darknet.o obj/detection_layer.o obj/captcha.o obj/route_layer.o obj/writing.o obj/box.o obj/nightmare.o obj/normalization_layer.o obj/avgpool_layer.o obj/coco.o obj/dice.o obj/yolo.o obj/detector.o obj/layer.o obj/compare.o obj/classifier.o obj/local_layer.o obj/swag.o obj/shortcut_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/rnn.o obj/rnn_vid.o obj/crnn_layer.o obj/demo.o obj/tag.o obj/cifar.o obj/go.o obj/batchnorm_layer.o obj/art.o obj/region_layer.o obj/reorg_layer.o obj/reorg_old_layer.o obj/super.o obj/voxel.o obj/tree.o obj/yolo_layer.o obj/gaussian_yolo_layer.o obj/upsample_layer.o obj/lstm_layer.o obj/conv_lstm_layer.o obj/scale_channels_layer.o obj/sam_layer.o obj/convolutional_kernels.o obj/activation_kernels.o obj/im2col_kernels.o obj/col2im_kernels.o obj/blas_kernels.o obj/crop_layer_kernels.o obj/dropout_layer_kernels.o obj/maxpool_layer_kernels.o obj/network_kernels.o obj/avgpool_layer_kernels.o -o darknet -lm -pthread pkg-config --libs opencv4 2> /dev/null || pkg-config --libs opencv -lgomp -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -L/usr/local/cudnn/lib64 -lcudnn -lstdc++ obj/image_opencv.o: In function load_image_mat_cv': image_opencv.cpp:(.text+0x343): undefined reference tocv::imread(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, int)' obj/image_opencv.o: In function create_window_cv': image_opencv.cpp:(.text+0x1476): undefined reference tocv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, int)' image_opencv.cpp:(.text+0x14d4): undefined reference to cv::moveWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int)' image_opencv.cpp:(.text+0x1534): undefined reference tocv::resizeWindow(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, int, int)' obj/image_opencv.o: In function resize_window_cv': image_opencv.cpp:(.text+0x1757): undefined reference tocv::resizeWindow(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> ... (more)

edit retag flag offensive close merge delete

Comments

you need to show us the actual compile error, not the final notice

berak gravatar imageberak ( 2020-12-09 05:45:28 -0600 )edit
1

Got it, done. I still don't see my problem though.

ryan227 gravatar imageryan227 ( 2020-12-09 07:00:18 -0600 )edit

try to type pkg-config --libs opencv4 and pkg-config --libs opencv on the console, -- it probably did not find any opencv libs there. it would need:

-lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lopencv_videoio -lopencv_highgui
berak gravatar imageberak ( 2020-12-10 02:34:40 -0600 )edit

How do i install these? I dont see some of these

ryan227 gravatar imageryan227 ( 2020-12-10 02:48:54 -0600 )edit

cv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core

ryan227 gravatar imageryan227 ( 2020-12-10 02:52:01 -0600 )edit

-lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dpm -lopencv_highgui -lopencv_videoio -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ml -lopencv_ximgproc -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core

ryan227 gravatar imageryan227 ( 2020-12-10 02:53:05 -0600 )edit

I basically see all of these when i type in these commands

ryan227 gravatar imageryan227 ( 2020-12-10 02:53:30 -0600 )edit