AlexeyAB / darknet

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

Error while building darknet #6893

Open Rutvik21 opened 3 years ago

Rutvik21 commented 3 years ago

When I run command .\build.ps1, I get the following error in powershell.

Found vcpkg in VCPKG_ROOT: F:\Computer_Vision\Yolov4_Ear_Detection\vcpkg Found VS in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community Visual Studio Command Prompt variables set Setting up environment to use CMake generator: Visual Studio 15 2017 Added missing env variable CUDA_TOOLKIT_ROOT_DIR Added missing env variable CUDACXX

Directory: F:\Computer_Vision\Yolov4_Ear_Detection\darknet

Mode LastWriteTime Length Name


d----- 30-10-2020 16:44 build_win_release -- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.19041. -- The C compiler identification is MSVC 19.15.26726.0 -- The CXX compiler identification is MSVC 19.15.26726.0 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx64/x64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx64/x64/cl.exe -- broken CMake Error at C:/Program Files/Python37/Lib/site-packages/cmake/data/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message): The C compiler

"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx64/x64/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: F:/Computer_Vision/Yolov4_Ear_Detection/darknet/build_win_release/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe cmTC_1e670.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=15.0 /v:m && Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x64
  testCCompiler.c
  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /Zi /W3 /WX- /diagnostics:classic /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_1e670.dir\Debug\\" /Fd"cmTC_1e670.dir\Debug\vc141.pdb" /Gd /TC /errorReport:queue F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\testCCompiler.c

  cmTC_1e670.vcxproj -> F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\Debug\cmTC_1e670.exe
  '_VCPKG_PWSH_PATH-NOTFOUND' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: The command "setlocal [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: _VCPKG_PWSH_PATH-NOTFOUND -noprofile -executionpolicy Bypass -file F:/Computer_Vision/Yolov4_Ear_Detection/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary F:/Computer_Vision/Yolov4_Ear_Detection/darknet/build_win_release/CMakeFiles/CMakeTmp/Debug/cmTC_1e670.exe -installedDir F:/Computer_Vision/Yolov4_Ear_Detection/vcpkg/installed/x64-windows/debug/bin -OutVariable out [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmEnd [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmErrorLevel [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: exit /b %1 [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmDone [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :VCEnd" exited with code 9009. [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\CMakeFiles\CMakeTmp\cmTC_1e670.vcxproj]

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:28 (project)

-- Configuring incomplete, errors occurred! See also "F:/Computer_Vision/Yolov4_Ear_Detection/darknet/build_win_release/CMakeFiles/CMakeOutput.log". See also "F:/Computer_Vision/Yolov4_Ear_Detection/darknet/build_win_release/CMakeFiles/CMakeError.log". Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist. Switch: install.vcxproj Remove-Item : Cannot find path 'F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\DarknetConfig.cmake' because it does not exist. At F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build.ps1:198 char:3

Remove-Item : Cannot find path 'F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\DarknetConfigVersion.cmake' because it does not exist. At F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build.ps1:199 char:3

Get-ChildItem : Cannot find path 'F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\Release' because it does not exist. At F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build.ps1:200 char:15

Copy-Item : Could not find a part of the path 'F:\Computer_Vision\Yolov4_Ear_Detection\darknet\share\darknet\'. At F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build.ps1:205 char:3

Here I am attaching two files, CMakeError.log and CMakeError.log. CMakeOutput.log CMakeError.log

Ni-Wo commented 3 years ago

I'm facing the same issue. Have you found a solution meanwhile?

not-matthias commented 3 years ago

I had the same issue. I reinstalled vcpkg and installed darknet with it: vcpkg install darknet[full]:x64-windows

ghost commented 3 years ago

I'm have the same issue. Did anyone find a solution please ?

AlexeyAB commented 3 years ago

@cenit Hi, Do you know the reason of this issue?

ghost commented 3 years ago

@AlexeyAB Since I have you on this issue. First of all, Thank you for the work you have done. Here's the error I get when I build darknet :

  darknet.vcxproj -> C:\Users\____\Documents\GitHub\darknet\build_win_release_novcpkg\Release\darknet.exe
Copy-Item : Impossible de trouver une partie du chemin d'accès 'C:\Users\____\Documents\GitHub\darknet\share\darknet\'.
Au caractère C:\Users\____\Documents\GitHub\darknet\build.ps1:228 : 3
+   Copy-Item cmake\Modules\*.cmake share\darknet\
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand

Here's the environment I'm working with :

OS : Windows 10
CUDA : 10.1 (with compatible CUDNN of course)
Visual Studio 2017
GPU : NVIDIA GeForce RTX 2060

I built darknet using vcpkg as was recommended in the README file.

I tried to create the folder C:\Users\____\Documents\GitHub\darknet\share\darknet\ manually and re-built darknet. The error didn't come up, the build was ended and darknet.exe wasn't created. I did encounter another error during the build : nvcc fatal : Unknown option 'pthread'. I don't know if they are related but I decided to mention it anyway.

PS : I tried building with CMAKE but it keeps telling me CUDA wasn't found.

Your help will be much appreciated. Thank you.

AlexeyAB commented 3 years ago

Can you show screenshot of Top-menu in MSVS?

If you don't see Nsight then you installed MSVS after CUDA installation. Try to re-install CUDA again.

image

ghost commented 3 years ago

Can you show screenshot of Top-menu in MSVS?

If you don't see Nsight then you installed MSVS after CUDA installation. Try to re-install CUDA again.

image

I have installed Nsight and CUDA properly. Here's the capture you asked for:

Capture d’écran 2021-01-09 192608
AlexeyAB commented 3 years ago

PS : I tried building with CMAKE but it keeps telling me CUDA wasn't found.

ghost commented 3 years ago

For privacy reasons I had to hide some stuff but the variables as set as shown in the image above.

AlexeyAB commented 3 years ago
ghost commented 3 years ago
  • Do you have C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin; in the Windows system variable Path ?

No, I only have CUDA_PATH set. I didn't add it to Path

  • Do you have nvcc.exe in the C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin ?

Yes, I do.

  • Do you have only one version MSVS 2017?

I had MSVC 2019 previously and I had to uninstall it because apparently it wasn't compatible with CUDA 10.1 and then I installed the 2017 community version. And yes I think I only have one version of MSVS 2017 (I only installed it once)

  • What is your Cmake version?

It's CMake 3.19.2

AlexeyAB commented 3 years ago

Add this C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin; at the begining of the Windows system variable Path and try to use Cmake again

ghost commented 3 years ago

Sorry for the late reply. I did it and used CMake again but it gave the exact same result. I even deleted the repository and re-cloned it again and nothing changed😕.

When I ran nvcc.exe --version seperately I get the correct result. So, the issue isn't whether the program can run nvcc.exe command or not. I'm very confused.

cenit commented 3 years ago

You might have to update vcpkg. Go to the vcpkg folder and do a

git pull
.\bootstrap-vcpkg.bat
.\vcpkg upgrade --no-dry-run
ghost commented 3 years ago

update vcpkg. Go to the vcpkg folder and do a

I did and it said it was already up-to-date. I did re-build after that but I had the same issue.

cenit commented 3 years ago

can you please git pull in darknet and re-try launching .\build.ps1 ? Thanks