microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.36k stars 6.46k forks source link

'CMake' failed while extracting #33904

Open HappySeaFox opened 1 year ago

HappySeaFox commented 1 year ago

Describe the bug I've just cloned and bootstrapped vcpkg. Cannot install any package because CMake cannot be unpacked. The antivirus software is disabled.

Environment

To Reproduce

F:\projects\git.vcpkg>vcpkg install libjxl --triplet x64-windows
Computing installation plan...
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
Extracting cmake...
'CMake' failed while extracting F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip.

P.S. Is there a way to get more logs?

nobu commented 1 year ago

It seems failing on appveyor.com too. https://ci.appveyor.com/project/ruby/ruby/builds/48067556#L47

Now we're downgrading to 2023-08-09 as a workaround.

JonLiu1993 commented 1 year ago

@HappySeaFox, Could you please add extra option --debug to the install command, retry then provide the output?

HappySeaFox commented 1 year ago

--debug log:

[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from F:\projects\git.vcpkg\vcpkg-bundle.json
[DEBUG] Failed to open: F:\projects\git.vcpkg\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
[DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts
[DEBUG] Using builtin-ports: F:\projects\git.vcpkg\ports
[DEBUG] Using installed-root: F:\projects\git.vcpkg\installed
[DEBUG] Using buildtrees-root: F:\projects\git.vcpkg\buildtrees
[DEBUG] Using packages-root: F:\projects\git.vcpkg\packages
[DEBUG] Using vcpkg-root: F:\projects\git.vcpkg
[DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts
[DEBUG] Using builtin-registry: F:\projects\git.vcpkg\versions
[DEBUG] Using downloads-root: F:\projects\git.vcpkg\downloads
[DEBUG] Could not use IsWow64Process2, trying IsWow64Process
Computing installation plan...
[DEBUG] Found path: C:\Program Files\CMake\bin\cmake.exe
[DEBUG] 1000: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)
[DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after    37334 us
[DEBUG] 1001: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)
[DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after    34905 us
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
[DEBUG] Trying to hash F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip
[DEBUG] F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip has hash a847f636fb27ba41ba9e6eaafa56937c614bcb39c6d0c9723241c229a9b0a77b4d00ebee88639561035d43f9aa64895f387eab56c628990c01191da57839cda0
Extracting cmake...
[DEBUG] Found path: C:\Program Files\CMake\bin\cmake.exe
[DEBUG] 1002: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip")
[DEBUG] 1002: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (������������ ��������� �������� ��� ���������� ��������.)) after 1201 us
'CMake' failed while extracting F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip.
[DEBUG] D:\a\_work\1\s\src\vcpkg\archives.cpp(323): 
[DEBUG] Time in subprocesses: 73440us
[DEBUG] Time in parsing JSON: 182us
[DEBUG] Time in JSON reader: 258us
[DEBUG] Time in filesystem: 1899us
[DEBUG] Time in loading ports: 1255us
[DEBUG] Exiting after 269 ms (263539us)

If I run "C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip" in the same terminal window, it's able to unpack the archive.

HappySeaFox commented 1 year ago

2023.08.09 version works fine, no errors were observed.

silverqx commented 1 year ago

I have the same problem on MSYS2 I tried both the master branch and also 2023.08.09 tag.

silverqx commented 1 year ago

Here is the output, I have error 87 on MSYS2 and @HappySeaFox has 1450 error code.

vcpkg install "qtbase[core,sql-sqlite]" --debug ``` ➜ vcpkg-tinyorm-port git:(9edb1b8e5) vcpkg install "qtbase[core,sql-sqlite]" --debug [DEBUG] To include the environment variables in debug output, pass --debug-env [DEBUG] Trying to load bundleconfig from C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\vcpkg-bundle.json [DEBUG] Failed to open: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\vcpkg-bundle.json [DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt [DEBUG] Metrics enabled. [DEBUG] Feature flag 'binarycaching' unset [DEBUG] Feature flag 'compilertracking' unset [DEBUG] Feature flag 'registries' unset [DEBUG] Feature flag 'versions' unset [DEBUG] Feature flag 'dependencygraph' unset [DEBUG] Using scripts-root: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\scripts [DEBUG] Using builtin-ports: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\ports [DEBUG] Using installed-root: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\installed [DEBUG] Using buildtrees-root: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\buildtrees [DEBUG] Using packages-root: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\packages [DEBUG] Using vcpkg-root: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port [DEBUG] Using scripts-root: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\scripts [DEBUG] Using builtin-registry: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\versions [DEBUG] Using downloads-root: C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\downloads [DEBUG] Detecting host with IsWow64Process2 [DEBUG] Using overlay: C:/msys64/home/xyz/.local/share/vcpkg/ports Computing installation plan... [DEBUG] Loading dep info for: pcre2:x64-mingw-dynamic qtbase:x64-mingw-dynamic [DEBUG] Found path: C:\msys64\ucrt64\bin\cmake.exe [DEBUG] 1000: CreateProcessW("C:\msys64\ucrt64\bin\cmake.exe" --version) [DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after 21438 us [DEBUG] 1001: CreateProcessW("C:\msys64\ucrt64\bin\cmake.exe" "-DVCPKG_ROOT_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port" "-DPACKAGES_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/packages" "-DBUILDTREES_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/buildtrees" "-D_VCPKG_INSTALLED_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/installed" "-DDOWNLOADS=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/downloads" -DVCPKG_MANIFEST_INSTALL=OFF -P "C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\buildtrees\0.vcpkg_dep_info.cmake") [DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after 21008 us [DEBUG] 1002: CreateProcessW("C:\msys64\ucrt64\bin\cmake.exe" "-DVCPKG_ROOT_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port" "-DPACKAGES_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/packages" "-DBUILDTREES_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/buildtrees" "-D_VCPKG_INSTALLED_DIR=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/installed" "-DDOWNLOADS=C:/msys64/home/xyz/Code/vcpkg-tinyorm-port/downloads" -DVCPKG_MANIFEST_INSTALL=OFF -P "C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\buildtrees\0.vcpkg_tags.cmake") [DEBUG] 1002: cmd_execute_and_stream_data() returned 0 after 22806 us The following packages will be built and installed: * bzip2[core,tool]:x64-mingw-dynamic -> 1.0.8#5 * double-conversion:x64-mingw-dynamic -> 3.2.1#1 * pcre2[core,jit,platform-default-features]:x64-mingw-dynamic -> 10.42 qtbase[concurrent,core,doubleconversion,sql,sql-sqlite,thread]:x64-mingw-dynamic -> 6.5.2#1 * sqlite3[core,json1]:x64-mingw-dynamic -> 3.42.0#1 * vcpkg-cmake:x64-mingw-dynamic -> 2023-05-04 * vcpkg-cmake-config:x64-mingw-dynamic -> 2022-02-06#1 * zlib:x64-mingw-dynamic -> 1.2.13 Additional packages (*) will be modified to complete this operation. [DEBUG] Detecting host with IsWow64Process2 [DEBUG] Detecting host with IsWow64Process2 [DEBUG] Trying to hash C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\scripts\toolchains/mingw.cmake [DEBUG] C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\scripts\toolchains/mingw.cmake has hash 5b8d970aac9ea752ee4bcbbdc87807ef4b73513c48a3c322508c3940dd6ab69c [DEBUG] Trying to hash C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\triplets\community\x64-mingw-dynamic.cmake [DEBUG] C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\triplets\community\x64-mingw-dynamic.cmake has hash 621e918dca7fdc6cb403bce0ba31dcf1fc68dfe47bec975bdcc66f0ea79dc548 Detecting compiler hash for triplet x64-mingw-dynamic... [DEBUG] Found path: C:\msys64\usr\bin\git.exe [DEBUG] 1003: CreateProcessW("C:\msys64\usr\bin\git.exe" --version) [DEBUG] 1003: cmd_execute_and_stream_data() returned 0 after 21736 us A suitable version of powershell-core was not found (required v7.2.11) Downloading portable powershell-core 7.2.11... [DEBUG] Trying to hash C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\downloads\PowerShell-7.2.11-win-x86.zip [DEBUG] C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\downloads\PowerShell-7.2.11-win-x86.zip has hash e9581122101ad161ad628a6feb63e61d3ef8f064a3f325465e8a1a4a6cfc1affbc9bf63146efae0aa65ff9ea5c93018af2c413dc0940f0d162edef805659ec84 Extracting powershell-core... [DEBUG] 1004: CreateProcessW("C:\msys64\ucrt64\bin\cmake.exe" -E tar xzf "C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\downloads\PowerShell-7.2.11-win-x86.zip") [DEBUG] 1004: cmd_execute() returned (error: calling CreateProcessW failed with 87 (unknown error)) after 707 us 'CMake' failed while extracting C:\msys64\home\xyz\Code\vcpkg-tinyorm-port\downloads\PowerShell-7.2.11-win-x86.zip. [DEBUG] D:\a\_work\1\s\src\vcpkg\archives.cpp(323): [DEBUG] Time in subprocesses: 87695us [DEBUG] Time in parsing JSON: 603us [DEBUG] Time in JSON reader: 427us [DEBUG] Time in filesystem: 12975us [DEBUG] Time in loading ports: 2505us [DEBUG] Exiting after 283 ms (272692us) ```
HappySeaFox commented 1 year ago

@silverqx Try bootstrapping again after switching to 2023.08.09.

silverqx commented 1 year ago

You are right I forgot bootstrap again, thx

gg340th commented 1 year ago

Same issue. Switching to 2022.09.27 fixed it for me. (I haven't tried any other, so a more recent one probably works too)

BillyONeal commented 1 year ago

[DEBUG] 1002: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip") [DEBUG] 1002: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (������������ ��������� �������� ��� ���������� ��������.)) after 1201 us 'CMake' failed while extracting F:\projects\git.vcpkg\downloads\cmake-3.27.1-windows-i386.zip.

https://james.darpinian.com/decoder/?q=1450 says ERROR_NO_SYSTEM_RESOURCES . Is it possible that this machine is running out of memory or disk space?

It seems failing on appveyor.com too. https://ci.appveyor.com/project/ruby/ruby/builds/48067556#L47

Is this also Windows 7?

Switching to 2022.09.27 fixed it for me. (I haven't tried any other, so a more recent one probably works too)

OK, so you're saying tool release 2023-09-15 does not exhibit the problem?

I have the same problem on MSYS2 I tried both the master branch and also 2023.08.09 tag.

OK, so this is saying 2023-09-15 does exhibit the problem?

Can someone with the problem try manually downloading vcpkg.exes and let us know when it works or stops working? https://github.com/microsoft/vcpkg-tool/releases

@JavierMatosD It seems like we should not be trying to use cmake to unpack cmake? I'd say might be related https://github.com/microsoft/vcpkg-tool/pull/1039 but if it were that I'd expect we'd have gotten this reported earlier.

HappySeaFox commented 1 year ago

@BillyONeal

Is it possible that this machine is running out of memory or disk space?

Nope, it has a lot of free space and memory.

The 2023.08.09 version works fine. The issue was introduced after this tag.

silverqx commented 1 year ago

I tried the master branch now on msys2 and still the same problem as I posted a few posts above. I'm on latest Win11 and latest msys2. Windows 7 😂 which normal developer would use Win7 😂

silverqx commented 1 year ago

Can someone with the problem try manually downloading vcpkg.exes and let us know when it works or stops working? https://github.com/microsoft/vcpkg-tool/releases

I also tried this on msys2 and the same problem.

autoantwort commented 1 year ago

I am getting error 87. interestingly not when I run vcpkg-tool from inside of QtCreator but when I try to run vcpkg-tool outside of QtCreator it fails with error 87. (I build vcpkg-tool inside of QtCreator)

autoantwort commented 1 year ago

Ok the root cause seems to be that i was in a bash shell. Running the command inside of powershell works. But using powershell started from bash also does not work.

Neumann-A commented 1 year ago

I see the same behavior as autoantwort with vcpkg env. Running in git bash doesn't work running normally in cmd works.

BillyONeal commented 1 year ago

Can someone with the problem try manually downloading vcpkg.exes and let us know when it works or stops working? https://github.com/microsoft/vcpkg-tool/releases

I also tried this on msys2 and the same problem.

Can you explain what 'tried on msys2' means? (There's no vcpkg fetch msys2)

BillyONeal commented 1 year ago

Windows 7 😂 which normal developer would use Win7 😂

The original report with the funny ERROR_NO_SYSTEM_RESOURCES code was Win7.

BillyONeal commented 1 year ago

It seems failing on appveyor.com too. https://ci.appveyor.com/project/ruby/ruby/builds/48067556#L47

@nobu is this being run with bash?

greenozon commented 1 year ago

Looks like I"m hitting similar issue as described in this thread WIn7 x64 SP1 running inside OS cmd.exe window:

vcpkg.exe install polyhook2 --triplet x64-windows --debug

ended up in a very strange error, but similar to above posts:

....
Extracting powershell-core...
[DEBUG] 1005: CreateProcessW("C:\from_gh\vcpkg\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386/bin/cmake.exe" -E tar xzf "C:\from_gh\vcpkg\downloads\PowerShell-7.2.11-win-x86.zip")
[DEBUG] 1005: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (unknown error)) after 5489 us
'CMake' failed while extracting C:\from_gh\vcpkg\downloads\PowerShell-7.2.11-win-x86.zip.
[DEBUG] D:\a\_work\1\s\src\vcpkg\archives.cpp(323):
[DEBUG] Time in subprocesses: 155878us
[DEBUG] Time in parsing JSON: 483us
[DEBUG] Time in JSON reader: 524us
[DEBUG] Time in filesystem: 6121us
[DEBUG] Time in loading ports: 2308us
[DEBUG] Exiting after 704 ms (703116us)
silverqx commented 1 year ago

How can I test it? Or when a new release will be out?

BillyONeal commented 1 year ago

Should be fixed by https://github.com/microsoft/vcpkg/pull/34548

silverqx commented 1 year ago

It's fixed and works fine, tested in MSYS2 shell with vcpkg install "qtbase[core,sql-sqlite]", thx for the fix @BillyONeal

BillyONeal commented 1 year ago

No problem, thanks for confirming!

BillyONeal commented 1 year ago

@HappySeaFox Is the Windows 7 problem you experienced fixed? I'm hopeful that the different error message you got is from the different OS but we have yet to reproduce that exact outcome...

HappySeaFox commented 1 year ago

Sorry for the late response. I've just cloned a fresh copy of vcpkg. The problem is still there:

>git rev-parse HEAD
7a6f366cefd27210f6a8309aed10c31104436509

>bootstrap-vcpkg.bat
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2023-10-18/vcpkg.exe -> F:\projects
\git.vcpkg\vcpkg.exe... done.
Validating signature... done.

vcpkg package management program version 2023-10-18-27de5b69dac4b6fe8259d283cd4011e6d20a84ce

See LICENSE.txt for license information.
Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.

Read more about vcpkg telemetry at docs/about/privacy.md

>vcpkg install libjpeg-turbo --triplet x64-windows --debug > log.txt 2>&1

The log:

[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from F:\projects\git.vcpkg\vcpkg-bundle.json
[DEBUG] Failed to open: F:\projects\git.vcpkg\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
[DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts
[DEBUG] Using builtin-ports: F:\projects\git.vcpkg\ports
[DEBUG] Using installed-root: F:\projects\git.vcpkg\installed
[DEBUG] Using buildtrees-root: F:\projects\git.vcpkg\buildtrees
[DEBUG] Using packages-root: F:\projects\git.vcpkg\packages
[DEBUG] Using vcpkg-root: F:\projects\git.vcpkg
[DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts
[DEBUG] Using builtin-registry: F:\projects\git.vcpkg\versions
[DEBUG] Using downloads-root: F:\projects\git.vcpkg\downloads
[DEBUG] Could not use IsWow64Process2, trying IsWow64Process
Computing installation plan...
[DEBUG] Found path: C:\Program Files\CMake\bin\cmake.exe
[DEBUG] 1000: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)
[DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after    50429 us
[DEBUG] 1001: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -DVCPKG_ROOT_DIR=F:/projects/git.vcpkg -DPACKAGES_DIR=F:/projects/git.vcpkg/packages -DBUILDTREES_DIR=F:/projects/git.vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=F:/projects/git.vcpkg/installed -DDOWNLOADS=F:/projects/git.vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P "F:\projects\git.vcpkg\buildtrees\0.vcpkg_tags.cmake")
[DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after    30994 us
The following packages will be built and installed:
    libjpeg-turbo:x64-windows -> 3.0.1
  * vcpkg-cmake:x64-windows -> 2023-05-04
  * vcpkg-cmake-config:x64-windows -> 2022-02-06#1
Additional packages (*) will be modified to complete this operation.
[DEBUG] 1002: CreateProcessW("C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -prerelease -legacy -products * -format xml)
[DEBUG] 1002: cmd_execute_and_stream_data() returned 0 after    30876 us
[DEBUG] Trying to hash F:\projects\git.vcpkg\scripts\toolchains/windows.cmake
[DEBUG] F:\projects\git.vcpkg\scripts\toolchains/windows.cmake has hash e36df1c7f50ab25f9c182fa927d06c19ae082e0d599f132b3f655784b49e4b33
[DEBUG] Trying to hash F:\projects\git.vcpkg\triplets\x64-windows.cmake
[DEBUG] F:\projects\git.vcpkg\triplets\x64-windows.cmake has hash 4556164a2cd3dd6f4742101eabb46def7e71b6e5856faa88e5d005aac12a803c
Detecting compiler hash for triplet x64-windows...
[DEBUG] Found path: C:\dev\Git\cmd\git.exe
[DEBUG] 1003: CreateProcessW("C:\dev\Git\cmd\git.exe" --version)
[DEBUG] 1003: cmd_execute_and_stream_data() returned 0 after    38903 us
[DEBUG] Could not use IsWow64Process2, trying IsWow64Process
A suitable version of powershell-core was not found (required v7.2.11) Downloading portable powershell-core 7.2.11...
[DEBUG] Trying to hash F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip
[DEBUG] F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip has hash e9581122101ad161ad628a6feb63e61d3ef8f064a3f325465e8a1a4a6cfc1affbc9bf63146efae0aa65ff9ea5c93018af2c413dc0940f0d162edef805659ec84
Extracting powershell-core...
[DEBUG] 1004: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip")
[DEBUG] 1004: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (������������ ��������� �������� ��� ���������� ��������.)) after 1697 us
'CMake' failed while extracting F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip.
[DEBUG] D:\a\_work\1\s\src\vcpkg\archives.cpp(323): 
[DEBUG] Time in subprocesses: 152899us
[DEBUG] Time in parsing JSON: 95us
[DEBUG] Time in JSON reader: 158us
[DEBUG] Time in filesystem: 1743us
[DEBUG] Time in loading ports: 978us
[DEBUG] Exiting after 620 ms (609380us)

Tested with two shells: the system cmd and the built-in shell in FAR Manager.

HappySeaFox commented 1 year ago

More interesting results:

vcpkg install libjpeg-turbo --triplet x64-windows in FAR Manager: 'CMake' failed while extracting

vcpkg install libjpeg-turbo --triplet x64-windows in cmd: Failed to write to stdout: 31

Log F:\projects\git.vcpkg>vcpkg install libjpeg-turbo --triplet x64-windows --debug [DEBUG] To include the environment variables in debug output, pass --debug-env [DEBUG] Trying to load bundleconfig from F:\projects\git.vcpkg\vcpkg-bundle.json [DEBUG] Failed to open: F:\projects\git.vcpkg\vcpkg-bundle.json [DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt , deployment=Git, vsversion=nullopt [DEBUG] Metrics enabled. [DEBUG] Feature flag 'binarycaching' unset [DEBUG] Feature flag 'compilertracking' unset [DEBUG] Feature flag 'registries' unset [DEBUG] Feature flag 'versions' unset [DEBUG] Feature flag 'dependencygraph' unset [DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts [DEBUG] Using builtin-ports: F:\projects\git.vcpkg\ports [DEBUG] Using installed-root: F:\projects\git.vcpkg\installed [DEBUG] Using buildtrees-root: F:\projects\git.vcpkg\buildtrees [DEBUG] Using packages-root: F:\projects\git.vcpkg\packages [DEBUG] Using vcpkg-root: F:\projects\git.vcpkg [DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts [DEBUG] Using builtin-registry: F:\projects\git.vcpkg\versions [DEBUG] Using downloads-root: F:\projects\git.vcpkg\downloads [DEBUG] Could not use IsWow64Process2, trying IsWow64Process Computing installation plan... [DEBUG] Found path: C:\Program Files\CMake\bin\cmake.exe [DEBUG] 1000: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version) [DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after 45663 us [DEBUG] 1001: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -DVCPKG_ROOT _DIR=F:/projects/git.vcpkg -DPACKAGES_DIR=F:/projects/git.vcpkg/packages -DBUILD TREES_DIR=F:/projects/git.vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=F:/projects/gi t.vcpkg/installed -DDOWNLOADS=F:/projects/git.vcpkg/downloads -DVCPKG_MANIFEST_I NSTALL=OFF -P "F:\projects\git.vcpkg\buildtrees\0.vcpkg_tags.cmake") [DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after 32426 us The following packages will be built and installed: libjpeg-turbo:x64-windows -> 3.0.1 * vcpkg-cmake:x64-windows -> 2023-05-04 * vcpkg-cmake-config:x64-windows -> 2022-02-06#1 Additional packages (*) will be modified to complete this operation. [DEBUG] 1002: CreateProcessW("C:\Program Files (x86)\Microsoft Visual Studio\Ins taller\vswhere.exe" -all -prerelease -legacy -products * -format xml) [DEBUG] 1002: cmd_execute_and_stream_data() returned 0 after 30425 us [DEBUG] Trying to hash F:\projects\git.vcpkg\scripts\toolchains/windows.cmake [DEBUG] F:\projects\git.vcpkg\scripts\toolchains/windows.cmake has hash e36df1c7 f50ab25f9c182fa927d06c19ae082e0d599f132b3f655784b49e4b33 [DEBUG] Trying to hash F:\projects\git.vcpkg\triplets\x64-windows.cmake [DEBUG] F:\projects\git.vcpkg\triplets\x64-windows.cmake has hash 4556164a2cd3dd 6f4742101eabb46def7e71b6e5856faa88e5d005aac12a803c Detecting compiler hash for triplet x64-windows... [DEBUG] Found path: C:\dev\Git\cmd\git.exe [DEBUG] 1003: CreateProcessW("C:\dev\Git\cmd\git.exe" --version) [DEBUG] 1003: cmd_execute_and_stream_data() returned 0 after 41103 us [DEBUG] Could not use IsWow64Process2, trying IsWow64Process A suitable version of powershell-core was not found (required v7.2.11) Downloadi ng portable powershell-core 7.2.11... [DEBUG] Trying to hash F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86 .zip [DEBUG] F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip has hash e 9581122101ad161ad628a6feb63e61d3ef8f064a3f325465e8a1a4a6cfc1affbc9bf63146efae0aa 65ff9ea5c93018af2c413dc0940f0d162edef805659ec84 Extracting powershell-core... [DEBUG] 1004: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf " F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip") [DEBUG] Failed to write to stdout: 31

vcpkg install libjpeg-turbo --triplet x64-windows > log.txt 2>&1 in cmd: 'CMake' failed while extracting

Log [DEBUG] To include the environment variables in debug output, pass --debug-env [DEBUG] Trying to load bundleconfig from F:\projects\git.vcpkg\vcpkg-bundle.json [DEBUG] Failed to open: F:\projects\git.vcpkg\vcpkg-bundle.json [DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt [DEBUG] Metrics enabled. [DEBUG] Feature flag 'binarycaching' unset [DEBUG] Feature flag 'compilertracking' unset [DEBUG] Feature flag 'registries' unset [DEBUG] Feature flag 'versions' unset [DEBUG] Feature flag 'dependencygraph' unset [DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts [DEBUG] Using builtin-ports: F:\projects\git.vcpkg\ports [DEBUG] Using installed-root: F:\projects\git.vcpkg\installed [DEBUG] Using buildtrees-root: F:\projects\git.vcpkg\buildtrees [DEBUG] Using packages-root: F:\projects\git.vcpkg\packages [DEBUG] Using vcpkg-root: F:\projects\git.vcpkg [DEBUG] Using scripts-root: F:\projects\git.vcpkg\scripts [DEBUG] Using builtin-registry: F:\projects\git.vcpkg\versions [DEBUG] Using downloads-root: F:\projects\git.vcpkg\downloads [DEBUG] Could not use IsWow64Process2, trying IsWow64Process Computing installation plan... [DEBUG] Found path: C:\Program Files\CMake\bin\cmake.exe [DEBUG] 1000: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version) [DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after 45682 us [DEBUG] 1001: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -DVCPKG_ROOT_DIR=F:/projects/git.vcpkg -DPACKAGES_DIR=F:/projects/git.vcpkg/packages -DBUILDTREES_DIR=F:/projects/git.vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=F:/projects/git.vcpkg/installed -DDOWNLOADS=F:/projects/git.vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P "F:\projects\git.vcpkg\buildtrees\0.vcpkg_tags.cmake") [DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after 33275 us The following packages will be built and installed: libjpeg-turbo:x64-windows -> 3.0.1 * vcpkg-cmake:x64-windows -> 2023-05-04 * vcpkg-cmake-config:x64-windows -> 2022-02-06#1 Additional packages (*) will be modified to complete this operation. [DEBUG] 1002: CreateProcessW("C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -prerelease -legacy -products * -format xml) [DEBUG] 1002: cmd_execute_and_stream_data() returned 0 after 29307 us [DEBUG] Trying to hash F:\projects\git.vcpkg\scripts\toolchains/windows.cmake [DEBUG] F:\projects\git.vcpkg\scripts\toolchains/windows.cmake has hash e36df1c7f50ab25f9c182fa927d06c19ae082e0d599f132b3f655784b49e4b33 [DEBUG] Trying to hash F:\projects\git.vcpkg\triplets\x64-windows.cmake [DEBUG] F:\projects\git.vcpkg\triplets\x64-windows.cmake has hash 4556164a2cd3dd6f4742101eabb46def7e71b6e5856faa88e5d005aac12a803c Detecting compiler hash for triplet x64-windows... [DEBUG] Found path: C:\dev\Git\cmd\git.exe [DEBUG] 1003: CreateProcessW("C:\dev\Git\cmd\git.exe" --version) [DEBUG] 1003: cmd_execute_and_stream_data() returned 0 after 39611 us [DEBUG] Could not use IsWow64Process2, trying IsWow64Process A suitable version of powershell-core was not found (required v7.2.11) Downloading portable powershell-core 7.2.11... Downloading powershell-core... https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip->F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip [DEBUG] Trying to hash F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip.12076.part [DEBUG] F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip.12076.part has hash e9581122101ad161ad628a6feb63e61d3ef8f064a3f325465e8a1a4a6cfc1affbc9bf63146efae0aa65ff9ea5c93018af2c413dc0940f0d162edef805659ec84 Extracting powershell-core... [DEBUG] 1004: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip") [DEBUG] 1004: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (������������ ��������� �������� ��� ���������� ��������.)) after 2857 us 'CMake' failed while extracting F:\projects\git.vcpkg\downloads\PowerShell-7.2.11-win-x86.zip. [DEBUG] D:\a\_work\1\s\src\vcpkg\archives.cpp(323): [DEBUG] Time in subprocesses: 150732us [DEBUG] Time in parsing JSON: 116us [DEBUG] Time in JSON reader: 399us [DEBUG] Time in filesystem: 2422us [DEBUG] Time in loading ports: 1576us [DEBUG] Exiting after 19 s (19398887us)

vcpkg install libjpeg-turbo --triplet x64-windows in Git Bash: works fine!

I executed

git clean -dfx
bootstrap-vcpkg.bat

before each test.

greenozon commented 1 year ago

latest bits are still failing in my case:

...
[DEBUG] 1005: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (unknown error)) after 4949 us
...
BillyONeal commented 1 year ago

@HappySeaFox @greenozon Are these both Windows 7?

HappySeaFox commented 1 year ago

@BillyONeal Yes it's Win7 in my case.

greenozon commented 1 year ago

as well, w7 x64 SP1

SunBlack commented 10 months ago

I had the same issue (but with powershell-core). Reverting from CMake 2.8.1 to 2.7.9 solved the issue.

SamVanheer commented 10 months ago

I'm getting the same problem as SunBlack. The latest vcpkg at commit ce46ba8777d8f899d8dc11afefb8eca39293df39 with a fresh setup and CMake 3.28.1 keeps giving the "failed while extracting" error. Reverting to CMake 3.27.9 fixes the problem.

I'm running up-to-date Windows 11. Is any other information needed?

virtuozo007 commented 10 months ago

@BillyONeal I had the same issue too when installing any packages. For example: vcpkg install fontconfig:x64-windows, it says:

......
Downloading https://www.7-zip.org/a/7z2301-extra.7z
Extracting 7zip...
'CMake' failed while extracting D:\Libs\vcpkg\downloads\7z2301-extra.7z.

I am using VS2019, on Windows 7 SP1. with powershell 7.2.17. And if i switch to 2023.08.09 version, it works fine. All versions newer than that don't work.

if I install the package with --debug:

......
[DEBUG] Default binary cache path is: C:\Users\Leo\AppData\Local\vcpkg\archives
A suitable version of 7zip was not found (required v23.1.0) Downloading portable
 7zip 23.1.0...
[DEBUG] Trying to hash D:\Libs\vcpkg\downloads\7z2301-extra.7z
[DEBUG] D:\Libs\vcpkg\downloads\7z2301-extra.7z has hash c849c2cb489cf5b6eeb92bf
bc27dcb37d0349c36971e1bc7ef32c7cde1b659e19e8b46d734ba90f47affe07fdfd5b4774cbfa0f
df4b681e9f60bb46bba1f7f9b
Extracting 7zip...
[DEBUG] 1009: CreateProcessW("D:\Libs\vcpkg\downloads\tools\cmake-3.27.1-windows
\cmake-3.27.1-windows-i386/bin/cmake.exe" -E tar xzf "D:\Libs\vcpkg\downloads\7z
2301-extra.7z")
[DEBUG] Failed to write to stdout: 31

and at the same time, the dialog bellow shows up, saying that the vcpkg.exe has stopped working... image

There is an empty folder named "7zip-23.01-windows.partial.5768" be created in the "vcpkg\downloads\tools" dir. image

But the " "D:\Libs\vcpkg\downloads\tools\cmake-3.27.1-windows \cmake-3.27.1-windows-i386/bin/cmake.exe" -E tar xzf "D:\Libs\vcpkg\downloads\7z 2301-extra.7z" " command can successfully be run in the console, the 7zip files can be extracted correctly. That's very strange.

SamVanheer commented 10 months ago

I did some testing and when running vcpkg with --debug added to VCPKG_INSTALL_OPTIONS the problem seems to become clear:

A suitable version of 7zip was not found (required v23.1.0) Downloading portable 7zip 23.1.0...

[DEBUG] Trying to hash C:\Users\User\Documents\Documents\GitHub\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z

[DEBUG] C:\Users\User\Documents\Documents\GitHub\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z has hash c849c2cb489cf5b6eeb92bfbc27dcb37d0349c36971e1bc7ef32c7cde1b659e19e8b46d734ba90f47affe07fdfd5b4774cbfa0fdf4b681e9f60bb46bba1f7f9b
Extracting 7zip...

[DEBUG] 1000: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)

[DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after    18127 us

[DEBUG] 1001: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "C:\Users\User\Documents\Documents\GitHub\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z")

[DEBUG] 1001: cmd_execute() returned (error: calling CreateProcessW failed with 87 (The parameter is incorrect.)) after 78 us
'CMake' failed while extracting C:\Users\User\Documents\Documents\GitHub\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z.

The command to extract the file seems to come from here: https://github.com/microsoft/vcpkg-tool/blob/710a3116bbd615864eef5f9010af178034cb9b44/src/vcpkg/archives.cpp#L316-L328

Digging through the calls the problem seems to be happening here: https://github.com/microsoft/vcpkg-tool/blob/710a3116bbd615864eef5f9010af178034cb9b44/src/vcpkg/base/system.process.cpp#L760-L773

One of the parameters passed in to CreateProcessW must be invalid here.

Running the extract command directly works just fine so CMake itself doesn't seem to be at fault here, unless some property of the executable changed in a way that causes CreateProcessW to fail now.

The --version command works fine as well so there must be something special about the extract command that's causing this.

Using a shorter path to the Git repository does not stop this from happening.

Sidenote: CMake's tar command doesn't have an f option. It's probably not a problem, but it should probably be removed unless the tool name can change.


Relevant info: Operating system: Windows 11 CMake version: 3.28.1 vcpkg commit: fa6e6a6ec3224f1d3697d544edef6272a59cd834 (latest as of this writing) vcpkg tool version: fresh build from new Git repository

SamVanheer commented 10 months ago

I built vcpkg.exe myself to see what's causing the problem. I've pinpointed it to this: https://github.com/microsoft/vcpkg-tool/blob/710a3116bbd615864eef5f9010af178034cb9b44/src/vcpkg/base/system.process.cpp#L1331-L1336

auto maybe_error = proc_attribute_list.update_attribute(
    PROC_THREAD_ATTRIBUTE_HANDLE_LIST, handles_to_inherit, number_of_handles * sizeof(HANDLE));
if (!maybe_error.has_value())
{
    return maybe_error.error();
}

Commenting out this code allows the process to be created successfully.

I printed out the handle values as integers to see what's going on:

constexpr size_t number_of_candidate_handles = 3;
HANDLE handles_to_inherit[number_of_candidate_handles] = {
    GetStdHandle(STD_INPUT_HANDLE), GetStdHandle(STD_OUTPUT_HANDLE), GetStdHandle(STD_ERROR_HANDLE)};
//Util::sort(handles_to_inherit);
size_t number_of_handles =
    std::unique(handles_to_inherit, handles_to_inherit + number_of_candidate_handles) - handles_to_inherit;

Debug::println(fmt::format("number of handles: {}", number_of_handles));

for (int i = 0; i < 3; ++i)
{
    Debug::println(fmt::format("handle {}: {:x}", i, (uintptr_t)handles_to_inherit[i]));
}

This printed:

[DEBUG] number of handles: 3

[DEBUG] handle 0: ffffffffffffffff
[DEBUG] handle 1: abc
[DEBUG] handle 2: bb0

Standard input's value is INVALID_HANDLE_VALUE. Calling GetLastError returns 6, which is ERROR_INVALID_HANDLE.

My guess is that CMake 3.28 is making the handle invalid somehow. Perhaps a change in how CMake handles execute_process accidentally broke the handling of standard input handle inheritance?

Looking at CMake's history for that command i can see one change that might be the cause: https://gitlab.kitware.com/cmake/cmake/-/commit/5420639a8d696055577de638e0952d6936706f18

The way standard input is set might be incorrect here:

builder.SetExternalStream(cmUVProcessChainBuilder::Stream_INPUT,  cm_fileno(stdin));

Note how output and error streams use a different function:

builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT);

However the code to set a builtin input stream has this:

// FIXME

To confirm this i used INPUT_FILE to override the input handle:

execute_process(
    INPUT_FILE "foo.txt"
    COMMAND "${Z_VCPKG_EXECUTABLE}" install
        --triplet "${VCPKG_TARGET_TRIPLET}"
        --vcpkg-root "${Z_VCPKG_ROOT_DIR}"
        "--x-wait-for-lock"
        "--x-manifest-root=${VCPKG_MANIFEST_DIR}"
        "--x-install-root=${_VCPKG_INSTALLED_DIR}"
        ${Z_VCPKG_FEATURE_FLAGS}
        ${Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS}
        ${VCPKG_INSTALL_OPTIONS}
    OUTPUT_VARIABLE Z_VCPKG_MANIFEST_INSTALL_LOGTEXT
    ERROR_VARIABLE Z_VCPKG_MANIFEST_INSTALL_LOGTEXT
    RESULT_VARIABLE Z_VCPKG_MANIFEST_INSTALL_RESULT
    ${Z_VCPKG_MANIFEST_INSTALL_ECHO_PARAMS}
)

The file foo.txt exists next to vcpkg.cmake and is is empty.

Running CMake with that works (using freshly downloaded vcpkg, not my local build):

A suitable version of 7zip was not found (required v23.1.0) Downloading portable 7zip 23.1.0...
Downloading 7zip...
https://www.7-zip.org/a/7z2301-extra.7z->C:\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z

Downloading https://www.7-zip.org/a/7z2301-extra.7z

[DEBUG] Trying to hash C:\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z.18452.part

[DEBUG] C:\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z.18452.part has hash c849c2cb489cf5b6eeb92bfbc27dcb37d0349c36971e1bc7ef32c7cde1b659e19e8b46d734ba90f47affe07fdfd5b4774cbfa0fdf4b681e9f60bb46bba1f7f9b

Extracting 7zip...

[DEBUG] 1000: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)

[DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after    18248 us

[DEBUG] 1001: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "C:\vcpkg_dev\test\vcpkg\downloads\7z2301-extra.7z")

[DEBUG] 1001: cmd_execute() returned 0 after 160728 us

Total install time: 1.9 us

I checked again and the handle is valid this time around.

I've reported this bug on the CMake issue tracker here: https://gitlab.kitware.com/cmake/cmake/-/issues/25625

HappySeaFox commented 10 months ago

@SamVanheer Thanks for the great investigation!

I've just cloned a fresh copy of vcpkg and installed CMake 3.23.4. I experience the same problem, so I guess it's not 3.28-specific.

[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from F:\projects\git.vcpkg.test\vcpkg-bundle.json
[DEBUG] Failed to open: F:\projects\git.vcpkg.test\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
[DEBUG] Using scripts-root: F:\projects\git.vcpkg.test\scripts
[DEBUG] Using builtin-ports: F:\projects\git.vcpkg.test\ports
[DEBUG] Using installed-root: F:\projects\git.vcpkg.test\installed
[DEBUG] Using buildtrees-root: F:\projects\git.vcpkg.test\buildtrees
[DEBUG] Using packages-root: F:\projects\git.vcpkg.test\packages
[DEBUG] Using vcpkg-root: F:\projects\git.vcpkg.test
[DEBUG] Using scripts-root: F:\projects\git.vcpkg.test\scripts
[DEBUG] Using builtin-registry: F:\projects\git.vcpkg.test\versions
[DEBUG] Using downloads-root: F:\projects\git.vcpkg.test\downloads
[DEBUG] Could not use IsWow64Process2, trying IsWow64Process
Computing installation plan...
[DEBUG] Loading dep info for: libpng:x64-windows sail:x64-windows
[DEBUG] Found path: C:\Program Files\CMake\bin\cmake.exe
[DEBUG] 1000: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)
[DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after    87348 us
[DEBUG] 1001: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)
[DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after    85120 us
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip->F:\projects\git.vcpkg.test\downloads\cmake-3.27.1-windows-i386.zip
Downloading https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip
[DEBUG] Trying to hash F:\projects\git.vcpkg.test\downloads\cmake-3.27.1-windows-i386.zip.8316.part
[DEBUG] F:\projects\git.vcpkg.test\downloads\cmake-3.27.1-windows-i386.zip.8316.part has hash a847f636fb27ba41ba9e6eaafa56937c614bcb39c6d0c9723241c229a9b0a77b4d00ebee88639561035d43f9aa64895f387eab56c628990c01191da57839cda0
Extracting cmake...
[DEBUG] Found path: C:\Program Files\CMake\bin\cmake.exe
[DEBUG] 1002: CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -E tar xzf "F:\projects\git.vcpkg.test\downloads\cmake-3.27.1-windows-i386.zip")
[DEBUG] 1002: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (Недостаточно системных ресурсов для завершения операции.)) after 992 us
'CMake' failed while extracting F:\projects\git.vcpkg.test\downloads\cmake-3.27.1-windows-i386.zip.
[DEBUG] D:\a\_work\1\s\src\vcpkg\archives.cpp(323): 
[DEBUG] Time in subprocesses: 173460us
[DEBUG] Time in parsing JSON: 640us
[DEBUG] Time in JSON reader: 818us
[DEBUG] Time in filesystem: 23640us
[DEBUG] Time in loading ports: 11680us
[DEBUG] Exiting after 8.3 s (8059194us)
> cmake --version
cmake version 3.23.4
SamVanheer commented 10 months ago

You're getting error 1450 when vcpkg calls CreateProcessW. That error is ERROR_NO_SYSTEM_RESOURCES, "Insufficient system resources exist to complete the requested service".

Both result in the same error message (failed while extracting) but the cause is completely different. Error 1450 is most likely caused by a problem with the local system rather than vcpkg or CMake. I searched for the error code and found that there could be several causes like the system running out of memory or disk space.

Given that you're running Windows 7 this may be caused by vcpkg relying on something that only newer versions of Windows can do, but i've no way to determine this.

You reported that older versions of vcpkg work so you could try checking which change causes the problem by finding the last working version and the first broken version, and then checking the changes made in-between until you find the commit where it first manifests the problem. You'll have to clone vcpkg-tool and build it locally to do this and jump back to older commits with Git.

Once you've found the commit it should be as simple as checking which changes were made. The cause is possibly the use of a Win32 API that has version-specific requirements or behavior but the cause may be at the start of a long chain of function calls that eventually pass data into a Win32 function.

Since i'm not getting this error (i'm on Windows 11) i can't do this myself.

HappySeaFox commented 10 months ago

Cannot build vcpkg-tool locally due to numerous

error C2370: 'vcpkg::all_define_metrics': redefinition; different storage class

errors. Tried the latest master and the 2023-08-09 tag. My MSVC is 2019.

SamVanheer commented 10 months ago

This happens because vcpkg has a lot of declarations that use extern const that are defined with constexpr which the 2019 compiler doesn't allow by default.

There is a compiler setting to allow for the correct behavior which is described here: https://learn.microsoft.com/en-us/cpp/build/reference/zc-externconstexpr?view=msvc-170

I tested it with 2019 and it does build with this setting enabled. 2022 enables this behavior through the /permissive- option which is the default.

I don't know which version of VS you're supposed to use when building vcpkg (should really be mentioned somewhere), perhaps there is a need to set that option in its CMakeLists.txt to make sure it still compiles properly when using older compilers.

SamVanheer commented 10 months ago

The problem in CMake is fixed and should be working correctly starting with version 3.28.2.

Based on some of the reports in this issue it's possible for vcpkg itself to encounter the same problem where the standard stream handles are invalid.

The CRT won't open the streams if there is no console: https://github.com/huangqinjin/ucrt/blob/f941b374deb33b1bce9c8d7e3064c7b652d172c4/stdio/_file.cpp#L97-L109

If vcpkg is launched without a console any processes created using cmd_execute_impl on Windows could inherit invalid handles which could cause error 87 to occur. I think there are multiple ways to solve this problem:

  1. check the streams when vcpkg starts and open them with dummy input/output so the handles are always valid regardless of how vcpkg is launched
  2. Filter out invalid handles in cmd_execute_impl

So, from what i can see there are 3 different causes of the "failed while extracting" error:

  1. CMake passing invalid handles (fixed)
  2. vcpkg starting with invalid/no handles
  3. Unknown cause that seems to happen on older versions of Windows resulting in error 1450

Note that users started getting error 1450 in the first vcpkg release after the one that started passing vcpkg's stdin handles to subprocesses: https://github.com/microsoft/vcpkg-tool/commit/81c8bedf74dd27b9c00b25e787256d98464e85d0

CMake changed how they pass handles starting with version 3.28 which is months after this problem was first reported so i doubt that is related to error 1450. But perhaps handle inheritance behavior was already broken on Windows 7 starting with vcpkg version 2023-09-15 because of this change in vcpkg itself?

The fastest way to find out would be to build vcpkg from the latest commit with handle inheritance disabled (note: you must also disable the attribute list being passed in according to this article) and then testing if it works. If it does, then something is going wrong with explicit handle inheritance on Windows 7.

I compared the current code with the article i linked and it looks just about the same, so it seems unlikely that this change is responsible but i can't test this myself due since i'm not getting that error myself. Anybody who is experiencing it should be able to test it using a custom built vcpkg.

If this isn't the cause then pinpointing the commit that introduces the problem is the way to identify the actual cause.

github-actions[bot] commented 4 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

greenozon commented 4 months ago

OK, got some time & desire to play again with this old issue...

so the thing is that the old issue when we have got an error on unpacking initial cmake archive is gone!

but seems like cmake guys changed the way they are unpacking the archive, they are not using anymore the

cmake.exe -E tar xzf      ...

but instead they started to use this:

7z.exe  x 

then above new approach - works

and ...... it still produces mysterious error 1450 but later on....

details

C:\Dev\vcpkg>vcpkg install ffmpeg:x64-windows --debug
[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Disabling metrics because vcpkg.disable-metrics exists
[DEBUG] Trying to load bundleconfig from C:\Dev\vcpkg\vcpkg-bundle.json
[DEBUG] Failed to open: C:\Dev\vcpkg\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
[DEBUG] Using scripts-root: C:\Dev\vcpkg\scripts
[DEBUG] Using builtin-ports: C:\Dev\vcpkg\ports
[DEBUG] Using installed-root: C:\Dev\vcpkg\installed
[DEBUG] Using buildtrees-root: C:\Dev\vcpkg\buildtrees
[DEBUG] Using packages-root: C:\Dev\vcpkg\packages
[DEBUG] Using vcpkg-root: C:\Dev\vcpkg
[DEBUG] Using scripts-root: C:\Dev\vcpkg\scripts
[DEBUG] Using builtin-registry: C:\Dev\vcpkg\versions
[DEBUG] Using downloads-root: C:\Dev\vcpkg\downloads
[DEBUG] Could not use IsWow64Process2, trying IsWow64Process
[DEBUG] Could not use IsWow64Process2, trying IsWow64Process
Computing installation plan...
[DEBUG] Loading dep info for: pkgconf:x64-windows vcpkg-pkgconfig-get-modules:x64-windows vcpkg-tool-meson:x64-windows
A suitable version of cmake was not found (required v3.29.2) Downloading portable cmake 3.29.2...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-windows-i386.zip->C:\Dev\vcpkg\downloads\cmake-3.29.2-windows-i386.zip
Downloading https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-windows-i386.zip
[DEBUG] Trying to hash C:\Dev\vcpkg\downloads\cmake-3.29.2-windows-i386.zip.7360.part
[DEBUG] C:\Dev\vcpkg\downloads\cmake-3.29.2-windows-i386.zip.7360.part has hash 562de7b577c99fe347b00437d14ce375a8e5a60504909cb67d2f73c372d39a2f76d2b42b69e4aeb31a4879e1bcf6f7c2d41f2ace12180ea83ba7af48
879d40ab
Extracting cmake...
A suitable version of 7zip_msi was not found (required v24.6.0) Downloading portable 7zip_msi 24.6.0...
Downloading 7zip_msi...
https://github.com/ip7z/7zip/releases/download/24.06/7z2406-x64.msi->C:\Dev\vcpkg\downloads\7z2406-x64.msi
Downloading https://github.com/ip7z/7zip/releases/download/24.06/7z2406-x64.msi
[DEBUG] Trying to hash C:\Dev\vcpkg\downloads\7z2406-x64.msi.7360.part
[DEBUG] C:\Dev\vcpkg\downloads\7z2406-x64.msi.7360.part has hash d5eb068a4a488ca1c6025230be9f9cfbc99bf13a2230c0edc69d014f63f2f15c6582050dcaf11e77b1a13df38e2be324a4590e6ea78852b6fcaa91681729326f
Extracting 7zip_msi...
[DEBUG] 1000: CreateProcessW(cmd /c msiexec /a "C:\Dev\vcpkg\downloads\7z2406-x64.msi" /qn TARGETDIR="C:\Dev\vcpkg\downloads\tools\7zip_msi-24.06-windows.partial.7360")
[DEBUG] 1000: cmd_execute_and_stream_data() returned 0 after   414886 us
[DEBUG] 1001: CreateProcessW("C:\Dev\vcpkg\downloads\tools\7zip_msi-24.06-windows\Files\7-Zip\7z.exe" x "C:\Dev\vcpkg\downloads\cmake-3.29.2-windows-i386.zip" "-oC:\Dev\vcpkg\downloads\tools\cmake-3.2
9.2-windows.partial.7360" -y)
[DEBUG] 1001: cmd_execute_and_stream_data() returned 0 after  4389520 us
[DEBUG] 1002: CreateProcessW("C:\Dev\vcpkg\downloads\tools\cmake-3.29.2-windows\cmake-3.29.2-windows-i386/bin/cmake.exe" --version)
[DEBUG] 1002: cmd_execute_and_stream_data() returned 0 after    91020 us
[DEBUG] 1003: CreateProcessW("C:\Dev\vcpkg\downloads\tools\cmake-3.29.2-windows\cmake-3.29.2-windows-i386/bin/cmake.exe" -DVCPKG_ROOT_DIR=C:/Dev/vcpkg -DPACKAGES_DIR=C:/Dev/vcpkg/packages -DBUILDTREES
_DIR=C:/Dev/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=C:/Dev/vcpkg/installed -DDOWNLOADS=C:/Dev/vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P "C:\Dev\vcpkg\buildtrees\0.vcpkg_dep_info.cmake")
[DEBUG] 1003: cmd_execute_and_stream_data() returned 0 after    25062 us
[DEBUG] 1004: CreateProcessW("C:\Dev\vcpkg\downloads\tools\cmake-3.29.2-windows\cmake-3.29.2-windows-i386/bin/cmake.exe" -DVCPKG_ROOT_DIR=C:/Dev/vcpkg -DPACKAGES_DIR=C:/Dev/vcpkg/packages -DBUILDTREES
_DIR=C:/Dev/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=C:/Dev/vcpkg/installed -DDOWNLOADS=C:/Dev/vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P "C:\Dev\vcpkg\buildtrees\0.vcpkg_tags.cmake")
[DEBUG] 1004: cmd_execute_and_stream_data() returned 0 after    26756 us
The following packages will be built and installed:
    ffmpeg[avcodec,avdevice,avfilter,avformat,core,swresample,swscale]:x64-windows@6.1.1#11

...............  skipped a lot of logs  .............

A suitable version of 7zip was not found (required v24.6.0) Downloading portable 7zip 24.6.0...
[DEBUG] Trying to hash C:\Dev\vcpkg\downloads\7z2406-extra.7z
[DEBUG] C:\Dev\vcpkg\downloads\7z2406-extra.7z has hash 6b88a761f7cc8b8affc074b24750bcdc65cc3ab18d127c8bfdd1eca953d43e21558eb1137c4b934689990564d7d24cf14e249a773dc1e5ddb7316b10d73682f8
Extracting 7zip...
[DEBUG] 1010: CreateProcessW("C:\Dev\vcpkg\downloads\tools\cmake-3.29.2-windows\cmake-3.29.2-windows-i386/bin/cmake.exe" -E tar xzf "C:\Dev\vcpkg\downloads\7z2406-extra.7z")
[DEBUG] 1010: cmd_execute() returned (error: calling CreateProcessW failed with 1450 (unknown error)) after 5231 us
'CMake' failed while extracting C:\Dev\vcpkg\downloads\7z2406-extra.7z.
[DEBUG] D:\a\_work\1\s\src\vcpkg\archives.cpp(322):
[DEBUG] Time in subprocesses: 6490609us
[DEBUG] Time in parsing JSON: 1313us
[DEBUG] Time in JSON reader: 912us
[DEBUG] Time in filesystem: 14680us
[DEBUG] Time in loading ports: 5657us
[DEBUG] Exiting after 14 s (14344136us)

No way!!!

it still fails on the same pattern as 3.28.1 !!!!

-E tar xzf

any ideas?

hiqiyu commented 3 months ago

OS: Windows 7 x64 sp3 Compiler: MSVS 2015 PowerShell 5.1 Same problem, I manually extracted 7Z2406-extra-7z, then renamed 7zP-24.06-windows and put it into the tools directory. Normal operation

greenozon commented 3 months ago

I was poking around and found similar issue in go repo 1450 ERROR_NO_SYSTEM_RESOURCES

https://github.com/golang/go/issues/45914

Loos like this is purely Windows 7 issue and who knows how to fix andd whether it'll be fixed ever.... time flies too fast

maybe there wil be someone brave enough to make it happen :)