microsoft / vcpkg

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

[x264] build failure on x86-windows-static when WSL2 is installed #29658

Closed julianxhokaxhiu closed 1 year ago

julianxhokaxhiu commented 1 year ago

Host Environment

To Reproduce

Steps to reproduce the behavior:

./vcpkg install x264[asm,core,default-features]:x86-windows-static

Failure logs

Console output:

[cmake] Building x264[asm,core,default-features]:x86-windows-static...
[cmake] warning: -- Using community triplet x86-windows-static. This triplet configuration is not guaranteed to succeed.
[cmake] -- [COMMUNITY] Loading triplet configuration from: C:\vcpkg\triplets\community\x86-windows-static.cmake
[cmake] -- Installing port from location: C:\vcpkg\buildtrees\versioning_\versions\x264\4ff53c90cd7222ae9d3e8dc579c1d198715585c2
[cmake] -- Downloading mirror-x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz...
[cmake] -- Extracting source C:/vcpkg/downloads/mirror-x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz
[cmake] -- Applying patch uwp-cflags.patch
[cmake] -- Applying patch parallel-install.patch
[cmake] -- Applying patch allow-clang-cl.patch
[cmake] -- Applying patch configure-as.patch
[cmake] -- Using source at C:/vcpkg/buildtrees/x264/src/e867b0ff7f-fb2486f1d0.clean
[cmake] -- Found external ninja('1.11.0').
[cmake] -- Getting CMake variables for x86-windows-static
[cmake] -- Getting CMake variables for x86-windows-static
[cmake] -- Downloading msys-gzip-1.11-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-bash-5.1.008-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-autoconf-2.71-3-any.pkg.tar.zst...
[cmake] -- Downloading msys-diffutils-3.8-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-binutils-2.37-5-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-libtool-2.4.7-3-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-file-5.41-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-zlib-1.2.11-1-x86_64.pkg.tar.xz...
[cmake] -- Downloading msys-libbz2-1.0.8-3-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-coreutils-8.32-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-grep-3.0-2-x86_64.pkg.tar.xz...
[cmake] -- Downloading msys-sed-4.8-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-libpcre-8.45-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-m4-1.4.19-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-automake-wrapper-11-4-any.pkg.tar.zst...
[cmake] -- Downloading msys-gawk-5.1.0-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-mpfr-4.1.0-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-gmp-6.2.1-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-libreadline-8.1.001-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-ncurses-6.2-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-automake1.16-1.16.3-3-any.pkg.tar.zst...
[cmake] -- Downloading msys-perl-5.32.1-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-libcrypt-2.1-3-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-pkg-config-0.29.2-4-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-make-4.3-3-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-findutils-4.8.0-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-libintl-0.21-1-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-libiconv-1.16-2-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-gcc-libs-11.2.0-3-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst...
[cmake] -- Downloading msys-which-2.21-4-x86_64.pkg.tar.zst...
[cmake] -- Applying patch C:/vcpkg/scripts/msys/compile_wrapper_consider_clang-cl.patch
[cmake] -- Using msys root at C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5
[cmake] -- Downloading msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst...
[cmake] -- Downloading msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst...
[cmake] -- Using msys root at C:/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
[cmake] -- Configuring x86-windows-static-dbg
[cmake] CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
[cmake]     Command failed: C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin/bash.exe --noprofile --norc --debug -c "V=1 CPP='cl.exe -E' CC='cl.exe' CC_FOR_BUILD='touch a.out | touch conftest.exe | true' CPP_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX='cl.exe' RC='rc.exe' WINDRES='rc.exe' AR='lib.exe' LD='link.exe -verbose' RANLIB=':' STRIP=':' NM='dumpbin.exe -symbols -headers' DLLTOOL='link.exe -verbose -dll' CCAS=':' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' ./../src/e867b0ff7f-fb2486f1d0.clean/configure --build=x86_64-pc-mingw32 --host=i686-pc-mingw32 \"--disable-lavf\" \"--disable-swscale\" \"--disable-avs\" \"--disable-ffms\" \"--disable-gpac\" \"--disable-lsmash\" \"--disable-bashcompletion\" \"ac_cv_prog_ac_ct_STRIP=:\" \"gl_cv_double_slash_root=yes\" \"ac_cv_func_memmove=yes\" \"--disable-silent-rules\" \"--verbose\" \"--disable-shared\" \"--enable-static\" \"--enable-debug\" \"--disable-cli\" \"--prefix=/C/Users/julia/source/repos/julianxhokaxhiu/FFNx/.build/vcpkg_installed/x86-windows-static/debug\""
[cmake]     Working Directory: C:/vcpkg/buildtrees/x264/x86-windows-static-dbg
[cmake]     Error code: 2
[cmake]     See logs for more information:
[cmake]       C:\vcpkg\buildtrees\x264\config-x86-windows-static-dbg-err.log
[cmake] 
[cmake] Call Stack (most recent call first):
[cmake]   scripts/cmake/vcpkg_configure_make.cmake:812 (vcpkg_execute_required_process)
[cmake]   buildtrees/versioning_/versions/x264/4ff53c90cd7222ae9d3e8dc579c1d198715585c2/portfile.cmake:88 (vcpkg_configure_make)
[cmake]   scripts/ports.cmake:147 (include)
[cmake] 
[cmake] 
[cmake] error: building x264:x86-windows-static failed with: BUILD_FAILED
[cmake] error: Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
[cmake] Then check for known issues at:
[cmake]     https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+x264
[cmake] You can submit a new issue at:
[cmake]     https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[x264]+Build+error
[cmake] Include '[x264] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
[cmake]     vcpkg-tool version: 2023-01-24-8a88d63f241d391772fbde69af9cab96c3c64c75
[cmake]     vcpkg-scripts version: 93895b28e 2023-02-14 (3 hours ago)
[cmake] 
[cmake] 
[cmake] Please use the prefilled template from C:\Users\julia\source\repos\julianxhokaxhiu\FFNx\.build\vcpkg_installed\vcpkg\issue_body.md when reporting your issue.
[cmake] -- Running vcpkg install - failed
[cmake] CMake Error at C:/vcpkg/scripts/buildsystems/vcpkg.cmake:883 (message):
[cmake]   vcpkg install failed.  See logs for more information:
[cmake]   C:\Users\julia\source\repos\julianxhokaxhiu\FFNx\.build\vcpkg-manifest-install.log
[cmake] Call Stack (most recent call first):
[cmake]   C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeDetermineSystem.cmake:124 (include)
[cmake]   CMakeLists.txt:63 (project)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!

stdout-x86-windows-static.log

-- Downloading mirror-x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz...
-- Extracting source C:/vcpkg/downloads/mirror-x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz
-- Applying patch uwp-cflags.patch
-- Applying patch parallel-install.patch
-- Applying patch allow-clang-cl.patch
-- Applying patch configure-as.patch
-- Using source at C:/vcpkg/buildtrees/x264/src/e867b0ff7f-fb2486f1d0.clean
-- Found external ninja('1.11.0').
-- Getting CMake variables for x86-windows-static
-- Getting CMake variables for x86-windows-static
-- Downloading msys-gzip-1.11-1-x86_64.pkg.tar.zst...
-- Downloading msys-bash-5.1.008-1-x86_64.pkg.tar.zst...
-- Downloading msys-autoconf-2.71-3-any.pkg.tar.zst...
-- Downloading msys-diffutils-3.8-2-x86_64.pkg.tar.zst...
-- Downloading msys-binutils-2.37-5-x86_64.pkg.tar.zst...
-- Downloading msys-libtool-2.4.7-3-x86_64.pkg.tar.zst...
-- Downloading msys-file-5.41-2-x86_64.pkg.tar.zst...
-- Downloading msys-zlib-1.2.11-1-x86_64.pkg.tar.xz...
-- Downloading msys-libbz2-1.0.8-3-x86_64.pkg.tar.zst...
-- Downloading msys-coreutils-8.32-2-x86_64.pkg.tar.zst...
-- Downloading msys-grep-3.0-2-x86_64.pkg.tar.xz...
-- Downloading msys-sed-4.8-2-x86_64.pkg.tar.zst...
-- Downloading msys-libpcre-8.45-1-x86_64.pkg.tar.zst...
-- Downloading msys-m4-1.4.19-2-x86_64.pkg.tar.zst...
-- Downloading msys-automake-wrapper-11-4-any.pkg.tar.zst...
-- Downloading msys-gawk-5.1.0-2-x86_64.pkg.tar.zst...
-- Downloading msys-mpfr-4.1.0-1-x86_64.pkg.tar.zst...
-- Downloading msys-gmp-6.2.1-1-x86_64.pkg.tar.zst...
-- Downloading msys-libreadline-8.1.001-1-x86_64.pkg.tar.zst...
-- Downloading msys-ncurses-6.2-2-x86_64.pkg.tar.zst...
-- Downloading msys-automake1.16-1.16.3-3-any.pkg.tar.zst...
-- Downloading msys-perl-5.32.1-2-x86_64.pkg.tar.zst...
-- Downloading msys-libcrypt-2.1-3-x86_64.pkg.tar.zst...
-- Downloading msys-pkg-config-0.29.2-4-x86_64.pkg.tar.zst...
-- Downloading msys-make-4.3-3-x86_64.pkg.tar.zst...
-- Downloading msys-findutils-4.8.0-1-x86_64.pkg.tar.zst...
-- Downloading msys-libintl-0.21-1-x86_64.pkg.tar.zst...
-- Downloading msys-libiconv-1.16-2-x86_64.pkg.tar.zst...
-- Downloading msys-gcc-libs-11.2.0-3-x86_64.pkg.tar.zst...
-- Downloading msys-msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst...
-- Downloading msys-which-2.21-4-x86_64.pkg.tar.zst...
-- Applying patch C:/vcpkg/scripts/msys/compile_wrapper_consider_clang-cl.patch
-- Using msys root at C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5
-- Downloading msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst...
-- Downloading msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst...
-- Using msys root at C:/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Configuring x86-windows-static-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin/bash.exe --noprofile --norc --debug -c "V=1 CPP='cl.exe -E' CC='cl.exe' CC_FOR_BUILD='touch a.out | touch conftest.exe | true' CPP_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX='cl.exe' RC='rc.exe' WINDRES='rc.exe' AR='lib.exe' LD='link.exe -verbose' RANLIB=':' STRIP=':' NM='dumpbin.exe -symbols -headers' DLLTOOL='link.exe -verbose -dll' CCAS=':' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' ./../src/e867b0ff7f-fb2486f1d0.clean/configure --build=x86_64-pc-mingw32 --host=i686-pc-mingw32 \"--disable-lavf\" \"--disable-swscale\" \"--disable-avs\" \"--disable-ffms\" \"--disable-gpac\" \"--disable-lsmash\" \"--disable-bashcompletion\" \"ac_cv_prog_ac_ct_STRIP=:\" \"gl_cv_double_slash_root=yes\" \"ac_cv_func_memmove=yes\" \"--disable-silent-rules\" \"--verbose\" \"--disable-shared\" \"--enable-static\" \"--enable-debug\" \"--disable-cli\" \"--prefix=/C/Users/julia/source/repos/julianxhokaxhiu/FFNx/.build/vcpkg_installed/x86-windows-static/debug\""
    Working Directory: C:/vcpkg/buildtrees/x264/x86-windows-static-dbg
    Error code: 2
    See logs for more information:
      C:\vcpkg\buildtrees\x264\config-x86-windows-static-dbg-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_make.cmake:812 (vcpkg_execute_required_process)
  buildtrees/versioning_/versions/x264/4ff53c90cd7222ae9d3e8dc579c1d198715585c2/portfile.cmake:88 (vcpkg_configure_make)
  scripts/ports.cmake:147 (include)

config-x86-windows-static-dbg-err.log

./../src/e867b0ff7f-fb2486f1d0.clean/configure: line 3: $'\r': command not found
./../src/e867b0ff7f-fb2486f1d0.clean/configure: line 65: syntax error near unexpected token `$'{\r''
./../src/e867b0ff7f-fb2486f1d0.clean/configure: line 65: `log_check() {
'

Additional context

This is the vcpkg.json manifest.

jimwang118 commented 1 year ago

image As shown above, I did not reproduce your installation problem, could you please provide your system version?

julianxhokaxhiu commented 1 year ago

I'm on Windows 11 Pro x64 22H2 if that helps

Microsoft Windows [Versione 10.0.22621.1265]
(c) Microsoft Corporation. Tutti i diritti riservati.

> vcpkg version
vcpkg package management program version 2023-01-24-8a88d63f241d391772fbde69af9cab96c3c64c75

> cmake --version
cmake version 3.25.2

CMake suite maintained and supported by Kitware (kitware.com/cmake)

Let me know if there's a better way to dump debugging info. Weird though, I'm able to hit this 100% of the time. Maybe one thing to notice is that I use VSCode with the Cmake extension which triggers the build, but I don't think it's related to it. I'll give it a try to trigger a build manually from the console. Thanks for the feedback in the meantime.

//EDIT: I tested the console and it's still the same issue, so it's not related to VSCode and the CMake extension. Maybe I need to give you the full picture. As you notice from the manifest I'm actually building x264 as part of the dependency to ffmpeg, but I think it shouldn't make a difference the way you install the port as long as you use the right options and triplet, you should be able to repro it.

//EDIT2: I tested to install it on a completely new folder totally separate from my own current project and it fails equally the same:

$ vcpkg install x264[asm,core,default-features]:x86-windows-static
Computing installation plan...
The following packages will be built and installed:
  * vcpkg-cmake[core]:x64-windows -> 2022-12-22
  * vcpkg-cmake-get-vars[core]:x64-windows -> 2022-12-16
    x264[asm,core,default-features]:x86-windows-static -> 0.164.3095#2
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows-static...
A suitable version of 7zip was not found (required v21.7.0) Downloading portable 7zip 21.7.0...
Downloading 7zip...
https://www.7-zip.org/a/7z2107-extra.7z->C:\vcpkg\downloads\7z2107-extra.7z
Downloading https://www.7-zip.org/a/7z2107-extra.7z
Extracting 7zip...
Restored 2 package(s) from C:\Users\julia\AppData\Local\vcpkg\archives in 779.6 ms. Use --debug to see more details.
Installing 1/3 vcpkg-cmake:x64-windows...
Elapsed time to handle vcpkg-cmake:x64-windows: 6.603 ms
Installing 2/3 vcpkg-cmake-get-vars:x64-windows...
Elapsed time to handle vcpkg-cmake-get-vars:x64-windows: 5.868 ms
Installing 3/3 x264:x86-windows-static...
Building x264[asm,core,default-features]:x86-windows-static...
warning: -- Using community triplet x86-windows-static. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: C:\vcpkg\triplets\community\x86-windows-static.cmake
-- Downloading https://github.com/mirror/x264/archive/baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz -> mirror-x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz...
-- Extracting source C:/vcpkg/downloads/mirror-x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz
-- Applying patch uwp-cflags.patch
-- Applying patch parallel-install.patch
-- Applying patch allow-clang-cl.patch
-- Applying patch configure-as.patch
-- Using source at C:/vcpkg/buildtrees/x264/src/e867b0ff7f-fb2486f1d0.clean
-- Found external ninja('1.11.0').
-- Getting CMake variables for x86-windows-static
-- Downloading https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip -> nasm-2.16.01-win64.zip...
-- Getting CMake variables for x86-windows-static
-- Downloading https://repo.msys2.org/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst -> msys-gzip-1.11-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst -> msys-bash-5.1.008-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst -> msys-autoconf-2.71-3-any.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst -> msys-diffutils-3.8-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst -> msys-binutils-2.37-5-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst -> msys-libtool-2.4.7-3-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst -> msys-file-5.41-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz;https://mirror.bit.edu.cn/msys2/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz;https://mirror.selfnet.de/msys2/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz -> msys-zlib-1.2.11-1-x86_64.pkg.tar.xz...
-- Downloading https://repo.msys2.org/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst -> msys-libbz2-1.0.8-3-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst -> msys-coreutils-8.32-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz;https://mirror.bit.edu.cn/msys2/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz;https://mirror.selfnet.de/msys2/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz -> msys-grep-3.0-2-x86_64.pkg.tar.xz...
-- Downloading https://repo.msys2.org/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst -> msys-sed-4.8-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst -> msys-libpcre-8.45-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst -> msys-m4-1.4.19-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst -> msys-automake-wrapper-11-4-any.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst -> msys-gawk-5.1.0-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst -> msys-mpfr-4.1.0-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst -> msys-gmp-6.2.1-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst -> msys-libreadline-8.1.001-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst -> msys-ncurses-6.2-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst -> msys-automake1.16-1.16.3-3-any.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst -> msys-perl-5.32.1-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst -> msys-libcrypt-2.1-3-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst -> msys-pkg-config-0.29.2-4-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst -> msys-make-4.3-3-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst -> msys-findutils-4.8.0-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst -> msys-libintl-0.21-1-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst -> msys-libiconv-1.16-2-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst -> msys-gcc-libs-11.2.0-3-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst -> msys-msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst...
-- Downloading https://repo.msys2.org/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/x86_64/which-2.21-4-x86_64.pkg.tar.zst -> msys-which-2.21-4-x86_64.pkg.tar.zst...
-- Applying patch C:/vcpkg/scripts/msys/compile_wrapper_consider_clang-cl.patch
-- Using msys root at C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5
-- Downloading https://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst -> msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst...
-- Downloading https://repo.msys2.org/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst -> msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst...
-- Using msys root at C:/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Configuring x86-windows-static-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin/bash.exe --noprofile --norc --debug -c "V=1 CPP='cl.exe -E' CC='cl.exe' CC_FOR_BUILD='touch a.out | touch conftest.exe | true' CPP_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX='cl.exe' RC='rc.exe' WINDRES='rc.exe' AR='lib.exe' LD='link.exe -verbose' RANLIB=':' STRIP=':' NM='dumpbin.exe -symbols -headers' DLLTOOL='link.exe -verbose -dll' CCAS=':' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' ./../src/e867b0ff7f-fb2486f1d0.clean/configure --build=x86_64-pc-mingw32 --host=i686-pc-mingw32 \"--disable-lavf\" \"--disable-swscale\" \"--disable-avs\" \"--disable-ffms\" \"--disable-gpac\" \"--disable-lsmash\" \"--disable-bashcompletion\" \"ac_cv_prog_ac_ct_STRIP=:\" \"gl_cv_double_slash_root=yes\" \"ac_cv_func_memmove=yes\" \"--disable-silent-rules\" \"--verbose\" \"--disable-shared\" \"--enable-static\" \"--enable-debug\" \"--disable-cli\" \"--prefix=/C/vcpkg/installed/x86-windows-static/debug\""
    Working Directory: C:/vcpkg/buildtrees/x264/x86-windows-static-dbg
    Error code: 2
    See logs for more information:
      C:\vcpkg\buildtrees\x264\config-x86-windows-static-dbg-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_make.cmake:812 (vcpkg_execute_required_process)
  ports/x264/portfile.cmake:88 (vcpkg_configure_make)
  scripts/ports.cmake:147 (include)

error: building x264:x86-windows-static failed with: BUILD_FAILED
error: Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+x264
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[x264]+Build+error
Include '[x264] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
    vcpkg-tool version: 2023-01-24-8a88d63f241d391772fbde69af9cab96c3c64c75
    vcpkg-scripts version: 959f8e317 2023-02-15 (2 days ago)

Please use the prefilled template from C:\vcpkg\installed\vcpkg\issue_body.md when reporting your issue.

I'm on the vcpkg@master branch at this commit: 959f8e317599dd439bc86f5cb5f0aca648d88c3f

julianxhokaxhiu commented 1 year ago

I did some further investigations around this issue and it looks like my configure file is being generated using the Windows new-line (CRLF) instead of the Unix one (LF) so of course the bash interpreter is now confused and sees \r as a command to execute.

Question now is: why is this happening and before it was not?

//EDIT: I also double checked that the official configure file from mirror/x264 comes with LF set, so vcpkg is deleting that file and running autoconf, which is somehow generating the file with CRLF. Not sure why though as all of this is run inside msys2 which should technically NOT produce CRLF files...or?

//EDIT2: Ok double confirmed it is NOT being generated as I initially thought but the configure file is used as it is...it's super weird though that instead of being extracted as LF file it is being extracted as CRLF...what is going on :|

julianxhokaxhiu commented 1 year ago

I found the culprit! This line on the portfile ( https://github.com/microsoft/vcpkg/blob/master/ports/x264/portfile.cmake#L14 ) is actually touching my configure file and saving it with CRLF.

Looking a the function definition, it seems to use pure Cmake logics ( https://github.com/microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_replace_string.cmake ) so I wonder if there's a way to enforce CMake to save using LF instead of CRLF on Windows.

IMHO this is a vcpkg bug and should be fixed within the vcpkg_replace_string function.

//EDIT: Looks like there is a way using configure_file which is also suggested by them as per doc:

If the file is a build input, use the [configure_file()](https://cmake.org/cmake/help/latest/command/configure_file.html#command:configure_file) command to update the file only when its content changes.

Ref. https://cmake.org/cmake/help/latest/command/file.html#writing

//EDIT2: Even easier, it's enough to add the NEWLINE_STYLE UNIX attribute on the file() call. I'll create a PR. //EDIT3: Nope, CMake doesn't allow that for file(WRITE ...) 🙃

//EDIT4: I created a super simple example in CMake to replicate this issue on my own end but CMake is saving the file using LF correctly:

cmake_minimum_required(VERSION 3.25)
project(test)
file(WRITE "test.txt" "hello world")

Somehow vcpkg is enforcing my cmake to use CRLF but...how?

//EDIT5: I created a small project and I finally managed to replicate the issue. It seems to be related on how the file is being read and its content stored in the variable! example.zip

dg0yt commented 1 year ago

I found the culprit! This line on the portfile ( https://github.com/microsoft/vcpkg/blob/master/ports/x264/portfile.cmake#L14 ) is actually touching my configure file and saving it with CRLF.

Thanks for the investigation. The build is meant to use bash from MSYS2, and this tool has no problems with CRLF line endings. Maybe there is something unusual in your setup w.r.t. to which env or bash is actually called. Can you disclose your PATH? Something from Scoop or similar tools?

julianxhokaxhiu commented 1 year ago

Thanks for coming back @dg0yt, as you can see per my example you're able to replicate this issue also using my simple CMake project. I've got nothing fancy installed, I used the official CMake from their website ( https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2-windows-x86_64.msi ), Git for Windows ( https://github.com/git-for-windows/git/releases/download/v2.39.2.windows.1/Git-2.39.2-64-bit.exe ) and Visual Studio 2022.

I even uninstalled CMake and Git on my own side to make sure it wasn't that one and vcpkg was still failing. IMHO it is how we replace strings using CMake, the pattern used in vcpkg_replace_string seems to be a community-wide approach on CMake ( known as "sed free replacement" ) but I think doesn't consider the Windows use-case ( or no one ever used this method on a file that is meant to be executed ). Assuming bash inside msys2 is happy with \r chars inside ( which I don't think so ) then this should be executed, but instead it fails.

I even tested step by step by:

Can you at least try to run my example project on your own end? All you need is Windows and Cmake installation. Nothing else.

Thank you in advance!

dg0yt commented 1 year ago

I haven't got a MSVC toolchain, but this port builds in vcpkg CI at least three times a week, so there isn't much too learn from that POV. And there are countless uses of vcpkg_replace_string pattern, this is a proven function. What I did verify on Windows before posting is that msys2 bash doesn't complain about CRLF line endings. My mingw toolchain on Windows builds the port successfully with CRLF line endings.

So that's why the focus is on why it doesn't work on your machine. Again, disclose your PATH, or check it yourself. You may also do the check into the portfile. But this shouldn't find anything, because msys2 isn't added to the PATH before vcpkg_configure_make...

find_program(CHECK_ENV NAMES env PATHS ENV PATH NO_DEFAULT_PATH)
message(STATUS "Got env: ${CHECK_ENV}")
find_program(CHECK_BASH NAMES bash PATHS ENV PATH NO_DEFAULT_PATH)
message(STATUS "Got bash: ${CHECK_BASH}")
julianxhokaxhiu commented 1 year ago

To be honest I don't think is anything special in my own machine as the vcpkg build is run inside the msys2 environment provided by vcpkg itself, as you can see from the log.

This is my PATH:

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\PuTTY\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\vcpkg;C:\Program Files\Git\cmd;C:\Program Files\CMake\bin;C:\Users\julia\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\julia\AppData\Local\Programs\Python\Python311\;C:\Users\julia\AppData\Local\Microsoft\WindowsApps;C:\Users\julia\.dotnet\tools;C:\Users\julia\source\repos\julianxhokaxhiu\bx\tools\bin\windows;C:\Users\julia\Documents\PowerShell\Scripts;C:\Users\julia\.dotnet\tools

As I mentioned before I uninstalled both Git and Cmake earlier to exclude them from the equation and it's still failing. I'll try to run now a custom script made with CRLF on top of the bash provided by msys to ensure it really runs those scripts or not.

Regaring CI setup: the machines you use comes provided with tooling already installed. Maybe the msys2 installation is configured to run CRLF anyway but maybe this behavior doesn't come by default, on the env vcpkg configures and provides automatically. So I wouldn't take this as granted at least for now.

dg0yt commented 1 year ago

Regaring CI setup: the machines you use comes provided with tooling already installed. Maybe the msys2 installation is configured to run CRLF anyway but maybe this behavior doesn't come by default, on the env vcpkg configures and provides automatically. So I wouldn't take this as granted at least for now.

Note that CI is not using the standard AZP images. It doesn't come with any msys.

dg0yt commented 1 year ago

I guess this is how msys solves the CRLF issue: https://github.com/msys2/MSYS2-packages/blob/master/bash/0005-bash-4.3-msys2-fix-lineendings.patch (Found via https://github.com/microsoft/WSL/issues/5032)

The situation is as follows:

There are some operations which modify PATH before calling configure. You may also try to use the editable option. It switches to a permanent source dir which isn't cleaned between build attempts (but still subject to vcpkg_replace_string). So you can instrument configure with additional diagnostics.

julianxhokaxhiu commented 1 year ago

Thanks, I'll try that scenario so at least I can attempt to replicate what is going on. I was trying to create a simple env where I could replicate this behavior, but ironically everything works:

cmake_minimum_required(VERSION 3.25)
project(test)
file(READ "test.sh.in" contents)
string(REPLACE [[/bin/bash]] [[/usr/bin/env bash]] contents "${contents}")
file(WRITE "test.sh" "${contents}")
execute_process(
  COMMAND C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin/bash.exe --noprofile --norc --debug -c './test.sh'
  OUTPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/stdout.log"
  ERROR_FILE "${CMAKE_CURRENT_SOURCE_DIR}/stderr.log"
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

test.sh.in ( saved with LF file ending )

#!/bin/bash
echo "Hello world!"

Let's see what we get out of the port env...

julianxhokaxhiu commented 1 year ago

Oh wow, looks like bash via CMake is calling my WSL bash process, this is why it's complaining!

I managed to replace the configure content with just printenv and this what I got:

SHELL=/bin/bash
WSL2_GUI_APPS_ENABLED=1
WSL_DISTRO_NAME=Arch
PWD=/mnt/c/vcpkg/buildtrees/x264/x86-windows-static-dbg
LOGNAME=dev
_=/usr/sbin/printenv
HOME=/home/dev
...

I wonder how this happens though because when I run the same bash line on CMake above it doesn't happen. Is vcpkg picking the WSL setup somehow automatically?

//EDIT: Ohhhhh looks like that based on my PATH setup bash points to the WSL one, and since vcpkg is not specifying an absolute path on the cmake command, but calling it using just bash it goes through WSL 🤦 is it possible to enforce vcpkg to use its own bash for eg. here?

//EDIT2: Probably a simpler way would be to prepend the msys path to the PATH env var so when CMake runs bash it will pick that one instead of WSL. The problem I have also is that I can't remove the bash.exe alias from C:\Windows\System32 under Windows 11, I think it was possible under Windows 10 and that's how probably I fixed the issue back then.

dg0yt commented 1 year ago

bash.exe alias from C:\Windows\System32

:eyes: The PATH stuff on Windows is quite sensitive, in particular with MSYS2 which needs to use the right subsystem DLLs with its executables. AFAICT vcpkg_configure_make tries to insert MSYS2 paths just in front of C:\Windows\System32.

However, many portfile scripts look for additonal tools, and sometimes do prepend the tools' directories to PATH.

For x264, the following tools will have their dir prepended to PATH when their path contains spaces:

julianxhokaxhiu commented 1 year ago

Right but that happens until the first bash session is launched, and in fact we can see that happening here:

$ C:/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin/bash.exe --noprofile --norc --debug -c "V=1 CPP='cl.exe -E' CC='cl.exe' CC_FOR_BUILD='touch a.out | touch conftest.exe | true' CPP_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX_FOR_BUILD='touch a.out | touch conftest.exe | true' CXX='cl.exe' RC='rc.exe' WINDRES='rc.exe' AR='lib.exe' LD='link.exe -verbose' RANLIB=':' STRIP=':' NM='dumpbin.exe -symbols -headers' DLLTOOL='link.exe -verbose -dll' CCAS=':' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' AS='C:/vcpkg/downloads/tools/nasm/nasm-2.16.01/nasm.exe' ./../src/e867b0ff7f-fb2486f1d0.clean/configure --build=x86_64-pc-mingw32 --host=i686-pc-mingw32 \"--disable-lavf\" \"--disable-swscale\" \"--disable-avs\" \"--disable-ffms\" \"--disable-gpac\" \"--disable-lsmash\" \"--disable-bashcompletion\" \"ac_cv_prog_ac_ct_STRIP=:\" \"gl_cv_double_slash_root=yes\" \"ac_cv_func_memmove=yes\" \"--disable-silent-rules\" \"--verbose\" \"--disable-shared\" \"--enable-static\" \"--enable-debug\" \"--disable-cli\" \"--prefix=/C/Users/julia/source/repos/julianxhokaxhiu/FFNx/.build/vcpkg_installed/x86-windows-static/debug\""

Problem is that when it detects the /usr/bin/env bash line I think executes the WSL bash and it is where everything is run later. I'm not really sure what is going on and how those are linked but I wonder if I'm the first one to ever encounter this. Doesn't make much sense to me...

//EDIT2: I start to wonder if this behavior was happening since the beginning but I'm the first to notice because most probably who uses vcpkg does not have WSL installed and/or with the bash.exe symlink in C:\Windows\System32. And funny fact, if we comment the line https://github.com/microsoft/vcpkg/blob/master/ports/x264/portfile.cmake#L14 this whole thing still works, even under WSL, because it will use anyway MSVC through WSL to compile ( just hopping in-and-out as it runs ), using WSL as a script executor basically. But from the vcpkg side I think no one ever considered/seen this scenario, not until now that x264 port is touching the configure file, forcing it to have CRLF line endings, and literally freaking the WSL bash executor about this.

//EDIT3: Probably the easiest fix for this entire issue is to wrap the line https://github.com/microsoft/vcpkg/blob/master/ports/x264/portfile.cmake#L14 with something like if(NOT WIN32) as it builds just fine anyway...

dg0yt commented 1 year ago

And funny fact, if we comment the line https://github.com/microsoft/vcpkg/blob/master/ports/x264/portfile.cmake#L14 this whole thing still works, even under WSL, because it will use anyway MSVC through WSL to compile ( just hopping in-and-out as it runs ), using WSL as a script executor basically.

At least the outer bash is called by absolute path based on MSYS_ROOT from vcpkg_configure_make.

I'm still curious about your environment's PATH at the time env is evaluated inside MSYS2 bash, for the configure shebang.

Probably the easiest fix for this entire issue is to wrap the line https://github.com/microsoft/vcpkg/blob/master/ports/x264/portfile.cmake#L14 with something like if(NOT WIN32) as it builds just fine anyway...

This would be a workaround for this particular port. We don't know when you run into the next script with CRLF line endings. Given that configure and make will trigger call many more scripts, we should ensure that it never changes to another bash.

julianxhokaxhiu commented 1 year ago

I'm still curious about your environment's PATH at the time env is evaluated inside MSYS2 bash, for the configure shebang.

Any hint how I can catch that?

[...] we should ensure that it never changes to another bash

Fully agree.

dg0yt commented 1 year ago

Any hint how I can catch that?

You might add env or echo $PATH add the top of the configure script...

We might also create a separate test port which checks for a sane environment. It could be run on demand when users report errors, to provide good diagnostics on demand for rare but reproducible problems.

julianxhokaxhiu commented 1 year ago

We might also create a separate test port which checks for a sane environment. It could be run on demand when users report errors, to provide good diagnostics on demand for rare but reproducible problems.

This would have helped a lot to troubleshoot. Would be fantastic to have something like this. Ideally run by using vcpkg --report or something like this.

You might add env or echo $PATH add the top of the configure script...

I did try that but all you'll get is already inside the WSL bash env ( this comment is part of that dump ), not before. Is that useful anyway to you?

dg0yt commented 1 year ago

You might add env or echo $PATH add the top of the configure script...

I did try that but all you'll get is already inside the WSL bash env ( this comment is part of that dump ), not before. Is that useful anyway to you?

Maybe. IMO the script should simply start with

#!/usr/bin/bash
echo "PATH=$PATH"
exit 1

This shouldn't escape MSYS2 bash.

julianxhokaxhiu commented 1 year ago

There you go:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/HostX64/x86:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/HostX64/x64:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/VC/VCPackages:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TestWindow:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/bin/Roslyn:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Team Tools/Performance Tools:/mnt/c/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/x64:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools:/mnt/c/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64:/mnt/c/Program Files (x86)/Windows Kits/10/bin/x64:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64:/mnt/c/Windows/Microsoft.NET/Framework64/v4.0.30319:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools:/mnt/c/Users/julia/AppData/Local/Microsoft/WindowsApps:/mnt/c/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/system32/Wbem:/mnt/c/Windows/system32/WindowsPowerShell/v1.0:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/VC/Linux/bin/ConnectionManagerExe:/mnt/c/vcpkg/downloads/tools/ninja/1.10.2-windows:/mnt/c/vcpkg/downloads/tools/ninja/1.10.2-windows:/mnt/c/vcpkg/downloads/tools/msys2/9a1ec3f33446b195/mingw32/bin
dg0yt commented 1 year ago

The given output is probably from WSL bash. With line breaks and comments added:

/usr/local/sbin    <-- Not expected from vcpkg or msys
/usr/local/bin    <-- Same here and the following lines
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/usr/lib/wsl/lib
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/HostX64/x86
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/HostX64/x64
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/VC/VCPackages
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TestWindow
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/bin/Roslyn
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Team Tools/Performance Tools
/mnt/c/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/x64
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools
/mnt/c/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64
/mnt/c/Program Files (x86)/Windows Kits/10/bin/x64
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64
/mnt/c/Windows/Microsoft.NET/Framework64/v4.0.30319
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools
/mnt/c/Users/julia/AppData/Local/Microsoft/WindowsApps
/mnt/c/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin      <-- This is vcpkg msys.
/mnt/c/Windows/system32
/mnt/c/Windows
/mnt/c/Windows/system32/Wbem
/mnt/c/Windows/system32/WindowsPowerShell/v1.0
/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/VC/Linux/bin/ConnectionManagerExe
/mnt/c/vcpkg/downloads/tools/ninja/1.10.2-windows
/mnt/c/vcpkg/downloads/tools/ninja/1.10.2-windows
/mnt/c/vcpkg/downloads/tools/msys2/9a1ec3f33446b195/mingw32/bin    <-- This is for some tool in msys.

Note how vcpgk msys is just before C:\Windows\system32, as expected.

I started to wonder if env also comes from WSL via C:\Windows\system32 and isn't installed in vcpkg MSYS root. Then the fix is clear: we need to add env to our MSYS root. (Currently I'm away from a windows machine and can't check msys myself.)

julianxhokaxhiu commented 1 year ago

Yep it is from the WSL bash, which still doesn't explain to me why it is being triggered if the first bash session is anyway run through msys2. Something's not right...

I started to wonder if env also comes from WSL via C:\Windows\system32

I just checked and no, there's no env.exe over there. It's literally only bash.exe that is tripping vcpkg.

dg0yt commented 1 year ago

which still doesn't explain to me why it is being triggered if the first bash session is anyway run through msys2

Cf. https://github.com/microsoft/vcpkg/issues/29658#issuecomment-1435646053 bullet point two - only that there is no MSYS env. So it is picking WSL env, and that one has another interpretation of /usr/bin and /bin.

julianxhokaxhiu commented 1 year ago

Ohhh now it's clear, so the msys2 bash is asking the env which bash to pick, and that one is tripping it over because it sends the bash session to the WSL bash instead of keeping it inside. I see!

I'll try to do some tests here to see how we can add the env into vcpkg MSYS2, and if successful I'll make a PR.

Thank you so far!

//EDIT: I just checked and env is present in the MSYS2 path C:\vcpkg\downloads\tools\msys2\ca907ea16f6f2ba5\usr\bin but how can we tell it to use the MSYS2 bash instead of the WSL one? 🤔

//EDIT2: A-ha! I think I found where the issue is and how to fix it! The vcpkg_configure_make does in fact set the PATH env var correctly for the first bash session, but the following executions will NOT inherit this PATH env var, so all we need to do I think is pass this info downstream where we exec the command (configure_env). I'll try to verify this assumption by printing the PATH out of this execution chain.

//EDIT3: Bingo! Here we have a new-line delimited list of PATHs I do get in my PATH while MSYS2 bash execs!

/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/HostX64/x86
/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/HostX64/x64
/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/VC/VCPackages
/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TestWindow
/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer
/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/bin/Roslyn
/c/Program Files/Microsoft Visual Studio/2022/Community/Team Tools/Performance Tools
/c/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/x64
/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools
/c/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64
/c/Program Files (x86)/Windows Kits/10/bin/x64
/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64
/c/Windows/Microsoft.NET/Framework64/v4.0.30319
/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE
/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools
/c/Users/julia/AppData/Local/Microsoft/WindowsApps
/usr/bin
/c/Windows/system32
/c/Windows
/c/Windows/system32/Wbem
/c/Windows/system32/WindowsPowerShell/v1.0
/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/VC/Linux/bin/ConnectionManagerExe
/c/vcpkg/downloads/tools/ninja/1.10.2-windows
/c/vcpkg/downloads/tools/ninja/1.10.2-windows
/c/vcpkg/downloads/tools/msys2/9a1ec3f33446b195/mingw32/bin

As you can notice the /mnt/c/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin is missing. I guess adding it will solve all this issue.

dg0yt commented 1 year ago

As you can notice the /mnt/c/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin is missing. I guess adding it will solve all this issue.

It is not missing: from the perspective of MSYS2 bash (i.e. "MSYS environment"), it comes as /usr/bin. Note that all paths uses MSYS syntax (forward /, no :) here.

julianxhokaxhiu commented 1 year ago

Oh I see, this although doesn't explain then why the MSYS2 bash is not picked before the one from WSL. Technically it's before /c/Windows/system32 🤷

//EDIT1: Ohhh wow! Look at this, I found out there's a bash symlink in /c/Users/julia/AppData/Local/Microsoft/WindowsApps! This might be the one triggering the WSL bash session!

//EDIT2: Ok now this is challenging. We need to find a way to move the vcpkg msys2 root before this local path too IF present. Guess it's standard on Win11, or maybe on Win10 now as well...

dg0yt commented 1 year ago

Now you see why I insisted on looking at PATH again and again... I'm really glad you didn't give up. The question is indeed how to find a robust general solution. Maybe it is enough to create a directory with selected sensitive commands (env) and prepend it to PATH.

julianxhokaxhiu commented 1 year ago

Thank you and yes you're right! I also think we should opt for a sensitive default that is enough from the vcpkg POV to be used to compile a port. We shouldn't need to inherit the users PATH as otherwise you'll end up in situations like mine.

Who do you think we can involve in helping us with this one from the core vcpkg team? @BillyONeal maybe?

julianxhokaxhiu commented 1 year ago

Can someone in the vcpkg team pick up this please? I'm totally blocked here and I'm not able to build locally anymore. I even did try to approach the WSL team to ask how to delete the bash.exe alias while preserving WSL but atm no valid workarounds were given. Thank you in advance.

jimwang118 commented 1 year ago

Can someone in the vcpkg team pick up this please? I'm totally blocked here and I'm not able to build locally anymore. I even did try to approach the WSL team to ask how to delete the bash.exe alias while preserving WSL but atm no valid workarounds were given. Thank you in advance.

Thanks for posting this issue. We'll be working on it this week.

jimwang118 commented 1 year ago

Can someone in the vcpkg team pick up this please? I'm totally blocked here and I'm not able to build locally anymore. I even did try to approach the WSL team to ask how to delete the bash.exe alias while preserving WSL but atm no valid workarounds were given. Thank you in advance.

@julianxhokaxhiu You can modify the ending symbol in portfile.cmake to unix (LF), and then you can compile normally.

julianxhokaxhiu commented 1 year ago

@jimwang118 How is this going to help though? That was not the issue in the first place. The issue is that the entire bash session will run inside the WSL2 environment, and when CMake touches the configure file inside the cloned x264 repo, it will write it back using CRLF which will trip the Unix bash session.

I consider this still being a vcpkg core bug as it should not run the bash session within WSL but use the MSYS2 one.

jimwang118 commented 1 year ago

@jimwang118 How is this going to help though? That was not the issue in the first place. The issue is that the entire bash session will run inside the WSL2 environment, and when CMake touches the configure file inside the cloned x264 repo, it will write it back using CRLF which will trip the Unix bash session.

I consider this still being a vcpkg core bug as it should not run the bash session within WSL but use the MSYS2 one.

I followed your steps to install wsl2 locally. But when I installed vcpkg, I correctly identified bash.exe under msys. I'm not sure what's the difference between mine and yours? Environment:

Step:

image image

julianxhokaxhiu commented 1 year ago

Can you share your PATH please? Also I'm on Windows 11 22H2 here.

dg0yt commented 1 year ago

But when I installed vcpkg, I correctly identified bash.exe under msys.

Note that you have to look for env, not bash. I wouldn't be surprised if Win11 WSL2 is different from Win10 WSL2. (Not to mention that the available programs in WSL2 may be subject to other modifications.)

jimwang118 commented 1 year ago

Can you share your PATH please? Also I'm on Windows 11 22H2 here.

I installed wsl2 on the win11 system today, and then compiled vcpkg, and the result was normal. This is my PATHimage image

julianxhokaxhiu commented 1 year ago

@jimwang118 can you go to your %LOCALAPPDATA%\Microsoft\WindowsApps ( you can paste this in Win+R and press OK ) and check if you have a bash.exe alias there? Can you also paste the output instead of sending a screenshot? Thank you.

//EDIT: Also, please send your PATH from the cmd.exe by writing echo %PATH% and pasting here the output, thank you.

jimwang118 commented 1 year ago

I don't have an alias for bash.exe in %LOCALAPPDATA%\Microsoft\WindowsApps. This is the output result under the path %LOCALAPPDATA%\Microsoft\WindowsApps.

 Directory of C:\AppData\Local\Microsoft\WindowsApps
AdvancedMicroDevicesInc-2.AMDRadeonSoftware_0a9344xs7nr4m
amdlinkuwp.exe
Backup
CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc
Clipchamp.Clipchamp_yxz26nhyzhsrt
clipchamp.exe
GameBarElevatedFT_Alias.exe
MediaPlayer.exe
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
Microsoft.GamingApp_8wekyb3d8bbwe
Microsoft.MicrosoftEdge_8wekyb3d8bbwe
Microsoft.Paint_8wekyb3d8bbwe
Microsoft.ScreenSketch_8wekyb3d8bbwe
Microsoft.WindowsNotepad_8wekyb3d8bbwe
Microsoft.WindowsTerminal_8wekyb3d8bbwe
Microsoft.XboxGamingOverlay_8wekyb3d8bbwe
Microsoft.ZuneMusic_8wekyb3d8bbwe
MicrosoftEdge.exe
MicrosoftTeams_8wekyb3d8bbwe
MicrosoftWindows.Client.CBS_cw5n1h2txyewy
MicrosoftWindows.DesktopStickerEditorCentennial.exe
mspaint.exe
msteams.exe
msteamsupdate.exe
notepad.exe
pbrush.exe
python.exe
python3.exe
SnippingTool.exe
ubuntu2204.exe
WindowsPackageManagerServer.exe
winget.exe
wt.exe
XboxPcApp.exe

This is my PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\CMake\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\PuTTY\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\Nsight Compute 2023.1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\v-wangjim.FAREAST\AppData\Local\Microsoft\WindowsApps;C:\Users\v-wangjim.FAREAST\.dotnet\tools Hope this helps you.

julianxhokaxhiu commented 1 year ago

Ok now this is weird though. do you have WSL installed via the Microsoft Store? Guess that's the issue. Try installing it using this link: https://www.microsoft.com/store/productId/9P9TQF7MRM4R

If you have it installed via MS Store and you DO NOT have a bash.exe symlink neither on System32 nor on WindowsApps then it means something has changed on the WSL layer but they forgot to delete the bash alias for people like me who have it now.

//EDIT: Can you also please do run

$ wsl --version
Versione WSL: 1.1.3.0
Versione kernel: 5.15.90.1
Versione WSLg: 1.0.49
Versione MSRDC: 1.2.3770
Versione Direct3D: 1.608.2-61064218
Versione DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
versione Windows: 10.0.22621.1344

and paste the output here? Thank you.

//EDIT2: Can you also please do run

$ where bash
C:\Windows\System32\bash.exe
C:\Users\julia\AppData\Local\Microsoft\WindowsApps\bash.exe

and paste as well the output here? Thanks!

julianxhokaxhiu commented 1 year ago

@jimwang118 is there any update on this issue?

jimwang118 commented 1 year ago

//EDIT1 result: wsl --version is an invalid command and won't work on my device. //EDIT2 result:

>where bash
C:\Windows\System32\bash.exe

I downloaded wsl2 from MS Store.

julianxhokaxhiu commented 1 year ago

This doesn't make any sense. I asked multiple friends to do the same and they all have a symlink in their AppData\Local\Microsoft\WindowsApps\ of bash.exe. If you don't, I'm not sure what is going on here, but as you're both a Microsoft project maybe you could reach WSL to clarify what is going on. This is definitely an issue, and when bash.exe is on that path, vcpkg will refuse to build this port at least, but others may fail too the moment the scripts run use CRLF instead of LF.

julianxhokaxhiu commented 1 year ago

Summoning @JackBoosY and @BillyONeal at this stage, we clearly need some help understanding what is going on.

JackBoosY commented 1 year ago

This maybe a common issue, @Neumann-A I think we should handle the scene in vcpkg_configure_make?

Neumann-A commented 1 year ago

Were the test here run in vcpkg env --triplet x86-windows-static ? If not the debugging was pointless.

So from the discussion: Win11 + WSL might have problems due to a different bash? Vcpkg could just force msys bash for windows since it will download it anyway.

julianxhokaxhiu commented 1 year ago

Were the test here run in vcpkg env --triplet x86-windows-static ? If not the debugging was pointless.

Yes but in the end it didn't make much a difference, I was able to trigger it also on x64-windows-static as well as x86-windows and x64-windows.

So from the discussion: Win11 + WSL might have problems due to a different bash? Vcpkg could just force msys bash for windows since it will download it anyway.

Yes, that's basically the root cause. We initially thought it was about the triplet but @dg0yt pointed me to the right direction and we found out it was all about PATH, which further discoveries led us to find out the WSL bash was called because currently vcpkg_configure_make positions the MSYS2 bash before the system32 entry, but not before the new AppData\Local\Microsoft\WindowsApps which also, unfortunately, contains a bash alias for WSL.

So yeah, long story short we need to find a way to tell vcpkg to use ONLY the MSYS2 bash no matter if I have WSL installed or not.

Thanks for looking into this!

dg0yt commented 1 year ago

Win11 + WSL might have problems due to a different bash? Vcpkg could just force msys bash for windows since it will download it anyway.

This is my breakdown:

IMO vcpkg needs to sanitize the PATH to avoid collissions between msys2 and WSL. But for x264, it might be enough to avoid inserting env /usr/bin/bash in the context of Windows.

dg0yt commented 1 year ago

@julianxhokaxhiu Did you install PowerShell as a Windows App from the Microsoft Store? Could you uninstall it? https://github.com/microsoft/vcpkg/pull/30172#discussion_r1136595012

julianxhokaxhiu commented 1 year ago

@julianxhokaxhiu Did you install PowerShell as a Windows App from the Microsoft Store? Could you uninstall it? #30172 (comment)

Yes I did install Powershell via MS Store and I could but may I ask why? Which is the angle of this request?

dg0yt commented 1 year ago

Yes I did install Powershell via MS Store and I could but may I ask why? Which is the angle of this request?

This suggestion was meant to verify the theoretical reasoning from the linked comment. Alternatively, just test PR #30172.