在包含一些依赖项后,我需要构建 Chromium

发布于 2025-01-11 18:08:53 字数 3348 浏览 2 评论 0原文

我只是在构建 Chromium 窗口。它构建完美,并且适用于我尝试的每种配置。当我修改源代码时,将其包含在 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"

不起作用。

问题是它无法链接到生成的对象。 无法解析的符号 browser.create

我尝试了不同的链接器、不同的编译器、不同的 gn gen 配置,等等。

我需要在哪里告诉 gn 或 ninja ,以便在链接此文件时添加此对象?

当我修改 out 文件夹内与 selectfile 相关的 ninja 文件时,某些内容发生了变化。错误变成了循环冗余问题,并且文件无论如何都会被覆盖,所以我知道这不是正确的解决方案。

lld-link: ←[0;31merror: ←[0mundefine 符号: public: __cdecl Browser::CreateParams::CreateParams(enum Browser::Type, 类 Profile *,布尔)

编辑:

我修改了 BUILD.gn 以添加以下内容:

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

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

但是 chrome/浏览器中的 BUILD.gn 包含之前的内容,因此我预计会出现循环冗余。我有:

错误依赖循环://内容:内容->
//内容/gpu:gpu_sources -> //内容/子项:子项->
//内容/通用:通用-> //ui/shell_dialogs:shell_dialogs ->
//chrome/浏览器:浏览器-> //应用程序:应用程序->
//components/keyed_service/content:内容 ->
//内容/公共/浏览器:浏览器-> //内容:内容

失败:build.ninja

所以我添加了这个:

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] 重新生成忍者文件
错误依赖循环:
  //内容:内容->
  //内容/gpu:gpu_sources ->
  //内容/子:子->
  //内容/通用:通用->
  //ui/shell_dialogs:shell_dialogs ->
  //chrome/浏览器:浏览器->
  //应用程序:应用程序->
  //components/keyed_service/content:内容 ->
  //内容/公共/浏览器:浏览器->
  //内容:内容

失败:build.ninja
../../buildtools/win/gn.exe --root=../.. -q --ide=vs --regenesis gen 。
ninja:错误:重建“build.ninja”:子命令失败

编辑: https://github.com/skopf/minimal-gn-project 这不起作用,抱怨 gn.exe 丢失,但 gn 既在路径中又在当前目录中,

当组件 build = false 时,

//内容/浏览器:浏览器-> //内容/通用:通用->
//ui/shell_dialogs:shell_dialogs -> //chrome/browser:浏览器 ->
//应用程序:应用程序-> //components/keyed_service/content:内容 ->
//内容/公共/浏览器:浏览器 ->
//内容/公共/浏览器:browser_sources ->
//内容/浏览器:浏览器

依赖项不同,同样的错误。 我尝试

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

在任何文件中添加但没有解决任何问题。

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

错误依赖循环: //content/browser:browser ->
//内容/通用:通用-> //ui/shell_dialogs:shell_dialogs ->
//chrome/浏览器:浏览器-> //应用程序:应用程序->
//components/keyed_service/content:内容 ->
//内容/公共/浏览器:浏览器 ->
//内容/公共/浏览器:browser_sources ->
//内容/浏览器:浏览器

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文