I need to build Chromium after I include some dependencies

549 Views Asked by At

I am simply building Chromium windows. It builds perfectly and works in every configuration I try. When I modify the source code, to include, in select_file_picker_win.cpp

#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "content/public/browser/navigation_controller.h"

doesn't work.

The problem is that it can't link to the object generated. Unresolved symbol browser.create

I tried different linkers, different compilers, different gn gen configurations, and same.

Where do I need to tell gn or ninja about this, to add this object when linking this file?

Something changes when i modify the ninja file inside the out folder, related to selectfile.. the error becomes a cyclic redundancy problem, and the file gets overwritten anyway so i know it is not the right solution.

lld-link: ←[0;31merror: ←[0mundefined symbol: public: __cdecl Browser::CreateParams::CreateParams(enum Browser::Type, class Profile *, bool)

Edit:

I modified BUILD.gn to add this:

deps = [
        "//base",
        "//base:i18n",
        "//build:chromeos_buildflags",
        "//skia",
        "//ui/base",
        "//ui/strings",
        "//url",
        "//chrome/browser",
        
      ]

allow_circular_includes_from = [
    "//chrome/browser",
]

but the BUILD.gn from chrome/browser includes the previous, so I expected a cyclic redundancy. I have it:

ERROR Dependency cycle: //content:content ->
//content/gpu:gpu_sources -> //content/child:child ->
//content/common:common -> //ui/shell_dialogs:shell_dialogs ->
//chrome/browser:browser -> //apps:apps ->
//components/keyed_service/content:content ->
//content/public/browser:browser -> //content:content

FAILED: build.ninja

so I added this:

allow_circular_includes_from = [
    "//chrome/browser/devtools",
    "//chrome/browser/profiling_host",
    "//chrome/browser/ui",
    "//chrome/browser/ui/webui/bluetooth_internals",
    "//chrome/browser/storage_access_api:permissions",
    "//chrome/browser/safe_browsing",
    "//chrome/browser/safe_browsing:verdict_cache_manager_factory",
    "//chrome/browser/safe_browsing:advanced_protection",
    "//chrome/browser/safe_browsing:metrics_collector",
    "//ui/shell_dialogs",
    
[0/1] Regenerating ninja files
ERROR Dependency cycle:
  //content:content ->
  //content/gpu:gpu_sources ->
  //content/child:child ->
  //content/common:common ->
  //ui/shell_dialogs:shell_dialogs ->
  //chrome/browser:browser ->
  //apps:apps ->
  //components/keyed_service/content:content ->
  //content/public/browser:browser ->
  //content:content

FAILED: build.ninja
../../buildtools/win/gn.exe --root=../.. -q --ide=vs --regeneration gen .
ninja: error: rebuilding 'build.ninja': subcommand failed

Edit: https://github.com/skopf/minimal-gn-project this does not work, complains about gn.exe missing, but gn is both in the path and current dir,

When component build = false,

//content/browser:browser -> //content/common:common ->
//ui/shell_dialogs:shell_dialogs -> //chrome/browser:browser ->
//apps:apps -> //components/keyed_service/content:content ->
//content/public/browser:browser ->
//content/public/browser:browser_sources ->
//content/browser:browser

the dependencies are different, same error. I tried adding

allow_circular_includes_from = [
  "//ui/shell_dialogs",
  "//content/common",
  ]

but does not solve anything, in any of the files.

C:\q\src>gn gen out/q

ERROR Dependency cycle: //content/browser:browser ->
//content/common:common -> //ui/shell_dialogs:shell_dialogs ->
//chrome/browser:browser -> //apps:apps ->
//components/keyed_service/content:content ->
//content/public/browser:browser ->
//content/public/browser:browser_sources ->
//content/browser:browser

0

There are 0 best solutions below