Skip to content

Conversation

@iquarobotics
Copy link

When mini_chromium searches for an MSVC installation via vswhere.exe, it currently defaults to searching for standard IDE installations (like Community or Professional). This causes the search to fail if only the Visual Studio Build Tools are installed.

By adding the -products * flag to the vswhere invocation, all compatible products—including Build Tools—are correctly identified. This ensures crashpad can be compiled in environments without a full IDE installation.

apalomer-iqua and others added 2 commits January 27, 2026 16:03
Added -products * for mini_chromium in crashpad when looking for mscv…
@iquarobotics
Copy link
Author

@microsoft-github-policy-service agree company="Iqua Robotics"

@vicroms vicroms changed the title Update vswhere arguments to include MSVC Build Tools in mini_chromium [crashpad] Update vswhere arguments to include MSVC Build Tools in mini_chromium Jan 28, 2026
if os.path.exists(vswhere_path):
installation_path = subprocess.check_output(
- [vswhere_path, '-latest', '-property', 'installationPath']).strip()
+ [vswhere_path, '-products', '*', '-latest', '-property', 'installationPath']).strip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that crashpad ignores the compiler set by the vcpkg toolchain entirely?

Copy link

@apalomer-iqua apalomer-iqua Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference with this line is that, if the win_helper.py from mini_chromium tries to automatically look for the installed compiler, it also checks if build tools are there.
I found this problem while generating a windows docker image where I installed visual studio build tools instead of community edition. There the build failed for crashpad because the compiler was not found. So I guess it was not event taking the defined compiler earlier?
This is a dockerfile for testing:

# docker build -f DockerfileWindows -t vcpkg_test .
# Use a machine from microsoft
FROM mcr.microsoft.com/windows:20H2

