commit | 916f4e513cdf1fb6adec3d8898014550fa45c315 | [log] [tgz] |
---|---|---|
author | Primiano Tucci <primiano@google.com> | Fri Oct 16 20:40:33 2020 +0200 |
committer | Primiano Tucci <primiano@google.com> | Fri Oct 16 20:40:33 2020 +0200 |
tree | 80df2bc9d75dbe0a5b29a15e50782977aff5898a | |
parent | 8065f31f44ea3f3e671a3ce04db584f569cbb526 [diff] |
Remove ODR violations from Bazel builds The process of generating Bazel build files from GN caused ODR violations when flattening GN source_set(s) into file groups. The problem is the following: file groups are effectively just list of source paths. Unlike GN, where the build system retains the identity of the source_set, using the same source_set in different targets causes the same sources to get compiled and linked multiple times. So in Bazel and SoonG we have two conflicting needs: 1. We can only depend on static_library targets. One can not depend on a filegroup in Bazel. This is the reason why "protozero" exists as a static library in Bazel builds: we need the generated protobuf sources to be able to depend on a target and that target becomes a static_library. 2. By flattening and propagating up source sets as filegroups we end up with the same filegroup being linked in several different static libraries. Note that the same situation exists in SoonG. There, however things are more complicated because heapprofd_client depends on base but wants to build it with different cflags (-DPERFETTO_ANDROID_ASYNC_SAFE_LOG) so we can't split that into a static_library yet. The root problem here was the following: libperfetto_client_experimental(static_lib) -> libprotozero(static_lib) -> base(filegroup) libperfetto_client_experimental(static_lib) -> perfetto_ipc(static_lib) -> base(filegroup) This CL fixes it by making base a static_library. Furthermore this adds a test at the tools/gen_xxx level to avoid regressing this in future. Bug: 154625868 Test: built into tools/gen_android_bp and tools/gen_bazel Change-Id: I80004c64e571bd85f9791673ee7740a088989dcc
Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.
See https://perfetto.dev/docs or the /docs/ directory for documentation.