microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.23k stars 6.4k forks source link

[vcpkg] Could not locate a complete toolset. #12433

Open yHsi opened 4 years ago

yHsi commented 4 years ago

When I want to install a package, the error occured "Could not locate a complete toolset". Some people suggested to install the English language package for vs, but this is useless for me.

MVoz commented 4 years ago

nothing is clear, but very interesting ))

can you describe in more detail?

JackBoosY commented 4 years ago

@yHsi Thanks for reporting this issue! Could you please provide the failure logs?

Thanks.

bio-punk commented 4 years ago

I also have this problem when I use VS2015update3 with English-language-pack on Windows10(1909).

So, How can I find failure log of vcpkg?

JackBoosY commented 4 years ago

@bio-punk please provide the message printed on console.

bio-punk commented 4 years ago

@bio-punk please provide the message printed on console. ok, here is my Console when I try to install opencv3

vcpkg

and vs vs2015 3 vs

PS C:\dev> chcp 65001                                                                                                                                                                                                                                                          Active code page: 65001
PS C:\dev> .\vcpkg\vcpkg install opencv3                                                                                                                                                                                                                                       Computing installation plan...
The following packages will be built and installed:
  * libjpeg-turbo[core]:x86-windows
  * liblzma[core]:x86-windows
  * libpng[core]:x86-windows
  * libwebp[core,nearlossless,simd,unicode]:x86-windows
    opencv3[core,dnn,flann,jpeg,opengl,png,tiff,webp]:x86-windows
  * opengl[core]:x86-windows
  * protobuf[core]:x86-windows
  * tiff[core]:x86-windows
  * zlib[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Could not locate a complete toolset.
The following paths were examined:
PS C:\dev> .\vcpkg\vcpkg install opencv3 --debug                                                                                                                                                                                                                               [DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'manifests' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Using vcpkg-root: C:\dev\vcpkg
[DEBUG] Using installed-root: C:\dev\vcpkg\installed
[DEBUG] Using buildtrees-root: C:\dev\vcpkg\buildtrees
[DEBUG] Using downloads-root: C:\dev\vcpkg\downloads
[DEBUG] Using packages-root: C:\dev\vcpkg\packages
[DEBUG] Using scripts-root: C:\dev\vcpkg\scripts
[DEBUG] Default binary cache path is: C:\Users\wzk\AppData\Local\vcpkg\archives
Computing installation plan...
[DEBUG] Found path: D:\ProgramData\Miniconda3\Scripts\cmake.exe
[DEBUG] Found path: D:\Program Files\Python36\Scripts\\cmake.exe
[DEBUG] Found path: D:\Program Files\CMake\bin\cmake.exe
[DEBUG] CreateProcessW("D:\ProgramData\Miniconda3\Scripts\cmake.exe" --version)
[DEBUG] cmd_execute_and_stream_data() returned 0 after    88017 us
[DEBUG] CreateProcessW("D:\ProgramData\Miniconda3\Scripts\cmake.exe" -DVCPKG_ROOT_DIR=C:/dev/vcpkg -DPACKAGES_DIR=C:/dev/vcpkg/packages -DBUILDTREES_DIR=C:/dev/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=C:/dev/vcpkg/installed -DDOWNLOADS=C:/dev/vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P "C:\dev\vcpkg\buildtrees\0.vcpkg_dep_info.cmake")
[DEBUG] cmd_execute_and_stream_data() returned 0 after    81698 us
[DEBUG] CreateProcessW("D:\ProgramData\Miniconda3\Scripts\cmake.exe" -DVCPKG_ROOT_DIR=C:/dev/vcpkg -DPACKAGES_DIR=C:/dev/vcpkg/packages -DBUILDTREES_DIR=C:/dev/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=C:/dev/vcpkg/installed -DDOWNLOADS=C:/dev/vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P "C:\dev\vcpkg\buildtrees\0.vcpkg_tags.cmake")
[DEBUG] cmd_execute_and_stream_data() returned 0 after    84719 us
The following packages will be built and installed:
  * libjpeg-turbo[core]:x86-windows
  * liblzma[core]:x86-windows
  * libpng[core]:x86-windows
  * libwebp[core,nearlossless,simd,unicode]:x86-windows
    opencv3[core,dnn,flann,jpeg,opengl,png,tiff,webp]:x86-windows
  * opengl[core]:x86-windows
  * protobuf[core]:x86-windows
  * tiff[core]:x86-windows
  * zlib[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Could not locate a complete toolset.
The following paths were examined:
[DEBUG] ..\..\src\vcpkg\visualstudio.cpp(367)
[DEBUG] Exiting after 270262 us (264373 us)
PS C:\dev>                                         
JackBoosY commented 4 years ago

@bio-punk Does your Visual Studio installed in the default path? And please make sure you installed the English Language Package.

bio-punk commented 4 years ago

@bio-punk Does your Visual Studio installed in the default path? And please make sure you installed the English Language Package. No,VS install in D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE

bio-punk commented 4 years ago

@bio-punk Does your Visual Studio installed in the default path? And please make sure you installed the English Language Package. No,VS install in D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE Does VS must install in C:\?

JackBoosY commented 4 years ago

@bio-punk https://github.com/microsoft/vcpkg/blob/ea82e4650890001b6a3177781e0c6096c9e1ca54/toolsrc/src/vcpkg/visualstudio.cpp#L81-L84

gvanem commented 4 years ago

I have the same error:

Could not locate a complete toolset.
The following paths were examined:
    f:\gv\VC_2019\Common7\VC\Auxiliary\Build\vcvarsall.bat
[DEBUG] vcpkg/visualstudio.cpp(367)
[DEBUG] Exiting after 276643 us (276478 us)

And I have the latest MSVC-2019. My vcvarsall.bat is in fact here: f:\gv\vc_2019\VC\Auxiliary\Build\vcvarsall.bat

Why/how does vcpkg look into a path that doesn't exist?

BillyONeal commented 4 years ago

@gvanem That looks like a completely different error since you're talking about a completely different VS. We got the root path f:\gv\VC_2019\Common7 as the output of vswhere.

jonahbeckford commented 3 years ago

To help those of us who have problems detecting VS, can you add --debug statements to (I think) https://github.com/microsoft/vcpkg/blob/2020.11/toolsrc/src/vcpkg/visualstudio.cpp#L191-L345 https://github.com/microsoft/vcpkg-tool/blob/baf0eecbb56ef87c4704e482a3a296ca8e40ddc4/src/vcpkg/visualstudio.cpp#L183-L384 ? Or at least tell us how to do that?

I think it would cut down on the tickets if we had a --debug statement everytime the visualstudio.cpp code rejected a VS instance (or didn't find vswhere.exe, etc).

EDIT: I ended up compiling https://github.com/microsoft/vcpkg-tool and attaching a debugger. My problem was that MSYS2's dash.exe POSIX-compliant shell will not export unusual (perhaps not POSIX compliant) variable names like ProgramFiles(x86). It simply can't be set: dash: 6: export: ProgramFiles(x86): bad variable name. So that environment value was not present, and then the code https://github.com/microsoft/vcpkg-tool/blob/baf0eecbb56ef87c4704e482a3a296ca8e40ddc4/src/vcpkg/base/system.cpp#L302-L313 decides the wrong location. That resulted in checking the vswhere.exe in Program Files rather than Program Files (x86). That failed. I fixed that by using the canonical CSIDL_PROGRAM_FILESX86 to fetch the value.

What would have saved days for me is simply having a --debug statement for the location of vswhere.exe it was using. Same thing goes for whenever visualstudio.cpp rejects a VS instance.

JonLiu1993 commented 1 year ago

@yHsi, sorry for reply you so late, does this issue persist in the latest vcpkg?