0

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

sunkeet
  • 1
  • 3
  • You have to modify a specific `BUILD.gn` file to add the necessary source files or libraries. Look up how to use `GN` build system: https://gn.googlesource.com/gn/ – Asesh Mar 05 '22 at 11:39
  • Thank you very much! I will keep this thread updated – sunkeet Mar 05 '22 at 12:05
  • You need to learn the GN build system properly. Spend some time with it. Just including cpp files in source tag should suffice in most of the cases – Asesh Mar 06 '22 at 15:17
  • Oh. I am reading it thoroughly but i was a bit scared to modify the source tag. I will definitely give it a try. I was designing a solution where there is a new component or group with new sources and they import the other headers and librarie, but I will try your answer first as it seems simpler and i didnt try. Thank you very much! – sunkeet Mar 06 '22 at 18:14
  • It's better to try doing so with a simple skeleton project. Doing so in Chromium might trigger recompilation from scratch again, I have faced that so many times. It will be faster and easier to learn from a skeleton project too – Asesh Mar 07 '22 at 03:41
  • I did it, and works as I thought it should work. I am trying to replicate the error in this new project but it's easy to fix, unlike the Chromium one. I am not sure why. I will take a closer look or try to add a new source that includes both. Thanks again – sunkeet Mar 11 '22 at 05:58
  • I cnt find a solution yet, I understand the gn system, I have been building more projects, tried all combinations of arguments... There must be something i am missing. I don't like gn – sunkeet Mar 14 '22 at 00:29

0 Answers0