From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Chromium and the translation is 48% complete.
Outdated translations are marked like this.
Other languages:

Chromium 是Google Chrome 网络浏览器的开源版本。 它具有最小的用户界面、强大的网络开发工具和内置的任务管理器。 Chromium 项目处于实施新 Web 标准的最前沿。

Because Chromium is open source it is legally unable to include several features that the proprietary Google Chrome browser includes by default. Namely automatic updates. A complete list of the differences can be found in the chromium repository.


USE 标记

USE flags for www-client/chromium Open-source version of Google Chrome web browser

X Add support for X11
bindist Flag to enable or disable options for prebuilt (GRP) packages (eg. due to licensing issues)
cups Add support for CUPS (Common Unix Printing System)
custom-cflags Build with user-specified CFLAGS (unsupported)
debug Enable DCHECK feature with severity configurable at runtime. Mostly intended for debugging and development, NOT RECOMMENDED for general use.
ffmpeg-chromium (binpkg only) Use Chromium FFmpeg fork (media-video/ffmpeg-chromium) rather than mainline FFmpeg (media-video/ffmpeg)
gtk4 Build with GTK4 headers.
hangouts Enable support for Google Hangouts features such as screen sharing
headless Build Ozone only with headless backend, NOT RECOMMENDED for general use.
kerberos Add kerberos support
libcxx Use bundled libc++ instead of libstdc++ for building.
lto Build with Link Time Optimizations (via clang's ThinLTO)
official Enable Official build instead of Developer build.
pax-kernel Allow building on a PaX-enabled kernel
pgo Build with Profile Guided Optimizations (2-stage compilation)
proprietary-codecs Enable codecs for patent-encumbered audio and video formats.
pulseaudio Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire)
qt5 Add support for the Qt 5 application and UI framework
qt6 Add support for the Qt 6 application and UI framework
screencast Enable support for remote desktop and screen cast using PipeWire
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
system-harfbuzz Use system media-libs/harfbuzz instead of the bundled library.
system-icu Use system dev-libs/icu instead of the bundled one
system-png Use system media-libs/libpng instead of the bundled library
system-toolchain Use system toolchain instead of the bundled one (if possible)
system-zstd Use system app-arch/zstd instead of the bundled one.
vaapi Enable Video Acceleration API for hardware decoding
wayland Enable dev-libs/wayland backend
widevine Unsupported closed-source DRM capability (required by Netflix VOD)


为了避免与 dev-libs/libxml2 的安装版本发生冲突,从而阻止 Chromium 的安装,必须在 /etc/portage/make.conf 中设置 icu USE 标志。如果 icu 是新设置的,在安装 Chromium 之前需要更新系统,执行:

root #emerge --ask --update --deep --newuse @world

l10n (语言)

Chromium 中的 USE_EXPAND 有许多可用的语言。事实上,它们多到维基无法显示所有。要获得完整的语言列表,请运行:

user $equery u www-client/chromium | grep l10n
equery 工具是 app-portage/gentoolkit 软件包的一部分。需要安装它才能使用上述命令。

有关本地化的更多信息,请参阅 本地化文章


请注意,编译 Chromium 会占用大量时间、CPU 时间和系统内存。每个 make 线程允许 2Gb 的 RAM(由 MAKEOPTS 定义,请参阅 这篇文章)。在系统负载较重的情况下构建 Chromium 可能不是一个好主意。

根据需要设置 USE 标志后,使用以下命令 emerge Chromium:

root #emerge --ask www-client/chromium



To build Chromium with Clang, first see Clang environments.

For Chromium specifically, the following env settings are needed:

文件 /etc/portage/env/clang-chromium
# Optionally, add these to EXTRA_GN:
# - thin_lto_enable_optimizations=true 
# - use_thin_lto=true
# - is_cfi=true 
EXTRA_GN="use_lld=true is_clang=true clang_use_chrome_plugins=false" 
# Needed with GCC 11

Then enable it (note that we take the base Clang config from the other article, then add the settings we just defined):

文件 /etc/portage/package.env
# compiler-clang: build with a general Clang environment (see Clang article)
# clang-chromium: build with tweaks specifically for Chromium
www-client/chromium compiler-clang clang-chromium


Chromium 的视觉输出通常不与 Desktop environment 的 DPI 缩放关联。可以使用 --force-device-scale-factor 命令行选项指示它以缩放模式启动。此选项可以传递一个整数或十进制值。标准缩放从 1.0 开始。例如,要将 Chromium 的 UI 放大 1.5 倍:

user $chromium --force-device-scale-factor=1.5

可以在 此处 找到命令行开关的完整列表。

本地 Wayland 支持

从版本 87 开始,可以通过传递以下 选项 来启用 Chromium 中的原生 Wayland 支持:

user $chromium --enable-features=UseOzonePlatform --ozone-platform=wayland

要将 Chromium 设置为每次使用 Wayland 后端启动,请在用户的 Chromium 配置文件中附加以下几行:

文件 ~/.config/chromium-flags.conf

Enable dark theme for pages (prefers-color-scheme)

Because of bug in May 2022 Chromium on GTK do not understand that user want to see dark pages. But you can set this preference manually:

