New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 731009 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Replace device::UsbDeviceFilter with device::mojom::UsbDeviceFilter to fix dependency cycle

Project Member Reported by mpawlow...@opera.com, Jun 8 2017

Issue description

Chrome Version: rev b4637d2197e8ea48a2b3825a3a5d777c87c84411
OS: repro'd on Win and Lin

What steps will reproduce the problem?
(1) ninja -C out/Release -t clean
(2) ninja -C out/Release obj/device/usb/usb/usb_descriptors.o


[1/1] Regenerating ninja files
[918/918] CXX obj/device/usb/usb/usb_descriptors.o
FAILED: obj/device/usb/usb/usb_descriptors.o 
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/device/usb/usb/usb_descriptors.o.d -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"303910-1\" -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCOMPONENT_BUILD -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_GLIBCXX_DEBUG=1 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DPROTOBUF_USE_DLLS -DBORINGSSL_SHARED_LIBRARY -I../.. -Igen -I../../build/linux/debian_jessie_amd64-sysroot/usr/include/glib-2.0 -I../../build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/protobuf/src -I../../third_party/boringssl/src/include -I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nss -I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nspr -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -B../../third_party/binutils/Linux_x64/Release/bin -fcolor-diagnostics -m64 -march=x86-64 -pthread -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -O0 -fno-omit-frame-pointer -g2 -gsplit-dwarf --sysroot=../../build/linux/debian_jessie_amd64-sysroot -fvisibility=hidden -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-auto-raw-pointer -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wno-header-guard -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=gnu++11 -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -c ../../device/usb/usb_descriptors.cc -o obj/device/usb/usb/usb_descriptors.o
In file included from ../../device/usb/usb_descriptors.cc:5:
In file included from ../../device/usb/usb_descriptors.h:17:
gen/device/usb/public/interfaces/device.mojom.h:33:10: fatal error: 'device/usb/public/interfaces/device.mojom-shared.h' file not found
#include "device/usb/public/interfaces/device.mojom-shared.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.



The issue is probably related to the workaround in https://cs.chromium.org/chromium/src/device/usb/BUILD.gn?l=70&rcl=020c1992c67d99bd0a6d994ce6d14d450a639ed7

This attempts to work around a dependency cycle. Apparently, the dependency to generate mojom headers is lost.

This causes flaky builds on all platforms.

 
Components: IO>USB
Cc: roc...@chromium.org yzshen@chromium.org
Labels: OS-Android OS-Chrome OS-Mac
Status: Available (was: Untriaged)
Oh fudge. Ken or Yuzhu, is there a real solution for this? The problem is the cycle caused by device/usb/public/interfaces/device_manager_struct_traits.h depending on //device/usb for usb_device_filter.h and device/usb/usb_descriptors.h depending on //device/usb/public/interfaces for device.mojom.h.
I'd wager a guess that you need to split one or both targets involved in the cycle into smaller parts
The solution is to break the circular dependency. A typemap's dependencies
are inherited by the mojom target to which the typemap applies. So a
typemap (and therefore a mojom) cannot depend on a target which in turn
depends on the mojom. I don't think there's any magic we can do do avoid
this.
Cc: reillyg@chromium.org
Summary: Replace device::UsbDeviceFilter with device::mojom::UsbDeviceFilter to fix dependency cycle (was: Broken/flaky build dependency from //device/usb to mojo header generator)
Okay, then the easiest way to resolve this issue is to go ahead with a step that was already planned as part of USB servicification and replace device::UsbDeviceFilter with device::mojom::UsbDeviceFilter.
Cc: -reillyg@chromium.org
Owner: reillyg@chromium.org
Status: Started (was: Available)
Project Member

Comment 7 by bugdroid1@chromium.org, Jun 17 2017

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

commit 7f162c9f968e2bc5e73cab0e754ca4aecd6503d8
Author: Reilly Grant <reillyg@chromium.org>
Date: Sat Jun 17 00:17:30 2017

Replace device::UsbDeviceFilter with device::mojom::UsbDeviceFilter

There is no need to use a custom class to represent USB device filters.
The Mojo type plus a set of functions to perform filter matching are all
that is necessary. This allows us to delete a bunch of code and break a
circular dependency between //device/usb and the typemaps defined in
//device/usb/public/interfaces.

Bug:  731009 
Change-Id: If2522e775d5521ef7fb42b63165daa4d51963074
Reviewed-on: https://chromium-review.googlesource.com/527487
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#480236}
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/android/usb/web_usb_chooser_service_android.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/android/usb/web_usb_chooser_service_android.h
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/chromeos/printer_detector/cups_printer_detector.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/chromeos/printer_detector/legacy_printer_detector.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/chromeos/printing/usb_printer_util.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/ui/BUILD.gn
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/ui/android/usb_chooser_dialog_android.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/ui/android/usb_chooser_dialog_android.h
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/usb/usb_browsertest.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/usb/usb_chooser_controller.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/usb/usb_chooser_controller.h
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/usb/usb_chooser_controller_unittest.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/usb/web_usb_chooser_service.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/chrome/browser/usb/web_usb_chooser_service.h
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/BUILD.gn
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/BUILD.gn
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/mojo/BUILD.gn
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/mojo/device_manager_impl.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/mojo/device_manager_impl_unittest.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/mojo/type_converters.h
[add] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/public/cpp/BUILD.gn
[add] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/public/cpp/filter_utils.cc
[add] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/public/cpp/filter_utils.h
[add] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/public/cpp/filter_utils_unittest.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/device/usb/public/interfaces/OWNERS
[delete] https://crrev.com/04f2b90690644acc3c81bdd98ab7f379eddb10b7/device/usb/public/interfaces/device_manager.typemap
[delete] https://crrev.com/04f2b90690644acc3c81bdd98ab7f379eddb10b7/device/usb/public/interfaces/device_manager_struct_traits.cc
[delete] https://crrev.com/04f2b90690644acc3c81bdd98ab7f379eddb10b7/device/usb/public/interfaces/device_manager_struct_traits.h
[delete] https://crrev.com/04f2b90690644acc3c81bdd98ab7f379eddb10b7/device/usb/public/interfaces/typemaps.gni
[delete] https://crrev.com/04f2b90690644acc3c81bdd98ab7f379eddb10b7/device/usb/usb_device_filter.cc
[delete] https://crrev.com/04f2b90690644acc3c81bdd98ab7f379eddb10b7/device/usb/usb_device_filter.h
[delete] https://crrev.com/04f2b90690644acc3c81bdd98ab7f379eddb10b7/device/usb/usb_device_filter_unittest.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/browser/api/device_permissions_prompt.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/browser/api/device_permissions_prompt.h
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/browser/api/usb/BUILD.gn
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/browser/api/usb/usb_api.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/browser/api/usb/usb_api.h
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/common/BUILD.gn
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/common/api/printer_provider/usb_printer_manifest_data.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/common/api/printer_provider/usb_printer_manifest_data.h
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/extensions/common/api/printer_provider/usb_printer_manifest_unittest.cc
[modify] https://crrev.com/7f162c9f968e2bc5e73cab0e754ca4aecd6503d8/mojo/public/tools/bindings/chromium_bindings_configuration.gni

Status: Fixed (was: Started)

Sign in to add a comment