From 825b796f81a6c5f13fbfcd64490f715fab3c6f65 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 27 Jun 2025 22:56:04 +0800 Subject: fix link object only binary --- xmake/modules/private/action/build/build_binary.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xmake/modules/private/action/build/build_binary.lua b/xmake/modules/private/action/build/build_binary.lua index 3863b8550..a29ed4f60 100644 --- a/xmake/modules/private/action/build/build_binary.lua +++ b/xmake/modules/private/action/build/build_binary.lua @@ -28,11 +28,15 @@ function main(jobgraph, target, opt) jobgraph:group(objects_group, function () build_object(jobgraph, target, opt) end) - if jobgraph:size() > jobsize then - local link_group = target:fullname() .. "/link" - jobgraph:group(link_group, function () - target_buildutils.add_linkjobs(jobgraph, target, opt) - end) + local has_object_jobs = jobgraph:size() > jobsize + + -- @note We always need the link task, even if the current target does not have any object files + -- https://github.com/xmake-io/xmake-repo/pull/7479#issuecomment-3007049158 + local link_group = target:fullname() .. "/link" + jobgraph:group(link_group, function () + target_buildutils.add_linkjobs(jobgraph, target, opt) + end) + if has_object_jobs then jobgraph:add_orders(objects_group, link_group) end end -- cgit v1.3.1