xmake无法使用conda和vcpkg下载的库
Xmake 版本
3.0.4
操作系统版本和架构
WSL2子系统,fedora42
描述问题
- 在conda中安装了moab库并且激活了环境,在源文件中导入moab的头文件,编译时会出现很多未定义链接的错误,看报错信息是和moab的依赖库相关。
- 在conda中安装了hdf5库,在源文件中导入hdf5的头文件,编译时报错找不到mpi.h头文件。
- 使用xrepo通过vcpkg安装了opencl库,在源文件中导入opencl.h头文件,编译时会报错找不到文件。以上都是在lua文件里有add_requires以及add_packages的情况下发生的
期待的结果
通过conda或者vcpkg等安装了库后,可以自动处理依赖关系,按照官网文档的做法add_requires和add_packages后,导入头文件不会报错
工程配置
add_rules("mode.release")
set_languages("c++17")
add_requires("conda::moab",{alias="moab"})
-- add_requires("vcpkg::opencl")
-- add_requires("conda::hdf5", {alias = "hdf5"})
target("find_cell_moab")
set_kind("binary")
add_files("src/*.cpp")
-- add_packages("hdf5")
-- add_packages("opencl")
add_packages("moab")
#include <iostream>
#include <vector>
#include "moab/Core.hpp"
#include "moab/AdaptiveKDTree.hpp"
#include "moab/Range.hpp"
// #include "CL/opencl.h"
// #include "hdf5.h"
int main(int argc, char* argv[])
{
return 0;
}
附加信息和错误日志
无
Bot detected the issue body's language is not English, translate it automatically.
Title: xmake cannot use the libraries downloaded by conda and vcpkg
目前只有 xmake-repo 仓库的包,走内置的包管理,才支持级联依赖。
如果用第三方包,你只能显式的通过 add_requires/add_packages ,把所有依赖挨个配齐,包括 opencl, hdf5, mpi 等
Bot detected the issue body's language is not English, translate it automatically.
Currently, only packages in the xmake-repo warehouse use built-in package management to support cascading dependencies.
If you use third-party packages, you can only explicitly pass add_requires/add_packages to configure all dependencies one by one, including opencl, hdf5, mpi, etc.
目前只有 xmake-repo 仓库的包,走内置的包管理,才支持级联依赖。
如果用第三方包,你只能显式的通过 add_requires/add_packages ,把所有依赖挨个配齐,包括 opencl, hdf5, mpi 等
我通过add_requires/add_packages把依赖配齐,但是这些依赖是conda环境里都有的,为什么会触发下载呢
Bot detected the issue body's language is not English, translate it automatically.
Currently, only packages in the xmake-repo warehouse use built-in package management to support cascading dependencies.
If you use third-party packages, you can only explicitly pass add_requires/add_packages to configure all dependencies one by one, including opencl, hdf5, mpi, etc.
I configured the dependencies through add_requires/add_packages, but these dependencies are available in the conda environment. Why is the download triggered?
目前只有 xmake-repo 仓库的包,走内置的包管理,才支持级联依赖。 如果用第三方包,你只能显式的通过 add_requires/add_packages ,把所有依赖挨个配齐,包括 opencl, hdf5, mpi 等
我通过add_requires/add_packages把依赖配齐,但是这些依赖是conda环境里都有的,为什么会触发下载呢
这个你可以调下 find 逻辑,只有没找到你环境的包,才会触发下载
https://github.com/xmake-io/xmake/blob/dev/xmake/modules/package/manager/conan/find_package.lua
至于为什么没找到,原因很多,有可能配置不匹配,比如默认是找静态库,你安装的是动态库,也可能是 runtime,arch 等 不匹配
也可能是其他原因,这就需要你自己调下代码了。
Bot detected the issue body's language is not English, translate it automatically.
Currently, only packages in the xmake-repo warehouse use built-in package management to support cascading dependencies. If you use third-party packages, you can only explicitly pass add_requires/add_packages to configure all dependencies one by one, including opencl, hdf5, mpi, etc.
I configured the dependencies through add_requires/add_packages, but these dependencies are available in the conda environment. Why is the download triggered?
You can adjust the find logic for this. The download will only be triggered if the package in your environment is not found.
https://github.com/xmake-io/xmake/blob/dev/xmake/modules/package/manager/conan/find_package.lua
As for why it is not found, there are many reasons. There may be a mismatch in the configuration. For example, the default is to find a static library, but you installed a dynamic library. It may also be a mismatch in runtime, arch, etc.
There may be other reasons, which requires you to adjust the code yourself.
未来计划支持conan级联依赖吗
这对于从conan迁移到xmake很有帮助,也方便快捷使用conan生态,我认为这个计划是有意义的
Bot detected the issue body's language is not English, translate it automatically.
Are there any future plans to support conan cascade dependencies?
Bot detected the issue body's language is not English, translate it automatically.
This is very helpful for migrating from conan to xmake, and it is also convenient and quick to use the conan ecosystem. I think this plan makes sense.
未来计划支持conan级联依赖吗
暂时没空,另外不要在无关的 issue 下发,单独提 issues/discussions.
Bot detected the issue body's language is not English, translate it automatically.
Are there future plans to support conan cascading dependencies?
I'm not available at the moment. Also, don't post in unrelated issues, raise issues/discussions separately.