Skip to content

vcpkg_from_git fails when downloads folder does not exist #18291

@alberthdev

Description

@alberthdev

Describe the bug
vcpkg_from_git fails to run its git init test when the vcpkg\downloads folder does not exist.

Environment

  • OS: Windows
  • Compiler: MSVC 2019

To Reproduce
Steps to reproduce the behavior:

  1. Setup an environment where all of the required tools needed for vcpkg are up to date and the latest. (GitHub Actions' environment is where I was able to have this kind of environment.)
  2. Run ./vcpkg install [--debug] <pkg>, where <pkg> is a package that engages vcpkg_from_git.
  3. Error will occur that looks like this (log snip with --debug):
-- Fetching https://android.googlesource.com/platform/external/fdlibm...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:109 (message):
    Command failed: "C:/Program Files/Git/bin/git.exe" init git-tmp
    Working Directory: D:/a/github-actions-test/github-actions-test/vcpkg/downloads
    Error code: The system cannot find the file specified
    See logs for more information:

Call Stack (most recent call first):
  scripts/cmake/vcpkg_from_git.cmake:85 (vcpkg_execute_required_process)
  ports/fdlibm/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:139 (include)


[DEBUG] cmd_execute_and_stream_data() returned 1 after    45703 us
Error: Building package fdlibm:x86-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: fdlibm:x86-windows
  Vcpkg version: 2021-05-05-9f849c4c43e50d1b16186ae76681c27b0c1be9d9

Additionally, attach any relevant sections from the log files above.

Expected behavior
The git checkout succeeds (or in this case, the git init test succeeds). Success in this function would result in the port being downloaded, built, and installed.

Failure logs

Additional context
Workaround for this problem was to create the vcpkg\downloads directory prior to starting vcpkg install. This allowed the build to complete successfully.

I've attached the GitHub Actions YAML that can be used to reproduce the problem:

The repo that I tested on for this problem can be found here - recommended to clone this as it has the required fix needed to debug, as seen in the next blurb.

Noting that in order to trace this problem, I needed to add additional checks to vcpkg_execute_required_process.cmake, as it was prematurely failing due to the stdout log not existing. A log snip with the failure in question:

Starting package 1/1: fdlibm:x86-windows
Building package fdlibm[core]:x86-windows...
-- Fetching https://android.googlesource.com/platform/external/fdlibm...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:91 (file):
  file failed to open for reading (No such file or directory):

    D:/a/github-actions-test/github-actions-test/vcpkg/buildtrees/fdlibm/git-init-x86-windows-out.log
Call Stack (most recent call first):
  scripts/cmake/vcpkg_from_git.cmake:85 (vcpkg_execute_required_process)
  ports/fdlibm/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:139 (include)


Error: Building package fdlibm:x86-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: fdlibm:x86-windows
  Vcpkg version: 2021-05-05-9f849c4c43e50d1b16186ae76681c27b0c1be9d9

Additionally, attach any relevant sections from the log files above.

The updated cmake file that address the above problem can be found here and in the draft PR #18290.

Metadata

Metadata

Labels

category:vcpkg-bugThe issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)requires:reproThe issue is not currently repro-able

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions