New issue
Advanced search Search tips

Issue 921584 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Yesterday
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue v8:8339



Sign in to add a comment

AndroidLogConfig link errors while building Perfetto

Project Member Reported by petermarshall@chromium.org, Jan 14

Issue description

Version: Perfetto master (https://android.googlesource.com/platform/external/perfetto/+/80b4fbd1d6519b039410b7bbb3a519e86f7aeaff)

I'm working on a prototype to integrate Perfetto into V8: https://chromium-review.googlesource.com/c/v8/v8/+/1408995/

Looks like the link error happens within Perfetto, still could be a problem with the build files in V8 though.

What steps will reproduce the problem?
(1) (go to v8 checkout)
(2) git cl patch 1408995
(3) gclient sync
(4) tools/dev/gm.py x64.optdebug check all

What happens instead?

FAILED: libv8_libplatform.so libv8_libplatform.so.TOC 
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libv8_libplatform.so" --tocfile="./libv8_libplatform.so.TOC" --output="./libv8_libplatform.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -Wl,--color-diagnostics -m64 -Werror -rdynamic -nostdlib++ --sysroot=../../build/linux/debian_sid_amd64-sysroot -L../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath=\$ORIGIN/. -Wl,-rpath-link=. -rdynamic -Wl,-O2 -Wl,--gc-sections -o "./libv8_libplatform.so" -Wl,-soname="libv8_libplatform.so" @"./libv8_libplatform.so.rsp"
ld.lld: error: undefined symbol: perfetto::protos::AndroidLogConfig::AndroidLogConfig()
>>> referenced by data_source_config.pb.h:807 (gen/third_party/perfetto/protos/perfetto/config/data_source_config.pb.h:807)
>>>               obj/third_party/perfetto/src/tracing/tracing/data_source_config.o:(perfetto::protos::DataSourceConfig::mutable_android_log_config())

ld.lld: error: undefined symbol: perfetto::protos::protobuf_AddDesc_perfetto_2fconfig_2fandroid_2fandroid_5flog_5fconfig_2eproto()
>>> referenced by data_source_config.pb.cc:36 (gen/third_party/perfetto/protos/perfetto/config/data_source_config.pb.cc:36)
>>>               obj/third_party/perfetto/protos/perfetto/config/lite/data_source_config.pb.o:(perfetto::protos::protobuf_AddDesc_perfetto_2fconfig_2fdata_5fsource_5fconfig_2eproto_impl())

ld.lld: error: undefined symbol: perfetto::protos::AndroidLogConfig::MergeFrom(perfetto::protos::AndroidLogConfig const&)
>>> referenced by data_source_config.pb.cc:781 (gen/third_party/perfetto/protos/perfetto/config/data_source_config.pb.cc:781)
>>>               obj/third_party/perfetto/protos/perfetto/config/lite/data_source_config.pb.o:(perfetto::protos::DataSourceConfig::MergeFrom(perfetto::protos::DataSourceConfig const&))

ld.lld: error: undefined symbol: perfetto::protos::AndroidLogConfig::Clear()
>>> referenced by data_source_config.pb.cc:290 (gen/third_party/perfetto/protos/perfetto/config/data_source_config.pb.cc:290)
>>>               obj/third_party/perfetto/protos/perfetto/config/lite/data_source_config.pb.o:(perfetto::protos::DataSourceConfig::Clear())

ld.lld: error: undefined symbol: perfetto::protos::AndroidLogConfig::default_instance_
>>> referenced by android_log_config.pb.h:72 (gen/third_party/perfetto/protos/perfetto/config/android/android_log_config.pb.h:72)
>>>               obj/third_party/perfetto/protos/perfetto/config/lite/data_source_config.pb.o:(perfetto::protos::AndroidLogConfig::internal_default_instance())

ld.lld: error: undefined symbol: perfetto::protos::AndroidLogConfig::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)
>>> referenced by wire_format_lite_inl.h:497 (../../third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h:497)
>>>               obj/third_party/perfetto/protos/perfetto/config/lite/data_source_config.pb.o:(bool google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual<perfetto::protos::AndroidLogConfig>(google::protobuf::io::CodedInputStream*, perfetto::protos::AndroidLogConfig*))

ld.lld: error: undefined symbol: perfetto::protos::AndroidLogConfig::ByteSize() const
>>> referenced by wire_format_lite_inl.h:867 (../../third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h:867)
>>>               obj/third_party/perfetto/protos/perfetto/config/lite/data_source_config.pb.o:(int google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual<perfetto::protos::AndroidLogConfig>(perfetto::protos::AndroidLogConfig const&))
clang: error: linker command failed with exit code 1 (use -v to see invocation)

 
Blocking: v8:8339
Can you attach the content of libv8_libplatform.so.rsp (you need to rebuild with ninja -C out/whatever -d keeprsp, otherwise the response file gets removed).

It's weird, it's complaining essentially about the fact that data_source_config.pb.o isn't linked in. But I see that tracing:tracing in GN depends on     "../../protos/perfetto/config:lite", which should include  data_source_config.pb.o.
So I can't see how you ended up pulling tracing/core/data_source_config.cc without pulling the corresponding proto dependency.
Here we go:

% ninja -C out/x64.optdebug d8 -j 960 -d keeprsp
% cat out/x64.optdebug/libv8_libplatform.so.rsp

-Wl,--whole-archive obj/v8_libplatform/default-foreground-task-runner.o obj/v8_libplatform/default-platform.o obj/v8_libplatform/default-worker-threads-task-runner.o obj/v8_libplatform/task-queue.o obj/v8_libplatform/trace-buffer.o obj/v8_libplatform/trace-config.o obj/v8_libplatform/trace-object.o obj/v8_libplatform/trace-writer.o obj/v8_libplatform/tracing-controller.o obj/v8_libplatform/worker-thread.o obj/third_party/perfetto/protos/perfetto/trace/zero/clock_snapshot.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/zero/trace_stats.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/zero/test_event.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/zero/trace_packet.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/zero/trace.pbzero.o obj/protobuf_lite/arena.o obj/protobuf_lite/arenastring.o obj/protobuf_lite/extension_set.o obj/protobuf_lite/generated_message_util.o obj/protobuf_lite/coded_stream.o obj/protobuf_lite/zero_copy_stream.o obj/protobuf_lite/zero_copy_stream_impl_lite.o obj/protobuf_lite/message_lite.o obj/protobuf_lite/repeated_field.o obj/protobuf_lite/atomicops_internals_x86_gcc.o obj/protobuf_lite/atomicops_internals_x86_msvc.o obj/protobuf_lite/bytestream.o obj/protobuf_lite/common.o obj/protobuf_lite/int128.o obj/protobuf_lite/once.o obj/protobuf_lite/status.o obj/protobuf_lite/statusor.o obj/protobuf_lite/stringpiece.o obj/protobuf_lite/stringprintf.o obj/protobuf_lite/structurally_valid.o obj/protobuf_lite/strutil.o obj/protobuf_lite/time.o obj/protobuf_lite/wire_format_lite.o obj/third_party/perfetto/protos/perfetto/config/zero/chrome_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/data_source_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/data_source_descriptor.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/ftrace_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/inode_file_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/android_power_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/process_stats_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/heapprofd_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/sys_stats_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/test_config.pbzero.o obj/third_party/perfetto/protos/perfetto/config/zero/trace_config.pbzero.o obj/third_party/perfetto/protos/perfetto/common/zero/commit_data_request.pbzero.o obj/third_party/perfetto/protos/perfetto/common/zero/android_log_constants.pbzero.o obj/third_party/perfetto/protos/perfetto/common/zero/sys_stats_counters.pbzero.o obj/third_party/perfetto/src/protozero/protozero/message.o obj/third_party/perfetto/src/protozero/protozero/message_handle.o obj/third_party/perfetto/src/protozero/protozero/proto_decoder.o obj/third_party/perfetto/src/protozero/protozero/proto_field_descriptor.o obj/third_party/perfetto/src/protozero/protozero/scattered_heap_buffer.o obj/third_party/perfetto/src/protozero/protozero/scattered_stream_null_delegate.o obj/third_party/perfetto/src/protozero/protozero/scattered_stream_writer.o obj/third_party/perfetto/src/base/base/file_utils.o obj/third_party/perfetto/src/base/base/metatrace.o obj/third_party/perfetto/src/base/base/paged_memory.o obj/third_party/perfetto/src/base/base/string_splitter.o obj/third_party/perfetto/src/base/base/string_utils.o obj/third_party/perfetto/src/base/base/thread_checker.o obj/third_party/perfetto/src/base/base/time.o obj/third_party/perfetto/src/base/base/virtual_destructors.o obj/third_party/perfetto/src/base/base/event.o obj/third_party/perfetto/src/base/base/pipe.o obj/third_party/perfetto/src/base/base/temp_file.o obj/third_party/perfetto/src/base/base/unix_task_runner.o obj/third_party/perfetto/src/base/base/watchdog_posix.o obj/third_party/perfetto/protos/perfetto/trace/chrome/zero/chrome_trace_event.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/filesystem/zero/inode_file_map.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/ftrace_event.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/ftrace_event_bundle.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/ftrace_stats.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/test_bundle_wrapper.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/generic.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/binder.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/block.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/cgroup.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/clk.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/compaction.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/ext4.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/f2fs.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/fence.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/filemap.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/ftrace.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/i2c.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/ipi.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/irq.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/kmem.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/lowmemorykiller.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/mdss.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/oom.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/power.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/regulator.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/sched.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/signal.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/sync.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/task.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/vmscan.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ftrace/zero/workqueue.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/power/zero/battery_counters.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/profiling/zero/profile_packet.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ps/zero/process_stats.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/ps/zero/process_tree.pbzero.o obj/third_party/perfetto/protos/perfetto/trace/sys_stats/zero/sys_stats.pbzero.o obj/third_party/perfetto/src/tracing/tracing/android_log_config.o obj/third_party/perfetto/src/tracing/tracing/android_power_config.o obj/third_party/perfetto/src/tracing/tracing/chrome_config.o obj/third_party/perfetto/src/tracing/tracing/commit_data_request.o obj/third_party/perfetto/src/tracing/tracing/data_source_config.o obj/third_party/perfetto/src/tracing/tracing/data_source_descriptor.o obj/third_party/perfetto/src/tracing/tracing/ftrace_config.o obj/third_party/perfetto/src/tracing/tracing/heapprofd_config.o obj/third_party/perfetto/src/tracing/tracing/id_allocator.o obj/third_party/perfetto/src/tracing/tracing/inode_file_config.o obj/third_party/perfetto/src/tracing/tracing/null_trace_writer.o obj/third_party/perfetto/src/tracing/tracing/packet_stream_validator.o obj/third_party/perfetto/src/tracing/tracing/process_stats_config.o obj/third_party/perfetto/src/tracing/tracing/shared_memory_abi.o obj/third_party/perfetto/src/tracing/tracing/shared_memory_arbiter_impl.o obj/third_party/perfetto/src/tracing/tracing/sliced_protobuf_input_stream.o obj/third_party/perfetto/src/tracing/tracing/startup_trace_writer.o obj/third_party/perfetto/src/tracing/tracing/sys_stats_config.o obj/third_party/perfetto/src/tracing/tracing/test_config.o obj/third_party/perfetto/src/tracing/tracing/trace_buffer.o obj/third_party/perfetto/src/tracing/tracing/trace_config.o obj/third_party/perfetto/src/tracing/tracing/trace_packet.o obj/third_party/perfetto/src/tracing/tracing/trace_writer_impl.o obj/third_party/perfetto/src/tracing/tracing/tracing_service_impl.o obj/third_party/perfetto/src/tracing/tracing/virtual_destructors.o obj/third_party/perfetto/protos/perfetto/common/lite/commit_data_request.pb.o obj/third_party/perfetto/protos/perfetto/common/lite/android_log_constants.pb.o obj/third_party/perfetto/protos/perfetto/common/lite/sys_stats_counters.pb.o obj/third_party/perfetto/protos/perfetto/trace/minimal_lite/clock_snapshot.pb.o obj/third_party/perfetto/protos/perfetto/trace/minimal_lite/trace_stats.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/chrome_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/data_source_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/data_source_descriptor.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/ftrace_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/inode_file_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/android_power_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/process_stats_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/heapprofd_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/sys_stats_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/test_config.pb.o obj/third_party/perfetto/protos/perfetto/config/lite/trace_config.pb.o obj/third_party/perfetto/protos/perfetto/trace/trusted_lite/trusted_packet.pb.o ./libv8_libbase.so ./libc++.so -Wl,--no-whole-archive  -ldl -lpthread -lrt %
Looks like we somehow pull in android_log_config.o but no android_log_config.pb.o ?
Cc: oysteine@chromium.org skyos...@chromium.org eseckler@chromium.org
+chrometto folks for some help.

