hank-ai / darknet

Darknet/YOLO object detection framework
https://darknetcv.ai/
Apache License 2.0
215 stars 32 forks source link

CMake error 2 building on Linux #64

Open biotom opened 1 month ago

biotom commented 1 month ago

Hello, I'm sorry if I'm missing something obvious here! I tried looking through the FAQs and I couldn't work out what I'm doing wrong. My issue is that I'm following the Linux build instructions in the README, and when trying to run 'make -j4 package', I get an Error 2 from CMake. As a result, there's no darknet-VERSION.deb for the next step. I'm using CMake version 3.29.1. Running 'cmake -DCMAKE_BUILD_TYPE=Release ..' I get: -- Darknet v2.0-196-ga6c3224e -- CUDA detected. Darknet will use the GPU. -- Found cuDNN: /usr/lib/x86_64-linux-gnu/libcudnn.so -- Hardware is 32-bit or 64-bit, and seems to be Intel or AMD: x86_64 -- Found Threads -- Found OpenCV 4.5.4 -- Found OpenMP -- Enabling AVX and SSE optimizations. -- Making an optimized release build. -- Skipping Doxygen (not found) -- Setting up DARKNET OBJ -- Setting up DARKNET LIB -- Setting up DARKNET CLI -- Configuring done (0.1s) -- Generating done (0.0s) -- Build files have been written to: /home/luigi/src/darknet/build which looks sensible to me. Is there anything obvious I'm doing wrong?

stephanecharette commented 1 month ago

Unfortunately, you didn't include the error that you are getting when you run make.

biotom commented 1 month ago

Thank you for the response- I mentioned this on the Discord also, would you prefer I keep things there? Running the cmake step, I get:

`ILD_TYPE=Release .. -- Darknet v2.0-196-ga6c3224e -- The C compiler identification is GNU 11.4.0 -- The CXX compiler identification is GNU 11.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for a CUDA compiler -- Looking for a CUDA compiler - /home/luigi/anaconda3/envs/darknet/bin/nvcc -- CUDA detected. Darknet will use the GPU. -- The CUDA compiler identification is NVIDIA 11.8.89 -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Check for working CUDA compiler: /home/luigi/anaconda3/envs/darknet/bin/nvcc - skipped -- Detecting CUDA compile features -- Detecting CUDA compile features - done -- Found CUDAToolkit: /home/luigi/anaconda3/envs/darknet/include (found version "11.8.89") -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found cuDNN: /usr/lib/x86_64-linux-gnu/libcudnn.so -- Hardware is 32-bit or 64-bit, and seems to be Intel or AMD: x86_64 -- Found Threads -- Found OpenCV: /usr (found version "4.5.4") -- Found OpenCV 4.5.4 -- Found OpenMP -- Enabling AVX and SSE optimizations. -- Making an optimized release build. -- Skipping Doxygen (not found) -- Setting up DARKNET OBJ -- Setting up DARKNET LIB -- Setting up DARKNET CLI -- Configuring done (3.6s) CMake Warning at src-lib/CMakeLists.txt:51 (ADD_LIBRARY): Cannot generate a safe runtime search path for target darknet because files in some directories may conflict with libraries in implicit directories:

runtime library [libgomp.so.1] in /usr/lib/gcc/x86_64-linux-gnu/11 may be hidden by files in:
  /home/luigi/anaconda3/envs/darknet/lib

Some of these libraries may not be found correctly.

CMake Warning at src-cli/CMakeLists.txt:18 (ADD_EXECUTABLE): Cannot generate a safe runtime search path for target darknetcli because files in some directories may conflict with libraries in implicit directories:

runtime library [libgomp.so.1] in /usr/lib/gcc/x86_64-linux-gnu/11 may be hidden by files in:
  /home/luigi/anaconda3/envs/darknet/lib

Some of these libraries may not be found correctly.

`

which results an error at the make step:

/home/luigi/src/darknet/src-lib/parser.cpp:491:54: warning: argument 1 range [18446744071562067968, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=] 491 | classes_multipliers = (float *)calloc(classes_counters, sizeof(float)); | ^ /usr/include/stdlib.h:543:14: note: in a call to allocation function ‘calloc’ declared here 543 | extern void *calloc (size_t __nmemb, size_t __size) | ^ /usr/bin/ld: /lib/x86_64-linux-gnu/libdc1394.so.25: undefined reference tolibusb_get_device_speed' collect2: error: ld returned 1 exit status make[2]: [src-cli/CMakeFiles/darknetcli.dir/build.make:330: src-cli/darknet] Error 1 make[2]: Leaving directory '/home/luigi/src/darknet/build' make[1]: [CMakeFiles/Makefile2:209: src-cli/CMakeFiles/darknetcli.dir/all] Error 2 make[1]: Leaving directory '/home/luigi/src/darknet/build' make: *** [Makefile:159: all] Error 2 `

stephanecharette commented 1 month ago

Did you read the messages that are generated? I'm not sure I can provide any more information than what cmake already provides.

You have 2 libraries with the exact same name. Looks like you are linking against the wrong one.