# Set shell to PowerShell for easier installation scripts
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install Chocolatey
RUN Set-ExecutionPolicy Bypass -Scope Process -Force ; \
    [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 ; \
    iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# Install Build Tools (VS 2019), CMake, and Git
RUN $env:Path += ';' + $env:ALLUSERSPROFILE + '/chocolatey/bin' ; \
    choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' ; \
    choco install -y git ; \
    choco install -y visualstudio2019-workload-vctools

# Install vcpkg for package management
# Add vcpkg to path and define vcpkg root
RUN git clone https://github.com/microsoft/vcpkg.git ; \
    .\vcpkg\bootstrap-vcpkg.bat ;\
    $vcpkgPath = 'C:\vcpkg' ; \
    [Environment]::SetEnvironmentVariable('VCPKG_ROOT', $vcpkgPath, 'Machine') ; \
    $currentPath = [Environment]::GetEnvironmentVariable('Path', 'Machine') ; \
    $updatedPath = $currentPath + ';' + $vcpkgPath  ; \
    [Environment]::SetEnvironmentVariable('Path', $updatedPath, 'Machine')

Then, using this docker (docker run --rm -it vcpkg_test powershell) I try to install crashpad and fails:

vcpkg install crashpad --triplet x64-windows
Computing installation plan...
The following packages will be built and installed:
    crashpad:x64-windows@2024-04-11#9
  * vcpkg-cmake:x64-windows@2024-04-23
  * vcpkg-cmake-get-vars:x64-windows@2025-05-29
  * vcpkg-get-python-packages:x64-windows@2025-04-05
  * vcpkg-gn:x64-windows@2025-08-05
  * vcpkg-tool-gn:x64-windows@2025-08-05#1
  * zlib:x64-windows@1.3.1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
A suitable version of powershell-core was not found (required v7.5.4).
Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/PowerShell-7.5.4-win-x64.zip -> PowerShell-7.5.4-win-x64.zip
Successfully downloaded PowerShell-7.5.4-win-x64.zip
Extracting powershell-core...
A suitable version of 7zip was not found (required v25.1.0).
Downloading https://github.com/ip7z/7zip/releases/download/25.01/7z2501.exe -> 7z2501.7z.exe
Successfully downloaded 7z2501.7z.exe
Extracting 7zip...
A suitable version of 7zr was not found (required v25.1.0).
Downloading https://github.com/ip7z/7zip/releases/download/25.01/7zr.exe -> 7d84fcad-7zr.exe
Successfully downloaded 7d84fcad-7zr.exe
Compiler found: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from C:\Users\ContainerAdministrator\AppData\Local\vcpkg\archives in 168 us. Use --debug to see more details.
Installing 1/7 vcpkg-cmake:x64-windows@2024-04-23...
Building vcpkg-cmake:x64-windows@2024-04-23...
-- Installing: C:/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
-- Installing: C:/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake
-- Installing: C:/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake
-- Installing: C:/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg-port-config.cmake
-- Installing: C:/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/copyright
-- Performing post-build validation
Starting submission of vcpkg-cmake:x64-windows@2024-04-23 to 1 binary cache(s) in the background
Elapsed time to handle vcpkg-cmake:x64-windows: 64.8 ms
vcpkg-cmake:x64-windows package ABI: dd196c5dadc171e0099f3ae1e3d1393ad550e4b634a9eccc47626f63ecc300d1
Installing 2/7 vcpkg-cmake-get-vars:x64-windows@2025-05-29...
Building vcpkg-cmake-get-vars:x64-windows@2025-05-29...
-- Installing: C:/vcpkg/packages/vcpkg-cmake-get-vars_x64-windows/share/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake
-- Installing: C:/vcpkg/packages/vcpkg-cmake-get-vars_x64-windows/share/vcpkg-cmake-get-vars/cmake_get_vars
-- Installing: C:/vcpkg/packages/vcpkg-cmake-get-vars_x64-windows/share/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt
-- Installing: C:/vcpkg/packages/vcpkg-cmake-get-vars_x64-windows/share/vcpkg-cmake-get-vars/cmake-get-vars.cmake.in
-- Installing: C:/vcpkg/packages/vcpkg-cmake-get-vars_x64-windows/share/vcpkg-cmake-get-vars/vcpkg-port-config.cmake
-- Installing: C:/vcpkg/packages/vcpkg-cmake-get-vars_x64-windows/share/vcpkg-cmake-get-vars/copyright
-- Performing post-build validation
Starting submission of vcpkg-cmake-get-vars:x64-windows@2025-05-29 to 1 binary cache(s) in the background
Elapsed time to handle vcpkg-cmake-get-vars:x64-windows: 50 ms
vcpkg-cmake-get-vars:x64-windows package ABI: 1caf2613ff280beedac132422efd5dd2b9ab925856f260d26b3272d250573705
Completed submission of vcpkg-cmake:x64-windows@2024-04-23 to 1 binary cache(s) in 21.2 ms
Installing 3/7 vcpkg-get-python-packages:x64-windows@2025-04-05...
Building vcpkg-get-python-packages:x64-windows@2025-04-05...
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Starting submission of vcpkg-get-python-packages:x64-windows@2025-04-05 to 1 binary cache(s) in the background
Elapsed time to handle vcpkg-get-python-packages:x64-windows: 55.1 ms
vcpkg-get-python-packages:x64-windows package ABI: b874343380d22531a729ab5396c0c04aab30d17fbc8ba894976f99359bb47abe
Completed submission of vcpkg-cmake-get-vars:x64-windows@2025-05-29 to 1 binary cache(s) in 19.4 ms
Installing 4/7 vcpkg-tool-gn:x64-windows@2025-08-05#1...
Building vcpkg-tool-gn:x64-windows@2025-08-05#1...
Downloading https://chrome-infra-packages.appspot.com/dl/gn/gn/windows-amd64/+/2lRFka6-TQLmU7YpwecZP2tJYOs9kkRN8y-8y_HWwWIC -> gn-windows-amd64.zip
Successfully downloaded gn-windows-amd64.zip
-- Using gn: C:/vcpkg/packages/vcpkg-tool-gn_x64-windows/tools/gn/gn.exe
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Starting submission of vcpkg-tool-gn:x64-windows@2025-08-05#1 to 1 binary cache(s) in the background
Elapsed time to handle vcpkg-tool-gn:x64-windows: 5.6 s
vcpkg-tool-gn:x64-windows package ABI: 70b2bcf15033fda22927203e6e9f43a645f69f60e4df63f9d179730ef12e1f19
Completed submission of vcpkg-get-python-packages:x64-windows@2025-04-05 to 1 binary cache(s) in 19.3 ms
Installing 5/7 vcpkg-gn:x64-windows@2025-08-05...
Building vcpkg-gn:x64-windows@2025-08-05...
-- Installing: C:/vcpkg/packages/vcpkg-gn_x64-windows/share/vcpkg-gn/vcpkg-port-config.cmake
-- Installing: C:/vcpkg/packages/vcpkg-gn_x64-windows/share/vcpkg-gn/vcpkg_gn_configure.cmake
-- Installing: C:/vcpkg/packages/vcpkg-gn_x64-windows/share/vcpkg-gn/vcpkg_gn_install.cmake
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Starting submission of vcpkg-gn:x64-windows@2025-08-05 to 1 binary cache(s) in the background
Elapsed time to handle vcpkg-gn:x64-windows: 50.7 ms
vcpkg-gn:x64-windows package ABI: 64c27fdd368368a0abe57796ef72d0d4586a907cf508a4946a7d7844a0555e6c
Installing 6/7 zlib:x64-windows@1.3.1...
Building zlib:x64-windows@1.3.1...
Downloading https://github.com/madler/zlib/archive/v1.3.1.tar.gz -> madler-zlib-v1.3.1.tar.gz
Successfully downloaded madler-zlib-v1.3.1.tar.gz
-- Extracting source C:/vcpkg/downloads/madler-zlib-v1.3.1.tar.gz
-- Applying patch 0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch
-- Applying patch 0002-build-static-or-shared-not-both.patch
-- Applying patch 0003-android-and-mingw-fixes.patch
-- Using source at C:/vcpkg/buildtrees/zlib/src/v1.3.1-2e5db616bf.clean
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Installing: C:/vcpkg/packages/zlib_x64-windows/share/zlib/vcpkg-cmake-wrapper.cmake
-- Fixing pkgconfig file: C:/vcpkg/packages/zlib_x64-windows/lib/pkgconfig/zlib.pc
Downloading msys2-mingw-w64-x86_64-pkgconf-1~2.5.1-1-any.pkg.tar.zst, trying https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~2.5.1-1-any.pkg.tar.zst
Successfully downloaded msys2-mingw-w64-x86_64-pkgconf-1~2.5.1-1-any.pkg.tar.zst
Downloading msys2-msys2-runtime-3.6.5-1-x86_64.pkg.tar.zst, trying https://mirror.msys2.org/msys/x86_64/msys2-runtime-3.6.5-1-x86_64.pkg.tar.zst
Successfully downloaded msys2-msys2-runtime-3.6.5-1-x86_64.pkg.tar.zst
-- Using msys root at C:/vcpkg/downloads/tools/msys2/3e71d1f8e22ab23f
-- Fixing pkgconfig file: C:/vcpkg/packages/zlib_x64-windows/debug/lib/pkgconfig/zlib.pc
-- Installing: C:/vcpkg/packages/zlib_x64-windows/share/zlib/copyright
-- Performing post-build validation
Starting submission of zlib:x64-windows@1.3.1 to 1 binary cache(s) in the background
Elapsed time to handle zlib:x64-windows: 25 s
zlib:x64-windows package ABI: eebadf8af91ae060ef98d191882c7498388f4b7a93afd380a7a1356a7e53ac7e
Completed submission of vcpkg-tool-gn:x64-windows@2025-08-05#1 to 1 binary cache(s) in 283 ms
Completed submission of vcpkg-gn:x64-windows@2025-08-05 to 1 binary cache(s) in 14.9 ms
Installing 7/7 crashpad:x64-windows@2024-04-11#9...
Building crashpad:x64-windows@2024-04-11#9...
-- Note: crashpad only supports static library linkage. Building static library.
-- Fetching https://chromium.googlesource.com/crashpad/crashpad 7e0af1d4d45b526f01677e74a56f4a951b70517d...
-- Extracting source C:/vcpkg/downloads/crashpad-7e0af1d4d45b526f01677e74a56f4a951b70517d.tar.gz
-- Applying patch fix-linux.patch
-- Applying patch fix-lib-name-conflict.patch
-- Using source at C:/vcpkg/buildtrees/crashpad/src/951b70517d-61636f7b86.clean
Downloading https://www.python.org/ftp/python/3.14.2/python-3.14.2-embed-amd64.zip -> python-3.14.2-embed-amd64.zip
Successfully downloaded python-3.14.2-embed-amd64.zip
Downloading https://github.com/pypa/get-pip/archive/24.2.tar.gz -> pypa-get-pip-24.2.tar.gz
Successfully downloaded pypa-get-pip-24.2.tar.gz
-- Extracting source C:/vcpkg/downloads/pypa-get-pip-24.2.tar.gz
-- Using source at C:/vcpkg/buildtrees/crashpad/src/24.2-36e81c02c7.clean
-- Setting up python virtual environment...
-- Installing python packages: setuptools
-- Setting up python virtual environment... finished.
-- Fetching https://chromium.googlesource.com/chromium/mini_chromium dce72d97d1c2e9beb5e206c6a05a702269794ca3...
-- Extracting source C:/vcpkg/downloads/crashpad-dce72d97d1c2e9beb5e206c6a05a702269794ca3.tar.gz
-- Applying patch fix-std-20.patch
-- Applying patch ndk-toolchain.diff
-- Applying patch fix-lib-name-conflict-1.patch
-- Using source at C:/vcpkg/buildtrees/crashpad/src/2269794ca3-31403e06d2.clean
-- Getting CMake variables for x64-windows
-- Loading CMake variables from C:/vcpkg/buildtrees/crashpad/cmake-get-vars_C_CXX-x64-windows.cmake.log
-- Generating build (x64-windows-dbg)...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
    Command failed: C:/vcpkg/installed/x64-windows/tools/gn/gn.exe gen C:/vcpkg/buildtrees/crashpad/x64-windows-dbg "--args=target_cpu=\"x64\" target_os=\"win\" is_debug=true         extra_cflags_c=\"  -nologo -DWIN32 -D_WINDOWS -utf-8 -MP  -MDd -Z7 -Ob0 -Od -RTC1   \"         extra_cflags_cc=\"  -nologo -DWIN32 -D_WINDOWS -utf-8 -GR -EHsc -MP  -MDd -Z7 -Ob0 -Od -RTC1   \"         extra_ldflags=\" -machine:x64 -nologo    -debug -INCREMENTAL  \"         extra_arflags=\"-machine:x64 -nologo\"         extra_cflags=\"/GL-\"         extra_ldflags=\"/LTCG:OFF\"         extra_arflags=\"/LTCG:OFF\""
    Working Directory: C:/vcpkg/buildtrees/crashpad/src/951b70517d-61636f7b86.clean
    Error code: 1
    See logs for more information:
      C:\vcpkg\buildtrees\crashpad\generate-x64-windows-dbg-out.log
      C:\vcpkg\buildtrees\crashpad\generate-x64-windows-dbg-err.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-gn/vcpkg_gn_configure.cmake:10 (vcpkg_execute_required_process)
  installed/x64-windows/share/vcpkg-gn/vcpkg_gn_configure.cmake:34 (z_vcpkg_gn_configure_generate)
  ports/crashpad/portfile.cmake:123 (vcpkg_gn_configure)
  scripts/ports.cmake:206 (include)


error: building crashpad:x64-windows failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle crashpad:x64-windows: 1.6 min
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+crashpad
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=%5Bcrashpad%5D%20build%20error%20on%20x64-windows&body=Copy%20issue%20body%20from%20C%3A%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md       

Completed submission of zlib:[email protected] to 1 binary cache(s) in 119 ms

The log is:

cat C:\vcpkg\buildtrees\crashpad\generate-x64-windows-dbg-out.log
ERROR at //third_party/mini_chromium/mini_chromium/build/config/BUILD.gn:622:20: Script returned non-zero exit code.
  toolchain_data = exec_script(helper_path,
                   ^----------
Current dir: C:/vcpkg/buildtrees/crashpad/x64-windows-dbg/
Command: C:/vcpkg/buildtrees/crashpad/x64-windows-venv/Scripts/python.exe C:/vcpkg/buildtrees/crashpad/src/951b70517d-61636f7b86.clean/third_party/mini_chromium/mini_chromium/build/win_helper.py get-visual-studio-data C:/vcpkg/buildtrees/crashpad/x64-windows-dbg C:/vcpkg/buildtrees/crashpad/src/951b70517d-61636f7b86.clean/third_party/mini_chromium/mini_chromium/build/config/<autodetect>
Returned 1.
See //build/BUILDCONFIG.gn:64:3: which caused the file to be included.
  "$_mini_chromium_dir/build/config:Wexit_time_destructors",
  ^--------------------------------------------------------

And the error log is:

 cat C:\vcpkg\buildtrees\crashpad\generate-x64-windows-dbg-err.log
Traceback (most recent call last):
  File "C:\vcpkg\buildtrees\crashpad\src\951b70517d-61636f7b86.clean\third_party\mini_chromium\mini_chromium\build\win_helper.py", line 230, in <module>
    sys.exit(WinTool().Dispatch(sys.argv[1:]))
             ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\vcpkg\buildtrees\crashpad\src\951b70517d-61636f7b86.clean\third_party\mini_chromium\mini_chromium\build\win_helper.py", line 124, in Dispatch
    return getattr(self, method)(*args[1:])
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "C:\vcpkg\buildtrees\crashpad\src\951b70517d-61636f7b86.clean\third_party\mini_chromium\mini_chromium\build\win_helper.py", line 210, in ExecGetVisualStudioData
    install_dir, script_path = (explicit() or env() or autodetect() or fail())
                                                                       ~~~~^^
  File "C:\vcpkg\buildtrees\crashpad\src\951b70517d-61636f7b86.clean\third_party\mini_chromium\mini_chromium\build\win_helper.py", line 205, in fail
    def fail(): raise Exception('Visual Studio installation dir not found')
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: Visual Studio installation dir not found

This made me realise that line 201 of mini_chromium win_helper.py was failing. In my host computer, this was not failing because the helper was finding the Visual Studio installation using the autodetect function (my host machine has the community edition), so I changed the command to automatically find the build tools.

Analysing all this, it is likely that mini_chromium never used the compiler provided by the vcpkg toolchain.

@vicroms vicroms added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jan 28, 2026
@vicroms vicroms marked this pull request as draft January 28, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants