Gentoo Chromium

我在完成 在MacBook Pro上安装Gentoo Linux在Gentoo环境安装和使用Sway 之后,首先安装的软件就是浏览器 chromium

USE参数

  • 由于我想体验完整的 wayland显示服务器协议 ,所以在 USE 参数中采用了 wayland -x

  • 编译安装会提示需要 icu 支持,所以按照提示在 /etc/portage/package.use/chromium 配置以下这些依赖软件包参数:

/etc/portage/package.use/chromium 配置依赖包的USE flag
dev-libs/libxml2 icu
media-libs/harfbuzz icu
sys-libs/zlib minizip
net-libs/nodejs inspector
  • 修订参数之后需要重建一次整个系统:

在修改了全局 USE flag 之后对整个系统进行更新
emerge --ask --changed-use --deep @world

编译安装

安装chromium
emerge --ask www-client/chromium

原生Wayland支持

chromium从 v87 开始原生支持 wayland显示服务器协议 ,但是需要传递以下参数:

chromium原生wayland支持需要传递正确参数
chromium --enable-features=UseOzonePlatform --ozone-platform=wayland

也可以通过配置文件传递参数: ~/.config/chromium-flags.conf

通过 ~/.config/chromium-flags.conf 传递原生wayland参数给chromium
--enable-features=UseOzonePlatform
--ozone-platform=wayland

dbus支持

虽然chromium没有像firefox那样强制要求 Gentoo D-Bus 支持,但是实际上运行还是会在终端中看到连接 bus 的提示, 虽然似乎不影响运行 :

终端运行 chromium 的一些报错信息,似乎不影响
...
[17161:17243:0915/233916.212936:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[17161:17243:0915/233916.212984:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[17200:17200:0915/233916.368689:ERROR:gbm_pixmap_wayland.cc(82)] Cannot create bo with format= RGBA_8888 and usage=SCANOUT
[17200:17200:0915/233916.370962:ERROR:gbm_pixmap_wayland.cc(82)] Cannot create bo with format= RGBA_8888 and usage=GPU_READ
[17200:17200:0915/233916.371051:ERROR:shared_image_factory.cc(751)] CreateSharedImage: could not create backing.
[17200:17200:0915/233916.371138:ERROR:shared_image_factory.cc(604)] DestroySharedImage: Could not find shared image mailbox
[17200:17200:0915/233916.371267:ERROR:gpu_service_impl.cc(1054)] Exiting GPU process because some drivers can't recover from errors. GPU process will restart shortly.
[17161:17161:0915/233916.412162:ERROR:gpu_process_host.cc(956)] GPU process exited unexpectedly: exit_code=8704
...
[17296:17296:0915/233916.930852:ERROR:gl_display.cc(824)] Initialization of all EGL display types failed.
[17296:17296:0915/233916.930981:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
...
[17296:17296:0915/233916.933727:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
[17269:1:0915/233947.999836:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.
libpng warning: iCCP: known incorrect sRGB profile

参考