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

[vcpkg] powershell-core is required by vcpkg_copy_tool_dependencies on non-Windows, but doesn't make powershell-core available #14358

Closed
abique opened this issue Nov 2, 2020 · 7 comments · Fixed by #14366
Assignees
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Comments

@abique
Copy link
Contributor

abique commented Nov 2, 2020

Host Environment

  • Archlinux (up to date as of 02/11/2020)
  • Compiler: gcc (GCC) 10.2.0

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.

@ASxa86
Copy link

ASxa86 commented Nov 2, 2020

Can confirm I am seeing this on CentOS 7 as well.

abique referenced this issue Nov 2, 2020
* Fix incorrect determination of PowerShell not found because Bill doesn't know enough CMake :(

Resolves #14283
@abique
Copy link
Contributor Author

abique commented Nov 2, 2020

This issue was introduced by: b7056e9

@BillyONeal
Copy link
Member

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 634c104 -- there the "if (POWERSHELL-NOTFOUND)" branch is dead. In a6a1722 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 b7056e9 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:

  • We could make this function do nothing on non-Windows which will make the message go away
  • We could make sure that powershell core is acquired first by vcpkg; some ports assume powershell is available
  • We could change this bit to use vcpkg_find_acquire_program to get powershell.

@NancyLi1013 NancyLi1013 added the category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) label Nov 3, 2020
@BillyONeal BillyONeal changed the title brotli:x64-linux build failure [vcpkg] powershell-core is required by vcpkg_copy_tool_dependencies on non-Windows, but doesn't make powershell-core available Nov 3, 2020
BillyONeal added a commit to BillyONeal/vcpkg that referenced this issue Nov 3, 2020
This is clearly looking for *.exe and *.dll, so it has Windows assumptions. Moreover, it fails on non-Windows platforms where vcpkg doesn't always make powershell-core available.

Resolves microsoft#14358
@BillyONeal
Copy link
Member

I have submitted the "do nothing on non-Windows" change #14366

@abique
Copy link
Contributor Author

abique commented Nov 3, 2020

Thank you @BillyONeal I'll check the master again maybe today.

@abique
Copy link
Contributor Author

abique commented Nov 3, 2020

Also if a package needs powershell it should mention it in its metadata/build dependencies and vcpkg should acquire powershell I think.

@BillyONeal
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants