Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate configs packages are installed bug #6136

Open
star-hengxing opened this issue Feb 6, 2025 · 6 comments
Open

Duplicate configs packages are installed bug #6136

star-hengxing opened this issue Feb 6, 2025 · 6 comments
Labels

Comments

@star-hengxing
Copy link
Contributor

star-hengxing commented Feb 6, 2025

Xmake Version

dev

Operating System Version and Architecture

Windows

Describe Bug

  1. add_requires("zlib")
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.42.34436
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> zlib v1.3.1 [runtimes:"MD", license:zlib]
please input: y (y/n/m)
y
  => download https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz .. ok
  => install zlib v1.3.1 .. ok
  1. add_requires("zlib[toolchains=msvc]")
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.42.34436
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> zlib v1.3.1 [runtimes:"MD", toolchains:"msvc", license:zlib]

Expected Behavior

package manifest.txt should record compiler version?

Project Configuration

set_policy("package.precompiled", false)
set_policy("compatibility.version", "3.0")
add_requires("zlib")
add_requires("zlib[toolchains=msvc]")

Additional Information and Error Logs

N/A

@waruqi
Copy link
Member

waruqi commented Feb 6, 2025

没懂啥问题? 这不是好好的么,不同配置,会有不同的 hash,要同时使用,就加 label + alias

add_requires("zlib~debug", {system = false, debug = true})
add_requires("zlib~shared", {system = false, configs = {shared = true}, alias = "zlib_shared"})

in xmake-repo:
  -> zlib v1.3.1 [license:zlib]
  -> zlib#1 v1.3.1 [toolchains:"clang", license:zlib]
please input: y (y/n/m)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Don't understand any problem? Isn't this good? Different configurations will have different hashs. If you want to use them at the same time, add label + alias

https://github.com/xmake-io/xmake/blob/716b8e8e02b87b1cd35017512c3c981ab78a907a/tests/projects/package/multiconfig/xmake.lua# L3-L4

in xmake-repo:
  -> zlib v1.3.1 [license:zlib]
  -> zlib#1 v1.3.1 [toolchains:"clang", license:zlib]
please input: y (y/n/m)

@star-hengxing
Copy link
Contributor Author

如果使用平台默认工具链 (msvc) 构建包后再显式指定 toolchains,会导致重新安装,但很明显编译器都是一样的。
我猜是因为包 manifest 在平台默认工具链下,没有记录 toolchains,所以 hash 变了。

有个想法就是,默认加上 toolchainsvs_toolset 版本可能更好。

@waruqi
Copy link
Member

waruqi commented Feb 6, 2025

如果使用平台默认工具链 (msvc) 构建包后再显式指定 toolchains,会导致重新安装,但很明显编译器都是一样的。 我猜是因为包 manifest 在平台默认工具链下,没有记录 toolchains,所以 hash 变了。

有个想法就是,默认加上 toolchainsvs_toolset 版本可能更好。

目前设计是这样的,为了简化逻辑,目前仅根据 configs 变动算 buildhash。。否则逻辑太复杂。用户也搞不清楚。

反正除了一些不影响 build binary 的配置,其他只要 configs 变了,都会重装,即使编译器相同

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


If you use the platform default toolchains to build the package (msvc) and then specify toolchains explicitly, it will result in a reinstall, but it is obvious that the compiler is the same.
I guess it's because the package manifest is under the platform default toolchains, and there is no record of toolchains, so hash has changed.

One idea is that it might be better to add the toolchains and vs_toolset versions by default.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


If you use the platform default toolchains to build the package (msvc) and then specify toolchains explicitly, it will result in a reinstall, but it is obvious that the compiler is the same. I guess it's because the package manifest is under the platform default toolchains, and there is no record of toolchains, so hash has changed.

One idea is that it might be better to add the toolchains and vs_toolset versions by default.

The current design is like this. In order to simplify logic, the buildhash is currently calculated based on configs changes. . Otherwise the logic is too complicated. Users can't figure it out either.

Anyway, except for some that do not affect the configuration of build binary, as long as configs change, they will be reinstalled, even if the compiler is the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants