New issue
Advanced search Search tips

Issue 799267 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Consider making components/crash/core/common:crash_key and/or //third_party/crashpad/crashpad/client a component

Project Member Reported by piman@chromium.org, Jan 4 2018

Issue description

From https://chromium-review.googlesource.com/c/chromium/src/+/849414 PS#5, which changes module boundaries

We end up in the situation where:
- component A (namely //gpu) defines some crash keys (in https://cs.chromium.org/chromium/src/gpu/config/gpu_crash_keys.h?q=gpu/config/gpu_crash_keys.h&sq=package:chromium&dr&l=29 , properly exported with the GPU_EXPORT macro)
- component B (namely //gpu/ipc:gl_in_process_context) sets those crash keys (in https://cs.chromium.org/chromium/src/gpu/ipc/in_process_command_buffer.cc?sq=package:chromium&dr&l=453 )

Even though A properly (publicly) depends on //components/crash/core/common:crash_key, and B depends on A, we end up with link errors on Windows and Mac. e.g.:

FAILED: gl_in_process_context.dll gl_in_process_context.dll.lib gl_in_process_context.dll.pdb 
E:/b/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x86 False link.exe /nologo /IMPLIB:./gl_in_process_context.dll.lib /DLL /OUT:./gl_in_process_context.dll /PDB:./gl_in_process_context.dll.pdb @./gl_in_process_context.dll.rsp
in_process_command_buffer.obj : error LNK2019: unresolved external symbol "public: void __thiscall crashpad::Annotation::SetSize(unsigned int)" (?SetSize@Annotation@crashpad@@QAEXI@Z) referenced in function "public: void __thiscall crashpad::StringAnnotation<4>::Set(char const *)" (?Set@?$StringAnnotation@$03@crashpad@@QAEXPBD@Z)
./gl_in_process_context.dll : fatal error LNK1120: 1 unresolved externals

The reason is that on win/mac crash_keys is a static library which links to //third_party/crashpad/crashpad/client, but gets called from inline templates from CrashKeyString::Set, but public_deps on static libraries don't propagate. The suggested workaround is to explicitly pull //components/crash/core/common:crash_key in component B.

So 2 things:
1- it's somewhat annoying and user-unfriendly to have to pull static libraries as a dependency out of nowhere (there is nothing obvious at the call site that suggests it might be necessary). This is somewhat aggravated by the fact that on other platforms (Linux/Android), crash_key is a component and so things work as expected
2- statically linking crashpad/client means duplicating globals per-component, among others the AnnotationList and we get into odd situations where a given CrashKeyString (aka StringAnnotation) can only be part of a single AnnotationList, and so setting a given CrashKeyString from 2 different components will kind of work (the annotation will be registered in the component that first sets it), but things like GetCrashKeyValue would not work properly.


I believe one way out would be to make crashpad/client a component. I don't see anything obvious that would break, but I don't know that code very well. An alternative could be to make crash_key a component, but either way crashpad/client symbols that are exposed publicly (e.g. crashpad::Annotation::SetSize) would need to be exported.
 
Status: Available (was: Untriaged)
I think I originally wanted to make it a component but didn't for two reasons: (1) Crashpad's build is still in GYP and so there was not an easy way to produce a component, and (2) there are no _EXPORT macros in Crashpad.

Crashpad is moving towards GN (issue crashpad:79), so we can look at this after that's done. But //gpu is the only place where a CrashKeyString is declared and used across module boundaries, so I'm not sure there's a huge advantage to doing so if the work is non-trivial.
Project Member

Comment 2 by sheriffbot@chromium.org, Jan 10

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment