darknet icon indicating copy to clipboard operation
darknet copied to clipboard

gl headers before including cuda_gl_interop.h

Open SheldonWBM opened this issue 4 months ago • 1 comments

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).

SheldonWBM avatar Feb 11 '24 21:02 SheldonWBM

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>

cenit avatar May 06 '24 11:05 cenit