authorgravatar for xavierb@gmail.comXavier Bouchoux <xavierb@gmail.com> 2023-05-14 11:46:59+02:00
committergravatar for xavierb@gmail.comXavier Bouchoux <xavierb@gmail.com> 2023-07-11 11:46:59+02:00
logcea8645423604b758208d94ff4d404a0fbae51f8
tree7252ed54bcf70c645e24319d8875e8d982e0aef1
parent8142bc20ea8bcffc076fcbde074a7e315ff0060a

build: avoid repeating objects when linking a static library

Don't pass the object files from a static library to the linker invocation. The lib.a file already contains them. Avoids "duplicate symbol" errors (and useless work by the linker)

1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/Build/Step/Compile.zig+2-1
...@@ -2192,7 +2192,8 @@ const TransitiveDeps = struct {...@@ -2192,7 +2192,8 @@ const TransitiveDeps = struct {
2192 if ((try td.seen_steps.fetchPut(&inner_other.step, {})) != null)2192 if ((try td.seen_steps.fetchPut(&inner_other.step, {})) != null)
2193 continue;2193 continue;
21942194
2195 if (!dyn)2195 const included_in_lib = (other.kind == .lib and inner_other.kind == .obj);
2196 if (!dyn and !included_in_lib)
2196 try td.link_objects.append(other_link_object);2197 try td.link_objects.append(other_link_object);
21972198
2198 try addInner(td, inner_other, dyn or inner_other.isDynamicLibrary());2199 try addInner(td, inner_other, dyn or inner_other.isDynamicLibrary());