This is super weird. We manage to pull inode_file_config.pb.o but not android_log_config.pb.o. Both of them are in the same sources section of perfetto/protos/perfetto/config/BUILD.gn

Peter, which revision of perfetto (as in, git log -1) are you using?

This suspiciously feels like the magic GN source filter hitting again (the file gets auto excluded because the folder name is "android").
eseckler fixed in http://aosp/862389 though and that fix should apply to v8 as well.
Do you have those set_sources_assignment_filter([]) lines in your config/BUILD.gn? 
% cd third_party/perfetto
% git log -1

commit 80b4fbd1d6519b039410b7bbb3a519e86f7aeaff (HEAD -> master, origin/master, origin/HEAD)
Merge: 5fff009e 8e22bfc7
Author: Treehugger Robot <treehugger-gerrit@google.com>
Date:   Sat Jan 12 02:04:33 2019 +0000

    Merge "Make test targets no-ops on non-chromium embedders."


Yes those set_sources_assignment_filter([]) lines are in third_party/perfetto/protos/perfetto/config/BUILD.gn


This sounds a lot like a sources filter. Maybe try adding a set_sources_assignment_filter([]) to your proto_library template / new targets to see if that resolves the problem.
Yes adding set_sources_assignment_filter([]) to proto_library.gni fixes it. Thanks all!