文件 /etc/chromium/default

First is for regular pages, the second is for internal chrome:// pages.


从版本 91.0.4472.77 开始,不再可能在 Chrome 标志中禁用标签悬停卡。 Google 也似乎没有优先考虑重新添加此功能。为了禁用它们,你可以将此补丁添加到 Portage:

文件 /etc/portage/patches/www-client/chromium/hover-card.patch
diff --git a/chrome/browser/ui/views/tabs/ b/chrome/browser/ui/views/tabs/
index 59e2d1e1fc..d94947109c 100644
--- a/chrome/browser/ui/views/tabs/
+++ b/chrome/browser/ui/views/tabs/
@@ -2119,6 +2119,7 @@ void TabStrip::OnMouseEventInTab(views::View* source,
 void TabStrip::UpdateHoverCard(Tab* tab, HoverCardUpdateType update_type) {
+  return;
   // We don't want to show a hover card while the tabstrip is animating.
   if (bounds_animator_.IsAnimating()) {
     // Once we're animating the hover card should already be hidden.

另请参阅 添加标签悬停卡的设置


It is possible to set specific policies for chromium. This can be useful especially if the browser should be accessible by users, but the content should be restricted to trusted sites. It can also be configured to restrict the access to specified URIs, like the file:// protocol, to prevent users from surfing the file system.

Chromium looks in /etc/chromium/policies for existing policies. There are two types of policies which can be defined:

  • managed
  • recommended

Generally managed policies are maintained by an administrator and recommended policies are recommended for users but not required.
For further information about the two policy types the documentation should be referred on the Google Chrome support page.

The following example assumes managed policies. However, the procedure for recommended policies is very similar and can be found in the Chromium documentation.

Creating of managed policies

To set custom managed policies, a JSON file must be created in /etc/chromium/policies/managed/<filename>.json

It is important to ensure, that the <filename>.json is not writable by non-admin users, to prevent overwriting of the policies by users, which would defeat the purpose of policies! The chown(1) and chmod(1) commands can be used to change ownership and rights if for any reason the file should be writable by non-admin users.

The structure of the JSON file is the same for all chromium based browsers (Chrome, Chromium, Brave etc). An example JSON file could look like this:

"IncognitoModeAvailability": 1,
"URLBlocklist": [
"DefaultGeolocationSetting": 2,
"DefaultNotificationsSetting": 2,

This prevents the user from surfing on the file system using the file protocol, incognito mode, blocks the listed URIs and URLs, and the location and notifications. More settings, can be found in the policy list: If configured for other users as a service, it is recommended to block all sites at first and then define the allowed sites, to avoid abuse of the service. Please note that this only blocks the user from visiting specified locations. It does not disable the protocols on the system, so other applications must be configured separately.

If the policy was configured properly can be proofed on the special page: chrome://policy.

For a better structure, it is also possible to spread the policies over multiple JSON files. In this case it is indispensable to ensure that the same policy occurs only once per all files! If a policy is defined multiple times across the JSON files than the state of the policy will be undefined and it would be unclear which rule would be used!

Meaningful filenames and a simple grep across the files in case of doubt can help to prevent such misconfigurations.


Chrome 网址

与 Firefox 非常相似,Chromium 有许多内部 Chrome 网址(特殊页面),用于额外配置、故障排除、任务管理等。可以通过导航到以下位置访问特殊页面的详尽列表:chrome://about/


  • chrome://components/ - Shows enabled components and provides a button to check for updates for each of them. It is sometimes necessary to manually update the PPAPI Adobe flash module via this interfaces when using Chrome.
  • chrome://chrome/ - Displays the About page which includes version information.
  • chrome://extensions/ - A page to manage extensions.
  • chrome://flags/ - Enable/disable experimental features.
  • chrome://flash/ - Displays special information about the Adobe Flash Player (if it is accessible by Chromium).
  • chrome://gpu/ - Displays information about use of graphics acceleration.
  • chrome://history/ - Displays web history. Also accessible through the sandwich menu or by pressing Ctrl+h.
  • chrome://memory-redirect/ - Measure the memory usage of the browser and per-tab usage.
  • chrome://net-internals/ - Lots of information on network connections.
  • chrome://plugins/ - Shows a list of plugins. Enable/disable them from this interface. (Deprecated in Chrome version 57[1].)
  • chrome://version/ - Displays more version information than the chrome page.


Screencast support

Screencast is disabled by default at runtime. Either enable it by navigating to chrome://flags/#enable-webrtc-pipewire-capturer inside Chromium or add --enable-features=WebRTCPipeWireCapturer as a value to the CHROMIUM_FLAGS variable in the /etc/chromium/default file.


Chromium 中的标签页偶尔会崩溃。这可能由很多原因引起,但最常见的原因之一是系统内存不足。在 Gentoo 上,如果系统正在编译更新 www-client/chromium同时运行 Chromium,这种情况大概率会发生。

free 命令可用于查看系统上有多少可用内存:

user $free -h
              total        used        free      shared  buff/cache   available
Mem:            15G         11G        735M        789M        3.4G        3.1G



  • Firefox — Mozilla's web browser.
  • Chrome — Google's proprietary (closed source) web browser.