Host Environment
To Reproduce
Steps to reproduce the behavior:
./vcpkg --triplet x64-linux install cairo
Failure logs
20-11-02 18:07:38 abique@knot:~/d/vcpkg git:master> ./vcpkg --triplet x64-linux install cairo
Computing installation plan...
The following packages will be built and installed:
* brotli[core]:x64-linux
* bzip2[core]:x64-linux
cairo[core]:x64-linux
* dirent[core]:x64-linux
* expat[core]:x64-linux
* fontconfig[core]:x64-linux
* freetype[bzip2,core,png]:x64-linux
* libiconv[core]:x64-linux
* libpng[core]:x64-linux
* pixman[core]:x64-linux
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-linux...
Starting package 1/10: brotli:x64-linux
Building package brotli[core]:x64-linux...
Could not locate cached archive: /home/abique/.cache/vcpkg/archives/d4/d4e29d565a5af427af69da25079f3fe8be3f0803.zip
-- Using cached /home/abique/develop/vcpkg/downloads/google-brotli-e61745a6b7add50d380cfd7d3883dd6c62fc2c71.tar.gz
-- Cleaning sources at /home/abique/develop/vcpkg/buildtrees/brotli/src/6c62fc2c71-a8c4ea9278.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/abique/develop/vcpkg/downloads/google-brotli-e61745a6b7add50d380cfd7d3883dd6c62fc2c71.tar.gz
-- Applying patch install.patch
-- Applying patch fix-arm-uwp.patch
-- Applying patch pkgconfig.patch
-- Using source at /home/abique/develop/vcpkg/buildtrees/brotli/src/6c62fc2c71-a8c4ea9278.clean
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
-- Building x64-linux-rel
CMake Error at scripts/cmake/vcpkg_copy_tool_dependencies.cmake:22 (message):
Could not find PowerShell Core; please open an issue to report this.
Call Stack (most recent call first):
ports/brotli/portfile.cmake:23 (vcpkg_copy_tool_dependencies)
scripts/ports.cmake:135 (include)
Error: Building package brotli:x64-linux 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: brotli:x64-linux
Vcpkg version: 2020.06.15-unknownhash
Additionally, attach any relevant sections from the log files above.
20-11-02 18:08:02 1 abique@knot:~/d/vcpkg git:master>
Additional context
I don't know why it is looking for PowerShell.
Can confirm I am seeing this on CentOS 7 as well.
This issue was introduced by: https://github.com/microsoft/vcpkg/commit/b7056e9f1f34f18b6648b1f1d9c4e9d31f04e91c
It's looking for powershell because the applocal.ps1 which tries to determine what each tool depends on to copy the right associated binaries over, is a powershell script.
It looks like that test has been broken "forever"; find_program doesn't create a FOO-NOTFOUND variable, it puts FOO-NOTFOUND into that variable. Looks like that bug comes all the way back from https://github.com/microsoft/vcpkg/commit/634c1043b01dff682dc9834f4987037683764034 -- there the "if (POWERSHELL-NOTFOUND)" branch is dead. In https://github.com/microsoft/vcpkg/commit/a6a1722cfa94caa5db98848679b99377bc5a0112 I changed it to try to use an installed pwsh if that is already present, but I didn't fix that "the branch is dead" bug, and in https://github.com/microsoft/vcpkg/commit/b7056e9f1f34f18b6648b1f1d9c4e9d31f04e91c I fixed the branch to not be dead. But maybe the branch should have been dead?
Even though that was wrong, because vcpkg_copy_tools_dependencies looks for ".exe", it never tried to invoke that powershell script on most *nix systems,
It passes in our CI because we have powershell core installed in our test VMs, so find_program finds it, and everything is OK.
Possible options:
vcpkg_find_acquire_program to get powershell.I have submitted the "do nothing on non-Windows" change https://github.com/microsoft/vcpkg/pull/14366/
Thank you @BillyONeal I'll check the master again maybe today.
Also if a package needs powershell it should mention it in its metadata/build dependencies and vcpkg should acquire powershell I think.
Also if a package needs powershell it should mention it in its metadata/build dependencies and vcpkg should acquire powershell I think.
On Windows it's an assumed dependency:
https://github.com/microsoft/vcpkg/blob/master/toolsrc/src/vcpkg/build.cpp#L340
Most helpful comment
I have submitted the "do nothing on non-Windows" change https://github.com/microsoft/vcpkg/pull/14366/