lukka / run-vcpkg

The GitHub Action to setup vcpkg for your C++ based projects. Stores built ports using Binary Caching backed onto GH Cache.
MIT License
194 stars 26 forks source link

Installing completely broken with current vcpkg #136

Closed rhuijben closed 2 years ago

rhuijben commented 2 years ago

Also opening an issue here, as it appears this action is now broken against current vcpkg master on windows-latest and windows-2019.

vcpkg tries to extract 7zip, using 7zip as it somehow can't find tar.exe in windows\system32.

I'm looking for some temporary workaround, and some help escallating this issue with the Microsoft vcpkg project as it is slowing development on projects relying on vcpkg builds that need updates of their dependencies.

See https://github.com/microsoft/vcpkg/issues/23448

rhuijben commented 2 years ago
A suitable version of 7zip was not found (required v21.7.0).
Downloading portable 7zip v21.7.0...
Downloading 7zip...
  https://www.7-zip.org/a/7z2107-extra.7z -> D:\a\SharpProj\SharpProj\vcpkg\downloads\7z2107-extra.7z
Extracting 7zip...
A suitable version of 7zip was not found (required v21.7.0). Downloading portable 7zip v21.7.0...
Extracting 7zip...
Error: vcpkg has crashed; no additional details are available.
The source line is D:\a\_work\1\s\src\vcpkg\archives.cpp(101)
rhuijben commented 2 years ago
    - name: Setup VCPKG
      uses: lukka/run-vcpkg@v10
      with:
        vcpkgDirectory: '${{ github.workspace }}/vcpkg'
        vcpkgGitCommitId: 5a8a1dfff8e2dffd4c8cc2d1fc0da379ffd18b25

    - name: Ensure Proj packages are available
      run: vcpkg.exe install "tiff[core]:x64-windows-static-md" "proj[core,tiff]:x64-windows-static-md" "tiff[core]:x86-windows-static-md" "proj[core,tiff]:x86-windows-static-md"
lukka commented 2 years ago

@rhuijben this is a vcpkg issue, that you need to work around. Remember that run-vcpkg caches vcpkg.exe and all its built packages, so if you are continuously hitting that "broken" cached vcpkg.exe, this problem will not go away. What you need to do is to force to use a new cache key, so that the cached vcpkg.exe is not going to be used anymore. To invalidate the cache you can:

rhuijben commented 2 years ago

I already invalidated the cache a few times, but I first need a new vcpkg :-(

rhuijben commented 2 years ago

@lukka It appears that an older version of VCPKG.exe is earlier on the path than the one installed by run-vcpkg after running this task on the windows-latest / windows-2022 buildbots.

This breaks my invocations after this job

lukka commented 2 years ago

@rhuijben right, just prefix the path to the exe with the VCPKG_ROOT environment variable which has been set by the previous instance of run-vcpkg.

rhuijben commented 2 years ago

I already did this on my job now... I'm still trying to find where I get the other version from. Looking at the output it downloads a new version as part of the bootstrap, but then doesn't use it.. But 'where vcpkg` doesn't provide a path that is used.

lukka commented 2 years ago

@rhuijben it is already installed on the runner environment: https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#package-management

lukka commented 2 years ago

@rhuijben note that the documentation states that vcpkg is preinstalled in c:\vcpkg on the GitHub runners.

If you look to the PATH environment variable during a workflow run, you'll see that c:\vcpkg is included indeed.

You may have used where vcpkg, but when using powershell or pwsh you need to run where.exe vpkg to get what you want.

lukka commented 2 years ago

@rhuijben if this is still an outstanding problem let me know, we can reopen the issue. If you could also report what was the fix or the workaround, let us know!

rhuijben commented 2 years ago

@lukka This was a very bad $PATH issue on GitHub... Sorry I should have closed this issue earlier.

This script properly downloaded the new vcpkg+scripts, but then executed the old .exe with the new scripts... which broke things badly.

rhuijben commented 2 years ago

@lukka This was a very bad $PATH issue on GitHub... Sorry I should have closed this issue earlier.

This script properly downloaded the new vcpkg+scripts, but then executed the old .exe with the new scripts... which broke things badly.

Workaround for me:


env:
   vcpkgExe: '${{ github.workspace }}/vcpkg/vcpkg.exe'

jobs:
  build:

    - name: Ensure Proj packages are available
      run: ${{env.vcpkgExe}} install "tiff[core]:x64-windows-static-md" "proj[core,tiff]:x64-windows-static-md" "tiff[core]:x86-windows-static-md" "proj[core,tiff]:x86-windows-static-md" "tiff[core]:arm64-windows-static-md" "proj[core,tiff]:arm64-windows-static-md"