One other error I get is a link error against perfetto::base::Watchdog::GetInstance() coming from tracing_service_impl.cc:1512. In src/base/BUILD.gn, watchdog_posix.cc is only added as a source according to:

if ((perfetto_build_standalone || perfetto_build_with_android) &&
     (is_linux || is_android) && !is_wasm) {
  sources += [ "watchdog_posix.cc" ]
}

but watchdog.h does this:

#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) ||    \
     PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) && \
    !PERFETTO_BUILDFLAG(PERFETTO_CHROMIUM_BUILD)
#include "perfetto/base/watchdog_posix.h"
#else
#include "perfetto/base/watchdog_noop.h"
#endif

So my configuration ends up including watchdog_posix.h but doesn't build watchdog_posix.cc.

I can work around this for now by just editing src/base/BUILD.gn directly.

Comment 10 by petermarshall@chromium.org, Jan 16 (6 days ago)

It works with that CL. I need to add:

default_args = {
  perfetto_build_with_embedder = true
}

to v8/.gn though. Not sure if that is the proper way to do it
Project Member

Comment 11 by bugdroid1@chromium.org, Jan 16 (6 days ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/86bb457bdedb28c3d38480b2680372ddc5bd3182

commit 86bb457bdedb28c3d38480b2680372ddc5bd3182
Author: chromium-autoroll <chromium-autoroll@skia-public.iam.gserviceaccount.com>
Date: Wed Jan 16 17:47:23 2019

Roll src/third_party/perfetto e2f79261ed5f..3c4d2b4f8286 (3 commits)

https://android.googlesource.com/platform/external/perfetto.git/+log/e2f79261ed5f..3c4d2b4f8286


git log e2f79261ed5f..3c4d2b4f8286 --date=short --no-merges --format='%ad %ae %s'
2019-01-16 lalitm@google.com Merge "trace_processor: improve best index for thread table"
2019-01-16 primiano@google.com Perfetto: clean up PERFETTO_EMBEDDER_BUILD
2019-01-16 taylori@google.com Merge "trace_processor: Fix parsing of empty events"


Created with:
  gclient setdep -r src/third_party/perfetto@3c4d2b4f8286

The AutoRoll server is located here: https://autoroll.skia.org/r/perfetto-chromium-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff, who should
be CC'd on the roll, and stop the roller if necessary.



BUG= chromium:921584 
TBR=perfetto-bugs@google.com

Change-Id: I8f941aa1f253d8d51eca483942e1b58bf4600e66
Reviewed-on: https://chromium-review.googlesource.com/c/1414992
Reviewed-by: chromium-autoroll <chromium-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: chromium-autoroll <chromium-autoroll@skia-public.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#623284}
[modify] https://crrev.com/86bb457bdedb28c3d38480b2680372ddc5bd3182/DEPS

Comment 12 by primiano@chromium.org, Jan 17 (5 days ago)

Re #10: I think https://android-review.googlesource.com/c/platform/external/perfetto/+/873138 will fix that and make that unnecessary. Just tried rebasing my POC, and I don't hit gn warnings anymore after that on ToT

Comment 13 by petermarshall@google.com, Yesterday (41 hours ago)

Status: Fixed (was: Untriaged)
Yep that works now, thanks. Looks like all the build issues are fixed for our use-case now

Sign in to add a comment