-
-
Notifications
You must be signed in to change notification settings - Fork 816
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
当一个 object target 添加另一个 object target 作为依赖时无法继承 .o 文件 #4887
Comments
再试试 xmake update -s dev |
Try xmake update -s dev again |
报错了,不知道是不是和我环境没清理干净相关: Already up to date.
ok
/usr/bin/git rev-parse HEAD
/usr/bin/git rev-parse HEAD
checking for cmake ... no
checking for cmake ... /usr/bin/cmake
error: @programdir/core/main.lua:329: @programdir/core/sandbox/modules/import/core/base/task.lua:65: @programdir/modules/async/runjobs.lua:338: ....xmake/repositories/xmake-repo/packages/z/zlib/xmake.lua:26: attempt to index a nil value
stack traceback:
[....xmake/repositories/xmake-repo/packages/z/zlib/xmake.lua:26]: in function 'on_fetch'
[@programdir/core/package/package.lua:1733]: in function '_fetch_library'
[@programdir/core/package/package.lua:1943]: in function 'fetch'
[...modules/private/action/require/impl/install_packages.lua:333]: in function 'jobfunc'
[@programdir/modules/async/runjobs.lua:256]:
stack traceback:
[C]: in function 'error'
@programdir/core/base/os.lua:961: in function 'os.raiselevel'
(...tail calls...)
@programdir/core/main.lua:329: in upvalue 'cotask'
@programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399> |
执行 xmake l xmake.version 看下,不行就全量重装下 |
Execute xmake l xmake.version and check. If it doesn’t work, reinstall it completely. |
继承 .o 的可以了,还有个问题请教下,object target 里的 add_syslinks 不能被导出到 binary 里去。 target("zutil.thunder", function()
set_kind("object")
add_files("*.cc")
remove_files("*_test.cc")
add_syslinks("curl") -- 未导出
add_deps("zlog")
end)
target("zutil.thunder.http_url_test", function()
set_kind("binary")
add_files("http_url_test.cc")
add_deps("zutil.thunder")
add_packages("gtest")
end) 编译时报错: 虽然加一个 {public = true} 可以解决,但是我理解这种链接时参数应该是无条件导出的,毕竟生成 .o 时也用不上,还是有啥其他考虑呢? |
再试试,xmake update -s dev |
Try again, xmake update -s dev |
可以了,能正常导出 syslinks |
OK, syslinks can be exported normally |
你在什么场景下需要该功能?
按照文档描述 object target 是编译完的目标文件集合,当前项目中有多个 object target 而且存在依赖关系,例如:
在这种写法下 coord_convert_test 编译会丢失 zlog 的 .o 文件,虽然可以通过在 target coord_convert_test 中 add_deps("zlog", "convert") 解决,但是一旦项目中 object target 较多就会很麻烦。
描述可能的解决方案
希望一个 object target 可以继承它所有通过 add_deps() 引入的 object target 的 .o 文件。比如可以加一个 {public = true } 配置:
target("convert", function()
set_kind("object")
add_files("zutil/convert/.cc|_test.cc")
add_syslinks("pthread")
add_deps("zlog", {public = true}) -- 导出 zlog 的目标文件
end)
描述你认为的候选方案
No response
其他信息
No response
The text was updated successfully, but these errors were encountered: