-
-
Notifications
You must be signed in to change notification settings - Fork 773
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
本地定义的 package 无法替换掉间接依赖 #5362
Comments
你 package 定义里面啥 add_deps 都没加,等于没依赖,当然不生效了。。 xmake 不会去自动解析 你工程里面的 xmake.lua ,你得自己配置上 add_deps |
不是自己定义的 package zpnc 缺少依赖,是 zsim package 找不到 zpnc package,zsim 里是带了 zpnc 的: package("zsim", function()
...
add_deps("zpnc", ...)
end) |
Title: Locally defined packages cannot replace indirect dependencies |
You haven't added any add_deps in your package definition, which means there are no dependencies, and of course it won't take effect. . xmake will not automatically parse xmake.lua in your project, you have to configure add_deps yourself. |
It’s not that the self-defined package zpnc lacks dependencies, it’s that the zsim package cannot find the zpnc package, and zsim contains zpnc: package("zsim", function()
...
add_deps("zpnc", ...)
end) |
既然你是 zsim 依赖 zpnc 。。为啥你配置的确是 |
Since you are zsim depends on zpnc . . Why is your configuration indeed |
看不懂你的配置和需求,还是不知道你在干什么。 |
I don’t understand your configuration and requirements, or I still don’t know what you are doing. |
举个例子说明就是,我现在有一个库,就叫仿真库吧 simulation,它依赖 A、B 两个库。然后 B 又依赖 A。 正常线上代码是直接在 simulation 里 add_requires("A version_a") add_requires("B version_b") 然后再通过 add_requireconfs("B.A") 把 B 依赖的 A 库版本也写死成 version_a。 现在我本地仿真需要将 A 和 B.A 都替换成 local package 里定义的,但是此时编译 B 找不到依赖库 A 的 latest 版本。 如果我哪里还是讲的不明白的话,我可以写个 demo 说明下。 |
For example, I now have a library called simulation library, which depends on two libraries, A and B. Then B depends on A. The normal online code is to add_requires("A version_a") add_requires("B version_b") directly in the simulation, and then use add_requireconfs("B.A") to hard-code the A library version that B depends on to version_a. Now my local simulation needs to replace both A and B.A with those defined in the local package, but when compiling B, the latest version of the dependent library A cannot be found. If I still don’t understand something, I can write a demo to explain. |
说白了就是
呗。
其实你 simulation 里,只需要
你 local package 里的 A 如果是 zpnc 的话,我也没看到你加任何 |
To put it bluntly, it is
chant.
In fact, in your simulation, you only need
If A in your local package is zpnc, I haven't seen you add any |
但是 A 和 B 也都是 simulation 的直接依赖,所以都得带上 |
But A and B are also direct dependencies of simulation, so they must be brought |
这个随你,效果一样。。跟现在的问题无关,你现在的问题是 local package 没有 add_versions |
It's up to you, the effect is the same. . It has nothing to do with the current problem. Your current problem is that local package does not have add_versions. |
add_versions("latest") 吗,还是加什么 version 呢,用的是本地的代码 |
add_versions("latest"), or add some version, use local code |
既然你 add_requireconfs 指定了 version,就把对应 version 加进去,反正至少有一个 add_versions |
Since you specify version in add_requireconfs, add the corresponding version. Anyway, there is at least one add_versions |
就是因为已经用了你的 local package ,才会报错。。你的 local package 配置啥也没有,add_versions 没有。。。on_install 也没有,当然报错了。。 要是没用你的 local package ,用的线上有效的包,反而不会报错。。 这不是可以的么 package("zlib")
set_sourcedir("src")
add_versions("1.0", "xxxx")
on_install(function (package)
end)
package_end()
add_requires("libpng", {system = false})
add_requireconfs("libpng.zlib", {system = false}) note: install or modify (m) these packages (pass -y to skip confirm)?
-> zlib 1.0 [from:libpng]
in xmake-repo:
-> libpng v1.6.43 |
好的感谢我试试,我琢磨下啥原理。 |
我猜是因为我定义 zpnc 的时候没有 add_versions(),只是通过版本号构造对应的 url,所以添加 local repo 的时候就走到了 xmake-repo 里定义的 zpnc(因为它没有定义 versions 所以包含了所有的 version?)。 |
I guess it's because I didn't add_versions() when I defined zpnc, I just constructed the corresponding URL through the version number, so when I added the local repo, I went to the zpnc defined in xmake-repo (because it didn't define versions, it included all version?). |
不是,既然找到了你的包,就不会再用 xmake-repo 的包,但是你的包 没写 add_versions ,当然报错找不到 latest versions 了 |
No, now that I have found your package, I will no longer use the xmake-repo package. However, your package does not include add_versions. Of course, an error is reported that the latest versions cannot be found. |
可以这样使用本地包:
|
只需要照着包仓库里面的改,将set_urls里面改成对应的本地路径就行了 |
Just follow the changes in the package warehouse and change set_urls to the corresponding local path. |
不过这里的路径是Windows格式的(很久之前写的了)
如果要跨操作系统兼容的话建议改成:
或者
|
But the path here is in Windows format (written a long time ago)
If you want cross-operating system compatibility, it is recommended to change it to:
or
|
Xmake 版本
v2.9.2
操作系统版本和架构
Linux 720ce3a659a2 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
描述问题
背景是本地仿真需要用本地库替换掉某个库,比如我这里定义了 pnc 引用本地库,但是这里 sim 也依赖了 pnc,在安装 sim 时会报错:`package(zpnc): version(latest) not found!
期待的结果
能影响到间接 package。
工程配置
无
附加信息和错误日志
无
The text was updated successfully, but these errors were encountered: