Fwd: phony target inputs for shared_library vs static_library

25 views
Skip to first unread message

Andrew Grieve

unread,
May 15, 2025, 10:44:21 PMMay 15
to gn-dev
I'm investigating why is_component_build=true in chrome results in much smaller build.ninja files, and the main reason seems to be that transitive source_sets are listed as inputs for static_library, but not for shared_library.

E.g. Looking at //third_party/perfetto/src/trace_processor/util:zip_reader, it has a dep on //third_party/zlib (a "component").

When component == shared_library, the zip_reader.ninja file does not have an input edge on clang_x64/phony/third_party/zlib/zlib_adler32_simd, but when component == static_library, it does have this edge.

I can't figure out why this would be correct in one case and not the other... Anyone have insights?

Andrew Grieve

unread,
May 15, 2025, 11:21:26 PMMay 15
to Andrew Grieve, gn-dev
To answer my own question, there is a "complete_static_lib = true" flag for static_library targets, that if absent causes them to link only direct sources and not dependent source_sets.

Nico Weber

unread,
May 16, 2025, 11:00:53 AMMay 16
to Andrew Grieve, gn-dev
Tangentially related: If you're looking at build.ninja size, maybe you'll find crbug.com/40278737 interesting.

Andrew Grieve

unread,
May 16, 2025, 11:16:55 AMMay 16
to Nico Weber, Andrew Grieve, gn-dev
oooh, yes, thanks! We should implement those ideas!
Reply all
Reply to author
Forward
0 new messages