AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.8k stars 7.97k forks source link

gl headers before including cuda_gl_interop.h #8883

Open SheldonWBM opened 9 months ago

SheldonWBM commented 9 months ago

I am trying to use the latest version (commit: 27b37bf) of Darknet on the Jetson Xavier AGX. image image

Upgraded both CUDA and OpenCV (as per the above screenshots). When I try to build, using cmake, I have the following error.

In file included from /home/<user>/darknet/src/dark_cuda.h:38,
                 from /home/<user>/darknet/src/activations.h:4,
                 from /home/<user>/darknet/src/activation_layer.h:4,
                 from /home/<user>/darknet/src/activation_layer.c:1:
/usr/local/cuda-12.3/targets/sbsa-linux/include/cuda_gl_interop.h:63:2: error: #error Please include the appropriate gl headers before including cuda_gl_interop.h
   63 | #error Please include the appropriate gl headers before including cuda_gl_interop.h
      |  ^~~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [CMakeFiles/darknet.dir/build.make:90: CMakeFiles/darknet.dir/src/activation_layer.c.o] Error 1

I also have an error when I try make. I have tried both within a docker container and directly on the host.

The previous version of darknet, commit: 59c8622, is still working properly (in a docker container with cuda 11.7).

cenit commented 7 months ago

looks like a bug in the cuda_gl_interop.h distributed on your system? what if you apply this patch?

diff --git a/src/dark_cuda.h b/src/dark_cuda.h
index ffe3836b..fad213c1 100644
--- a/src/dark_cuda.h
+++ b/src/dark_cuda.h
@@ -34,7 +34,7 @@ extern int gpu_index;
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif // _WIN32
-
+#include <GL/gl.h>
 #include <cuda_gl_interop.h>
 #endif // CUDA_OPENGL_INTEGRATION
 //#include <driver_types.h>