Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcpkg install fails, if only VS BuildTools is installed, not full Visual Studio #43156

Open
oleg-boulanov opened this issue Jan 7, 2025 · 5 comments
Assignees
Labels
category:question This issue is a question

Comments

@oleg-boulanov
Copy link

oleg-boulanov commented Jan 7, 2025

vcpkg install fails, if only VS BuildTools is installed, not full Visual Studio

Environment

  • OS: Windows
  • Compiler: Visual Studio BuildTools 2022, Toolset v143
RUN 
    curl -fSLo vs_BuildTools.exe https://aka.ms/vs/17/release/vs_BuildTools.exe `
    && vs_BuildTools.exe modify ^ `
        --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" ^ `
        --includeRecommended ^ `
        --add Microsoft.VisualStudio.Workload.VCTools ^ `
        --add Microsoft.VisualStudio.Component.VC.ATLMFC ^ `
        --add Microsoft.VisualStudio.Workload.VisualStudioExtensionBuildTools ^ `
        --quiet --norestart --nocache --wait `
    && powershell -Command "if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { throw $err }" `

Failure log

15:36:23  C:\j\95df9d\src>curl -LO https://aka.ms/vcpkg-init.cmd   && .\vcpkg-init.cmd
...
15:36:24  Installing vcpkg to C:\Users\ContainerAdministrator\.vcpkg
15:36:24  Downloading 'https://github.com/microsoft/vcpkg-tool/releases/download/2024-12-09/vcpkg.exe' -> 'C:\Users\ContainerAdministrator\.vcpkg\vcpkg.exe'
15:36:25  Bootstrapped vcpkg: C:\Users\ContainerAdministrator\.vcpkg
15:36:25  C:\j\95df9d\src>C:\Users\ContainerAdministrator\.vcpkg\vcpkg.exe --version 
15:36:25  vcpkg package management program version 2024-12-09-1005b78fa1bf1dde1a20c2734cba4ea61ca94d9a
...
15:36:25  C:\j\95df9d\src>C:\Users\ContainerAdministrator\.vcpkg\vcpkg.exe integrate install 
15:36:25  Applied user-wide integration for this vcpkg root.
15:36:25  CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/Users/ContainerAdministrator/.vcpkg/scripts/buildsystems/vcpkg.cmake"
15:36:25  
15:36:25  All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available.
...
15:36:46    Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
15:36:56    A suitable version of cmake was not found (required v3.30.1).
15:36:56    Downloading cmake-3.30.1-windows-i386.zip
15:36:56    Successfully downloaded cmake-3.30.1-windows-i386.zip.
15:36:56    Extracting cmake...
15:36:56    A suitable version of 7zip was not found (required v24.9.0).
15:36:56    Downloading 7z2409.7z.exe
15:36:56    Successfully downloaded 7z2409.7z.exe.
15:36:56    Extracting 7zip...
15:36:56    A suitable version of 7zr was not found (required v24.9.0).
15:36:56    Downloading 44D8504A-7zr.exe
15:36:56    Successfully downloaded 44D8504A-7zr.exe.
----
15:37:01  C:\Users\ContainerAdministrator\.vcpkg\scripts\buildsystems\msbuild\vcpkg.targets(183,5): warning :
  error: in triplet x64-windows: Unable to find a valid Visual Studio instance
15:37:01    Could not locate a complete Visual Studio instance
15:37:01    The following paths were examined for Visual Studio instances:
15:37:01      C:\Program Files (x86)\Microsoft Visual Studio\2022\TestAgent\VC\Auxiliary/Build\vcvarsall.bat
----
15:37:01  C:\Users\ContainerAdministrator\.vcpkg\scripts\buildsystems\msbuild\vcpkg.targets(183,5):
  error MSB3073: The command ""C:\Users\ContainerAdministrator\.vcpkg\vcpkg.exe" install 
 --x-wait-for-lock 
--triplet "x64-windows" 
--vcpkg-root "C:\Users\ContainerAdministrator\.vcpkg\\" "
--x-manifest-root=C:\j\95df9d\src\\" "
--x-install-root=C:\j\95df9d\src\vcpkg_installed\x64-windows\\" "
 exited with code 1.

Root cause
Here: https://github.com/microsoft/vcpkg-tool/blob/f3515102d0ff5f10a13c26ee8d6f2f1c2841e745/src/vcpkg/visualstudio.cpp?plain=1#L138

@oleg-boulanov oleg-boulanov changed the title vcpkg tool can work with BuildTools, requires full Visual Studio installed vcpkg install fails, if only VS BuildTools is installed, not full Visual Studio Jan 7, 2025
@Mengna-Li
Copy link
Contributor

@oleg-boulanov Please try the solutions in #32857 (comment).

@Mengna-Li Mengna-Li added the category:question This issue is a question label Jan 8, 2025
@oleg-boulanov
Copy link
Author

oleg-boulanov commented Jan 8, 2025

@Mengna-Li Thank you for providing a link to possible workaround.
I still think vcpkg can be improved, providing a proper fix.

P.S. Adding Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 did not fix the problem, vcpkg install still fails with the same error

@oleg-boulanov
Copy link
Author

Build after installing all optional components:

vs_BuildTools.exe ... --includeRecommended --includeOptional --add Microsoft.VisualStudio.Workload.VCTools

goes further, but also fails:

09:45:54    Compiler found: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
09:45:54    The following packages will be built and installed:
09:45:54        fmt:[email protected] -- C:\Users\ContainerAdministrator\AppData\Local\vcpkg\registries\git-trees\d8209382ca192426861c6aa91d217ea8512bda46
09:45:54      * vcpkg-cmake:x64-windows@2023-05-04 -- C:\Users\ContainerAdministrator\AppData\Local\vcpkg\registries\git-trees\88a7058fc7fa73a9c4c99cfcae9d79e2abf87a5a
09:45:54      * vcpkg-cmake-config:x64-windows@2022-02-06#1 -- C:\Users\ContainerAdministrator\AppData\Local\vcpkg\registries\git-trees\8d54cc4f487d51b655abec5f9c9c3f86ca83311f
09:45:54    Additional packages (*) will be modified to complete this operation.
09:45:54    Restored 0 package(s) from C:\Users\ContainerAdministrator\AppData\Local\vcpkg\archives in 222 us. Use --debug to see more details.
09:45:54    Installing 1/3 vcpkg-cmake-config:x64-windows@2022-02-06#1...
09:45:54    Building vcpkg-cmake-config:x64-windows@2022-02-06#1...
09:45:54    C:\Users\ContainerAdministrator\AppData\Local\vcpkg\registries\git-trees\8d54cc4f487d51b655abec5f9c9c3f86ca83311f: info: installing overlay port from here
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/vcpkg-port-config.cmake
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/copyright
09:45:54    -- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
09:45:54    Stored binaries in 1 destinations in 33.7 ms.
09:45:54    Elapsed time to handle vcpkg-cmake-config:x64-windows: 97.2 ms
09:45:54    vcpkg-cmake-config:x64-windows package ABI: 61e29c1c76d6e03124a0b3c4320196a6a46cd57a2328a7acf45c74999fcf8de1
09:45:54    Installing 2/3 vcpkg-cmake:x64-windows@2023-05-04...
09:45:54    Building vcpkg-cmake:x64-windows@2023-05-04...
09:45:54    C:\Users\ContainerAdministrator\AppData\Local\vcpkg\registries\git-trees\88a7058fc7fa73a9c4c99cfcae9d79e2abf87a5a: info: installing overlay port from here
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg-port-config.cmake
09:45:54    -- Installing: C:/Users/ContainerAdministrator/.vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/copyright
09:45:54    -- Performing post-build validation
09:45:54    Stored binaries in 1 destinations in 32.5 ms.
09:45:54    Elapsed time to handle vcpkg-cmake:x64-windows: 100 ms
09:45:54    vcpkg-cmake:x64-windows package ABI: 083669ad07d5526e4a0365529cf868189f22707b70ee4f1cebf55f396a1420bb
09:45:54    Installing 3/3 fmt:[email protected]...
09:45:54    Building fmt:[email protected]...
09:45:54    C:\Users\ContainerAdministrator\AppData\Local\vcpkg\registries\git-trees\d8209382ca192426861c6aa91d217ea8512bda46: info: installing overlay port from here
09:45:54    Downloading fmtlib-fmt-10.1.0.tar.gz
09:45:55    Successfully downloaded fmtlib-fmt-10.1.0.tar.gz.
09:45:55    -- Extracting source C:/Users/ContainerAdministrator/.vcpkg/downloads/fmtlib-fmt-10.1.0.tar.gz
09:45:55    -- Applying patch fix-write-batch.patch
09:45:55    -- Applying patch fix-format-conflict.patch
09:45:55    -- Using source at C:/Users/ContainerAdministrator/.vcpkg/buildtrees/fmt/src/10.1.0-95e91156af.clean
09:45:55    -- Configuring x64-windows
09:45:56    CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
09:45:56        Command failed: C:/Users/ContainerAdministrator/.vcpkg/downloads/tools/ninja/1.10.2-windows/ninja.exe -v
09:45:56        Working Directory: C:/Users/ContainerAdministrator/.vcpkg/buildtrees/fmt/x64-windows-rel/vcpkg-parallel-configure
09:45:56        Error code: 1
09:45:56        See logs for more information:
09:45:56          C:\Users\ContainerAdministrator\.vcpkg\buildtrees\fmt\config-x64-windows-dbg-CMakeCache.txt.log
09:45:56          C:\Users\ContainerAdministrator\.vcpkg\buildtrees\fmt\config-x64-windows-rel-CMakeCache.txt.log
09:45:56          C:\Users\ContainerAdministrator\.vcpkg\buildtrees\fmt\config-x64-windows-out.log
09:45:56    
09:45:56    Call Stack (most recent call first):
09:45:56      C:/j/eabb6a/src/vcpkg_installed/x64-windows/x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:252 (vcpkg_execute_required_process)
09:45:56      C:/Users/ContainerAdministrator/AppData/Local/vcpkg/registries/git-trees/d8209382ca192426861c6aa91d217ea8512bda46/portfile.cmake:12 (vcpkg_cmake_configure)
09:45:56      scripts/ports.cmake:196 (include)

@Mengna-Li
Copy link
Contributor

@oleg-boulanov Please provide the failure log, thanks.

@oleg-boulanov
Copy link
Author

@Mengna-Li Unfortunately, I have no means of copying these logs from the container the build runs on.
Adding unnecessary toolsets to address vcpkg issues seems just wrong.

Can we make a feature request to fix vcpkg-tool code to work with VS BuildTools only? This is rather typical scenario in a corporate setup, with build agents not having full Visual Studio installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

2 participants