yapch@ywc:~$ echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
PKG_CONFIG_PATH=
yapch@ywc:~$ echo PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ cd /usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:/usr/lib/x86_64-linux-gnu/pkgconfig$ ls
IlmBase.pc libavformat.pc libdeflate.pc libjpeg.pc libpng16.pc libtiff-4.pc python-3.10-embed.pc tbb.pc
OpenEXR.pc libavutil.pc libexif.pc liblzma.pc libraw1394.pc libtirpc.pc python-3.10.pc zlib.pc
expat.pc libcrypt.pc libgphoto2.pc libnsl.pc libswresample.pc libxcrypt.pc python3-embed.pc
libavcodec.pc libdc1394-2.pc libgphoto2_port.pc libpng.pc libswscale.pc opencv4.pc python3.pc
yapch@ywc:/usr/lib/x86_64-linux-gnu/pkgconfig$ cd ~
yapch@ywc:~$ cd yolo/darknet/
yapch@ywc:~/yolo/darknet$ make
nvcc -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda-12.3/include/ --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU" --compiler-options "-std=c++11" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
I have tried multiple times and I am still not sure how to solve this. The path was correct but it was not detected still?
The pkg-config file is called opencv4.pc
per your ls
output so change your Makefile to say pkg-config --cflags opencv4
. If it is defined as a variable you may be able to override it on the command line.