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

run-vcpkg's vcpkg.exe no longer being picked up by MSBuild/Visual Studio even with vcpkg integrate install #170

Closed
akrieger opened this issue Oct 26, 2022 · 5 comments

Comments

@akrieger
Copy link

Something changed in the last week, maybe in the os image, maybe something else, which broke how run-vcpkg was setting up the custom vcpkg checkout.

The 'good' setup would end up with vcpkg.exe from run-vcpkg being picked up automatically by msbuilds. Eg. [https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/3286865811/jobs/5415429788#step:15:61

         "D:\a\Cataclysm-DDA\b\vcpkg\vcpkg.exe" install "--host-triplet=x64-windows-static" --x-wait-for-lock --triplet "x64-windows-static" --vcpkg-root "D:\a\Cataclysm-DDA\b\vcpkg\\" "--x-manifest-root=D:\a\Cataclysm-DDA\Cataclysm-DDA\msvc-full-features\\" "--x-install-root=D:\a\Cataclysm-DDA\Cataclysm-DDA\msvc-full-features\vcpkg_installed\x64-windows-static\\" --clean-after-build

Whereas now we get https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/3290143305/jobs/5422607241#step:15:62

         "C:\vcpkg\vcpkg.exe" install "--host-triplet=x64-windows-static" --x-wait-for-lock --triplet "x64-windows-static" --vcpkg-root "C:\vcpkg\\" "--x-manifest-root=D:\a\Cataclysm-DDA\Cataclysm-DDA\msvc-full-features\\" "--x-install-root=D:\a\Cataclysm-DDA\Cataclysm-DDA\msvc-full-features\vcpkg_installed\x64-windows-static\\" --clean-after-build

Our workflows are pinned to run-vcpkg@v10.2 so we didn't pick up an automatic update to the action.

The only difference I can see is in the vcpkg integrate install step there is now this output https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/3290143305/jobs/5422607241#step:6:11

warning: Ignoring VCPKG_ROOT environment variable; use --vcpkg-root "D:\a\Cataclysm-DDA\b\vcpkg" to use the environment value or unset the VCPKG_ROOT environment variable to suppress this message. Using detected vcpkg root: "C:\vcpkg".

So I will work around the issue by manually specifying that in our vcpkg integrate install command. However, I'm still filing this issue for awareness and to see if there is anything run-vcpkg maintainers think should be handled by the action itself.

@lukka
Copy link
Owner

lukka commented Oct 26, 2022

@akrieger thanks for reporting this. The root of the problem is that accidentally the GH runner deployed recently had the VCPKG_ROOT variable defined, and the change will be soon reverted, but not yet. Your best fix is to unset the variable as I've done here for example:

https://github.com/lukka/run-cmake/blob/main/.github/workflows/build-test.yml#L53

where the variable is undefined for the whole job.

Could you please link your workflow file? As far as I remember run-vcpkg redefines the VCPKG_ROOT variable.

@akrieger
Copy link
Author

akrieger commented Oct 26, 2022

https://github.com/CleverRaven/Cataclysm-DDA/blob/master/.github/workflows/release.yml#L226-L241

run-vcpkg does redefine it. vcpkg.exe from the base image seems to now be (or always was?) ignoring it.

@akrieger
Copy link
Author

akrieger commented Oct 26, 2022

Working builds:

Run vcpkg integrate install
  vcpkg integrate install
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    GITHUB_TOKEN: ***
    ZSTD_CLEVEL: 17
    VCPKG_DEFAULT_BINARY_CACHE: D:/a/Cataclysm-DDA/b/vcpkg_cache
    RUNVCPKG_VCPKG_ROOT: D:\a\Cataclysm-DDA\b\vcpkg
    VCPKG_ROOT: D:\a\Cataclysm-DDA\b\vcpkg
Applied user-wide integration for this vcpkg root.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=D:/a/Cataclysm-DDA/b/vcpkg/scripts/buildsystems/vcpkg.cmake"

All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available.

Broken builds:

Run vcpkg integrate install
  vcpkg integrate install
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    GITHUB_TOKEN: ***
    ZSTD_CLEVEL: 17
    VCPKG_DEFAULT_BINARY_CACHE: D:/a/Cataclysm-DDA/b/vcpkg_cache
    RUNVCPKG_VCPKG_ROOT: D:\a\Cataclysm-DDA\b\vcpkg
    VCPKG_ROOT: D:\a\Cataclysm-DDA\b\vcpkg
warning: Ignoring VCPKG_ROOT environment variable; use --vcpkg-root "D:\a\Cataclysm-DDA\b\vcpkg" to use the environment value or unset the VCPKG_ROOT environment variable to suppress this message. Using detected vcpkg root: "C:\vcpkg".
Applied user-wide integration for this vcpkg root.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"

All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available.

Only difference in output is that warning: Ignoring ... output and subsequent reference to the path to the CMAKE_TOOLCHAIN_FILE being in C:\.

@lukka
Copy link
Owner

lukka commented Oct 29, 2022

@akrieger thank you for the additional data! It occurs to me that you are using the executable at c:\vcpkg\vcpkg.exe when running the integration install command, while the VCPKG_ROOT is pointing to another directory (d:\a\cataclysm\dda\b\vcpkg\). If you modify your workflow to use the vcpkg.exe from the VCPKG_ROOT directory it should just work, i.e.:

${{ runner.workspace }}/b/vcpkg/vcpkg.exe integrate install --vcpkg-root '${{ runner.workspace }}\b\vcpkg'

or

$VCPKG_ROOT/vcpkg.exe integrate install

should be working.

I think I may ponder whether adding the provisioned vcpkg executable to the PATH is a good idea.

lstipakov added a commit to lstipakov/openvpn that referenced this issue Nov 2, 2022
By removing builin-baseline constraint, we force
vcpkg to use latest versions of ports. As a side effect,
this bumps OpenSSL to 3.0.7.

While on it, update vcpkg commit in GHA.

We also have to apply a workaround for GHA
to make it use our vcpkg checkout instead of c:\vcpkg,
see

 actions/runner-images#6376
 lukka/run-vcpkg#170

Signed-off-by: Lev Stipakov <lev@openvpn.net>
lstipakov added a commit to lstipakov/openvpn that referenced this issue Nov 2, 2022
By removing builin-baseline constraint, we force
vcpkg to use latest versions of ports. As a side effect,
this bumps OpenSSL to 3.0.7.

While on it, update vcpkg commit in GHA.

We also have to apply a workaround for GHA
to make it use our vcpkg checkout instead of c:\vcpkg,
see

 actions/runner-images#6376
 lukka/run-vcpkg#170

Signed-off-by: Lev Stipakov <lev@openvpn.net>
lstipakov added a commit to lstipakov/openvpn that referenced this issue Nov 2, 2022
By removing builin-baseline constraint, we force
vcpkg to use latest versions of ports. As a side effect,
this bumps OpenSSL to 3.0.7.

While on it, update vcpkg commit in GHA.

We also have to apply a workaround for GHA
to make it use our vcpkg checkout instead of c:\vcpkg,
see

 actions/runner-images#6376
 lukka/run-vcpkg#170

Signed-off-by: Lev Stipakov <lev@openvpn.net>
lstipakov added a commit to lstipakov/openvpn that referenced this issue Nov 2, 2022
By removing builin-baseline constraint, we force
vcpkg to use latest versions of ports. As a side effect,
this bumps OpenSSL to 3.0.7.

While on it, update vcpkg commit in GHA.

We also have to apply a workaround for GHA
to make it use our vcpkg checkout instead of c:\vcpkg,
see

 actions/runner-images#6376
 lukka/run-vcpkg#170

Signed-off-by: Lev Stipakov <lev@openvpn.net>
cron2 pushed a commit to cron2/openvpn that referenced this issue Nov 8, 2022
By removing builin-baseline constraint, we force
vcpkg to use latest versions of ports. As a side effect,
this bumps OpenSSL to 3.0.7.

While on it, update vcpkg commit in GHA.

We also have to apply a workaround for GHA
to make it use our vcpkg checkout instead of c:\vcpkg,
see

 actions/runner-images#6376
 lukka/run-vcpkg#170

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221102151536.255-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25474.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
@lukka
Copy link
Owner

lukka commented Apr 3, 2023

The vcpkg location is added to PATH from run-vcpkg@v11, i.e.: https://github.com/lukka/run-vcpkg/releases/tag/v11.0

@lukka lukka closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants