xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.86k stars 774 forks source link

"vcpkg::zlib 1.2.11+10" doesn't exist and "vcpkg::zlib 1.2.11#10" doesn't work #5660

Open richard-sim opened 2 hours ago

richard-sim commented 2 hours ago

Xmake Version

2.9.5

Operating System Version and Architecture

Windows 11

Describe Bug

From the docs:

add_requires("vcpkg::zlib 1.2.11+10")

Results in:

error: no version database entry for zlib at 1.2.11+10.
Available versions:
  ...
  1.2.11#10

Trying:

add_requires("vcpkg::zlib 1.2.11#10")

Will find and install the package in vcpkg, but xmake will fail when parsing the semver with the # in it.

Expected Behavior

vcpkg::zlib should be able to be installed as 1.2.11#10.

Project Configuration

add_requires("vcpkg::zlib 1.2.11#10", {alias = "zlib"})

target("deps", function ()
    set_kind("phony")
    add_packages("zlib")
end)

Additional Information and Error Logs

(dev) D:\dev\build-sys-eval\foobar\src>tools\xmake\xmake.exe -v deps
checking for platform ... windows
checking for architecture ... x64
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34321\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.42.34321.1
checking for zig ... no
checking for zig ... no
checking for nim ... no
checking for nim ... no
checking for git ... ok
checking for gzip ... no
checking for 7z ... D:\dev\build-sys-eval\foobar\src\tools\xmake\winenv\bin\7z
checking for vcpkg::zlib ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in vcpkg:
  -> vcpkg::zlib 1.2.11#10 [runtimes:"MT"]
please input: y (y/n/m)

checking for vcpkg.exe ... C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\vcpkg\vcpkg.exe
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\vcpkg\vcpkg.exe --feature-flags=\"versions\" install --x-wait-for-lock --triplet x64-windows-static
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
Detecting compiler hash for triplet x64-windows-static...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.42.34321/bin/Hostx64/x64/cl.exe
The following packages will be built and installed:
    zlib:x64-windows-static@1.2.11#10 -- C:\Users\rsim\AppData\Local\vcpkg\registries\git-trees\53a4615c8bb9b98a3864b834a6bbe51cc6c849ef
Restored 1 package(s) from C:\Users\rsim\AppData\Local\vcpkg\archives in 43 ms. Use --debug to see more details.
Installing 1/1 zlib:x64-windows-static@1.2.11#10...
Elapsed time to handle zlib:x64-windows-static: 2.07 ms
zlib:x64-windows-static package ABI: 16ce7548cbfefdd017172ca8248d2af48c1785ad68e4f21b2a85abb9475bde74
Total install time: 2.17 ms
The package zlib is compatible with built-in CMake targets:

    find_package(ZLIB REQUIRED)
    target_link_libraries(main PRIVATE ZLIB::ZLIB)

checking for pkg-config ... no
checking for pkgconf ... no
error: unable to parse semver range '1.2.11#10'
  => install vcpkg::zlib 1.2.11#10 .. failed
error: install failed!
waruqi commented 2 hours ago

Why not use add_requires("zlib 1.2.11")?

richard-sim commented 2 hours ago

I'm trying to follow the docs exactly. :) I don't know the difference between the versions in VCPkg, and since the docs specified +10, I assumed it was important for some reason.

waruqi commented 2 hours ago

I'm trying to follow the docs exactly. :) I don't know the difference between the versions in VCPkg, and since the docs specified +10, I assumed it was important for some reason.

where? it's incorrect, it should be add_requires("vcpkg::zlib 1.2.11")

richard-sim commented 2 hours ago

https://xmake.io/#/package/remote_package?id=add-vcpkg-dependency-package

Under:

After v2.6.3, xmake supports the new manifest mode of vcpkg, through which we can support version selection of vcpkg package, for example:

waruqi commented 2 hours ago

I have updated docs.