Error making make using darknet

run this line i get error
#install environment from the Makefile. Changes to mitigate CUDA error.

%cd darknet/

!sed -i ‘s/OPENCV=0/OPENCV=1/g’ Makefile

!sed -i ‘s/GPU=0/GPU=1/g’ Makefile

!sed -i ‘s/CUDNN=0/CUDNN=1/g’ Makefile

!sed -i “s/ARCH= -gencode arch=compute_60,code=sm_60/ARCH= -gencode arch=compute_${compute_capability},code=sm_${compute_capability}/g” Makefile

!make

and this the error

/content/darknet
mkdir -p ./obj/
mkdir -p backup
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 -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/image_opencv.cpp -o obj/image_opencv.o
./src/image_opencv.cpp: In function ‘void draw_detections_cv_v3(void
, detection, int, float, char**, image**, int, int)’:
./src/image_opencv.cpp:910:23: warning: variable ‘rgb’ set but not used [-Wunused-but-set-variable]
910 | float rgb[3];
| ^~~
./src/image_opencv.cpp: In function ‘void cv_draw_object(image, float*, int, int, int*, float*, int*, int, char**)’:
./src/image_opencv.cpp:1391:14: warning: unused variable ‘buff’ [-Wunused-variable]
1391 | char buff[100];
| ^~~~
./src/image_opencv.cpp:1367:9: warning: unused variable ‘it_tb_res’ [-Wunused-variable]
1367 | int it_tb_res = cv::createTrackbar(it_trackbar_name, window_name, &it_trackbar_value, 1000);
| ^~~~~~~~~
./src/image_opencv.cpp:1371:9: warning: unused variable ‘lr_tb_res’ [-Wunused-variable]
1371 | int lr_tb_res = cv::createTrackbar(lr_trackbar_name, window_name, &lr_trackbar_value, 20);
| ^~~~~~~~~
./src/image_opencv.cpp:1375:9: warning: unused variable ‘cl_tb_res’ [-Wunused-variable]
1375 | int cl_tb_res = cv::createTrackbar(cl_trackbar_name, window_name, &cl_trackbar_value, classes-1);
| ^~~~~~~~~
./src/image_opencv.cpp:1378:9: warning: unused variable ‘bo_tb_res’ [-Wunused-variable]
1378 | int bo_tb_res = cv::createTrackbar(bo_trackbar_name, window_name, boxonly, 1);
| ^~~~~~~~~
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 -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/http_stream.cpp -o obj/http_stream.o
In file included from ./src/http_stream.cpp:580:
./src/httplib.h:129: warning: “INVALID_SOCKET” redefined
129 | #define INVALID_SOCKET (-1)
|
./src/http_stream.cpp:73: note: this is the location of the previous definition
73 | #define INVALID_SOCKET -1
|
./src/http_stream.cpp: In member function ‘bool JSON_sender::write(const char*)’:
./src/http_stream.cpp:249:21: warning: unused variable ‘n’ [-Wunused-variable]
249 | int n = _write(client, outputbuf, outlen);
| ^
./src/http_stream.cpp: In member function ‘bool MJPG_sender::write(const cv::Mat&)’:
./src/http_stream.cpp:507:95: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘int’ [-Wformat=]
507 | sprintf(head, “–mjpegstream\r\nContent-Type: image/jpeg\r\nContent-Length: %zu\r\n\r\n”, outlen);
| ~~^ ~~~~~~
| | |
| | int
| long unsigned int
| %u
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/gemm.c -o obj/gemm.o
./src/gemm.c: In function ‘convolution_2d’:
./src/gemm.c:2039:15: warning: unused variable ‘out_w’ [-Wunused-variable]
2039 | const int out_w = (w + 2 * pad - ksize) / stride + 1; // output_width=input_width for stride=1 and pad=1
| ^~~~~
./src/gemm.c:2038:15: warning: unused variable ‘out_h’ [-Wunused-variable]
2038 | const int out_h = (h + 2 * pad - ksize) / stride + 1; // output_height=input_height for stride=1 and pad=1
| ^~~~~
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/utils.c -o obj/utils.o
In file included from /usr/include/string.h:495,
from include/darknet.h:14,
from ./src/utils.h:3,
from ./src/utils.c:4:
In function ‘strncpy’,
inlined from ‘copy_string’ at ./src/utils.c:509:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/utils.c: In function ‘copy_string’:
./src/utils.c:509:22: note: length computed here
509 | strncpy(copy, s, strlen(s)+1);
| ^~~~~~~~~
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/dark_cuda.c -o obj/dark_cuda.o
./src/dark_cuda.c: In function ‘cudnn_check_error_extended’:
./src/dark_cuda.c:224:20: warning: comparison between ‘cudaError_t’ {aka ‘enum cudaError’} and ‘enum ’ [-Wenum-compare]
224 | if (status != CUDNN_STATUS_SUCCESS)
| ^~
./src/dark_cuda.c: In function ‘pre_allocate_pinned_memory’:
./src/dark_cuda.c:276:40: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
276 | printf(“pre_allocate: size = %Iu MB, num_of_blocks = %Iu, block_size = %Iu MB \n”,
| ~~^
| |
| unsigned int
| %Ilu
277 | size / (1024*1024), num_of_blocks, pinned_block_size / (1024 * 1024));
| ~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
./src/dark_cuda.c:276:64: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ {aka ‘const long unsigned int’} [-Wformat=]
276 | printf(“pre_allocate: size = %Iu MB, num_of_blocks = %Iu, block_size = %Iu MB \n”,
| ^
| |
| unsigned int
| %Ilu
277 | size / (10241024), num_of_blocks, pinned_block_size / (1024 * 1024));
| ~~~~~~~~~~~~~
| |
| size_t {aka const long unsigned int}
./src/dark_cuda.c:276:82: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
276 | printf(“pre_allocate: size = %Iu MB, num_of_blocks = %Iu, block_size = %Iu MB \n”,
| ~~^
| |
| unsigned int
| %Ilu
277 | size / (1024
1024), num_of_blocks, pinned_block_size / (1024 * 1024));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
./src/dark_cuda.c:286:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
286 | printf(" Allocated %d pinned block \n", pinned_block_size);
| ~^ ~~~~~~~~~~~~~~~~~
| | |
| int long unsigned int
| %ld
./src/dark_cuda.c: In function ‘cuda_make_array_pinned_preallocated’:
./src/dark_cuda.c:307:43: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
307 | printf("\n Pinned block_id = %d, filled = %f %% \n", pinned_block_id, filled);
| ~^ ~~~~~~~~~~~~~~~
| | |
| int size_t {aka long unsigned int}
| %ld
./src/dark_cuda.c:322:64: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
322 | printf(“Try to allocate new pinned memory, size = %d MB \n”, size / (1024 * 1024));
| ~^ ~~~~~~~~~~~~~~~~~~~~
| | |
| int long unsigned int
| %ld
./src/dark_cuda.c:328:63: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
328 | printf(“Try to allocate new pinned BLOCK, size = %d MB \n”, size / (1024 * 1024));
| ~^ ~~~~~~~~~~~~~~~~~~~~
| | |
| int long unsigned int
| %ld
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/convolutional_layer.c -o obj/convolutional_layer.o
./src/convolutional_layer.c: In function ‘cudnn_convolutional_setup’:
./src/convolutional_layer.c:286:24: error: ‘CUDNN_CONVOLUTION_FWD_PREFER_FASTEST’ undeclared (first use in this function); did you mean ‘CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3’?
286 | int forward_algo = CUDNN_CONVOLUTION_FWD_PREFER_FASTEST;
| ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3
compilation terminated due to -Wfatal-errors.
make: *** [Makefile:162: obj/convolutional_layer.o] Error 1

@Jamilah_Marram_Duart,

It seems you will need to update your Makefile to match the CUDA version.

Thank you!