Building chromium fails with set the variable “swiftflags” here and it was unused before it went

main menu
Chromium building failed

Apparently, the recent versions of Chromium require a new version of dev-util/gn. Trying to build Chromium web browser with an older version such as dev-util/gn-0.1807 will likely to cause the configuration stage to fail with

srv ~ # emerge -va --nodeps chromium

These are the packages that would be merged, in order:

[ebuild     U #] www-client/chromium-111.0.5545.6:0/dev::gentoo [106.0.5245.0:0/dev::gentoo] USE="X cups hangouts js-type-check kerberos official (pic) proprietary-codecs pulseaudio qt5%* screencast (selinux) suid vaapi wayland widevine (-component-build) -custom-cflags -debug -gtk4 (-headless) -libcxx -lto (-pgo) -system-av1% (-system-ffmpeg) -system-harfbuzz -system-icu -system-png" L10N="-af -am -ar -bg -bn -ca -cs -da -de -el -en-GB -es -es-419 -et -fa -fi -fil -fr -gu -he -hi -hr -hu -id -it -ja -kn -ko -lt -lv -ml -mr -ms -nb -nl -pl -pt-BR -pt-PT -ro -ru -sk -sl -sr -sv -sw -ta -te -th -tr -uk -ur -vi -zh-CN -zh-TW" 0 KiB

Total: 1 package (1 upgrade), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] yes

>>> Verifying ebuild manifests

>>> Running pre-merge checks for www-client/chromium-111.0.5545.6
.....
.....
 * Configuring Chromium...
gn gen --args= is_clang=false use_lld=false custom_toolchain="//build/toolchain/linux/unbundle:default" host_toolchain="//build/toolchain/linux/unbundle:default" is_debug=false dcheck_always_on=false dcheck_is_configurable=false is_component_build=false enable_nacl=false use_system_harfbuzz=false use_gnome_keyring=false enable_js_type_check=true enable_hangout_services_extension=true enable_widevine=true use_cups=true use_kerberos=true use_pulseaudio=true use_vaapi=true rtc_use_pipewire=true gtk_version=3 disable_fieldtrial_testing_config=true use_gold=false use_sysroot=false use_custom_libcxx=false enable_pseudolocales=false blink_enable_generated_code_formatting=false proprietary_codecs=true ffmpeg_branding="Chrome" google_api_key="AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc" target_cpu="x64" treat_warnings_as_errors=false fatal_linker_warnings=false v8_use_libm_trig_functions=true use_ozone=true ozone_auto_platforms=false ozone_platform_headless=true use_system_libdrm=true use_system_minigbm=true use_xkbcommon=true use_qt=true ozone_platform_x11=true ozone_platform_wayland=true ozone_platform="wayland" use_system_libffi=true is_official_build=true use_thin_lto=false thin_lto_enable_optimizations=false is_cfi=false symbol_level=0 chrome_pgo_phase=0  out/Release
ERROR at //build/config/compiler/BUILD.gn:1271:16: Assignment had no effect.
  swiftflags = []
               ^
You set the variable "swiftflags" here and it was unused before it went
out of scope.
See //build/config/BUILDCONFIG.gn:333:3: which caused the file to be included.
  "//build/config/compiler:afdo",
  ^-----------------------------
 * ERROR: www-client/chromium-111.0.5545.6::gentoo failed (configure phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_configure
 *   environment, line 5084:  Called chromium_configure '0'
 *   environment, line 2457:  Called die
 * The specific snippet of code:
 *       "$@" || die
 * If you need support, post the output of `emerge --info '=www-client/chromium-111.0.5545.6::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-client/chromium-111.0.5545.6::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-client/chromium-111.0.5545.6/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-client/chromium-111.0.5545.6/temp/environment'.
 * Working directory: '/var/tmp/portage/www-client/chromium-111.0.5545.6/work/chromium-111.0.5545.6'
 * S: '/var/tmp/portage/www-client/chromium-111.0.5545.6/work/chromium-111.0.5545.6'

>>> Failed to emerge www-client/chromium-111.0.5545.6, Log file:

>>>  '/var/tmp/portage/www-client/chromium-111.0.5545.6/temp/build.log'

 * Messages for package www-client/chromium-111.0.5545.6:

 * ERROR: www-client/chromium-111.0.5545.6::gentoo failed (configure phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_configure
 *   environment, line 5084:  Called chromium_configure '0'
 *   environment, line 2457:  Called die
 * The specific snippet of code:
 *       "$@" || die
 * 
 * If you need support, post the output of `emerge --info '=www-client/chromium-111.0.5545.6::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-client/chromium-111.0.5545.6::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-client/chromium-111.0.5545.6/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-client/chromium-111.0.5545.6/temp/environment'.
 * Working directory: '/var/tmp/portage/www-client/chromium-111.0.5545.6/work/chromium-111.0.5545.6'
 * S: '/var/tmp/portage/www-client/chromium-111.0.5545.6/work/chromium-111.0.5545.6'

The error above occurred under Gentoo when trying to build the latest Chromium 111.0.5545.6 with an older GN utility (GN is a meta-build system that generates build files for Ninja). If someone receives a similar error during the configuration stage of Chromium building the first thing to check is the GN utility and get the latest version!
Under Gentoo, emerge-ing the GN version 0.2077 eliminated the error above, and the Chromium was built successfully. Probably, it should be added dependency for the Chromium ebuild package above GN 0.2049.

Chromium browser in Ubuntu 20.04 LTS without snap to use in docker container

Ubuntu team has its own vision for the snap (https://snapcraft.io/) service and that’s why they have moved the really big and difficult to maintain Chromium browser package in the snap package. Unfortunately, the snap has many issues with docker containers and in short, it is way difficult to run snap in a docker container. The user may just want not to mess with snap packages (despite this is the future according to the Ubuntu team) or like most developers they all need a browser for their tests executed in a container.
Whether you are a developer or an ordinary user this article is for you, who wants Chromium browser installed not from the snap service under Ubuntu 20.04 LTS!
There are multiple options, which could end up with a Chromium browser installed on the system, not from the snap service:

  1. Using Debian package and Debian repository. The problem here is that using simultaneously Ubuntu and Debian repository on one machine is not a good idea! Despite the hack, Debian packages are with low priority – https://askubuntu.com/questions/1204571/chromium-without-snap/1206153#1206153
  2. Using Google Chromehttps://www.google.com/chrome/?platform=linux. It is just a single Debian package, which provides Chromium-like browser and all dependencies requesting the Chromium browser package are fulfilled.
  3. Using Chromium team dev or beta PPA (https://launchpad.net/~chromium-team) for the nearest version if still missing Ubuntu packages for Focal (Ubuntu 20.04 LTS).
  4. more options available?

This article will show how to use Ubuntu 18 (Bionic) Chromium browser package from Chromium team beta PPA under Ubuntu 20.04 LTS (Focal). Bionic package from the very same repository of Ubuntu Chromium team may be used, too.

All dependencies will be downloaded from the Ubuntu 20.04 and just several Chromium-* packages will be downloaded from the Chromium team PPA Ubuntu 19 repository. The chances to break something are really small compared to the options 1 above, which uses the Debian packages and repositories. Hope, soon we are going to have focal (Ubuntu 20.04 LTS) packages in the Ubuntu Chromium team PPA!

Dockerfile

An example of a Dockerfile installing Chromium (and python3 selenium for automating web browser interactions)

RUN apt-key adv --fetch-keys "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xea6e302dc78cc4b087cfc3570ebea9b02842f111" \
&& echo 'deb http://ppa.launchpad.net/chromium-team/beta/ubuntu bionic main ' >> /etc/apt/sources.list.d/chromium-team-beta.list \
&& apt update
RUN export DEBIAN_FRONTEND=noninteractive \
&& export DEBCONF_NONINTERACTIVE_SEEN=true \
&& apt-get -y install chromium-browser
RUN apt-get -y install python3-selenium

First command adds the repository key and the repository to the Ubuntu source lists. Note we are adding the “bionic main”, not “focal main”.
From the all dependencies of the Bionic chromium-browser only three packages are pulled from the Bionic repository and all other are from the Ubuntu 20 (Focal):

.....
Get:1 http://ppa.launchpad.net/chromium-team/beta/ubuntu bionic/main amd64 chromium-codecs-ffmpeg-extra amd64 84.0.4147.38-0ubuntu0.18.04.1 [1174 kB]
.....
Get:5 http://ppa.launchpad.net/chromium-team/beta/ubuntu bionic/main amd64 chromium-browser amd64 84.0.4147.38-0ubuntu0.18.04.1 [67.8 MB]
.....
Get:187 http://ppa.launchpad.net/chromium-team/beta/ubuntu bionic/main amd64 chromium-browser-l10n all 84.0.4147.38-0ubuntu0.18.04.1 [3429 kB]
.....

Here is the whole Dockerfile sample file:

#
#   Docker file for the image "chromium brower without snap"
#
FROM ubuntu:20.04
MAINTAINER myuser@example.com

#chromium browser
#original PPA repository, use if our local fails
RUN echo "tzdata tzdata/Areas select Etc" | debconf-set-selections && echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections
RUN export DEBIAN_FRONTEND=noninteractive && export DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install gnupg2 apt-utils wget
#RUN wget -O /root/chromium-team-beta.pub "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xea6e302dc78cc4b087cfc3570ebea9b02842f111" && apt-key add /root/chromium-team-beta.pub
RUN apt-key adv --fetch-keys "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xea6e302dc78cc4b087cfc3570ebea9b02842f111" && echo 'deb http://ppa.launchpad.net/chromium-team/beta/ubuntu bionic main ' >> /etc/apt/sources.list.d/chromium-team-beta.list && apt update
RUN export DEBIAN_FRONTEND=noninteractive && export DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -y install chromium-browser
RUN apt-get -y install python3-selenium

Desktop install

The desktop installation is almost the same as the Dockerfile above. Just execute the following lines:
Keep on reading!

Delay loading all pages in the Chromium and Google Chrome browsers tabs during start up and save a lot of memory

Recently we noticed our Chromium began to behavior really strange (we noticed it from Chromium version 69). When starting the Chromium browser the system tended to lag for 4-8 seconds and it was apparently connected with the browsers’ tabs opened in the previous session.
These days many people open multiple Internet pages in the browsers’ tabs and even more use the feature of

quitting the browser and then starting it back and the browser restores the previous session – all tabs with the pages loaded before.

. And time passes and we get used to open and leave more and more tabs, so not it is normal to have more than 30 opened page tabs in your browser, but last versions of the Chromium something has changed, because when you start the browser it completely loads all the pages, we do not think this was the case before so we dig it into the problem.
We use Chromium under (Gentoo) Linux and here is the problem:

top - 16:20:09 up 16 days, 16:36, 14 users,  load average: 4.77, 0.55, 0.43
Tasks: 288 total,  10 running, 201 sleeping,   0 stopped,   0 zombie
%Cpu(s): 82.6 us, 16.2 sy,  0.0 ni,  1.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  8143960 total,  3012776 free,  3828732 used,  1302452 buff/cache
KiB Swap:  7606268 total,  6855752 free,   750516 used.  2554612 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                 
16082 myuser     20   0 3975632 371280 191940 S 106.9  4.6   0:05.86 /usr/lib64/chromium-browser/chrome --extra-plugin-dir=/usr/lib64/nsbrowser/plugins --ppapi-flash-path=+ 
16380 myuser     20   0 1779900 116276  76624 S  28.4  1.4   0:00.41 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16420 myuser     20   0 1777396 117096  85464 S  18.6  1.4   0:00.30 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16540 myuser     20   0 1850308 109576  76616 R  17.6  1.3   0:00.24 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16565 myuser     20   0 1769716 108588  81336 S  17.6  1.3   0:00.23 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16400 myuser     20   0 1775876 105220  76932 R  12.7  1.3   0:00.21 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16334 myuser     20   0 1770128 111588  83760 S  11.8  1.4   0:00.26 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
 5644 myuser      9 -11 3474604  11112   8368 S   9.8  0.1  14:50.60 /usr/bin/pulseaudio --start --log-target=syslog                                                         
16346 myuser     20   0 1772160 103924  76920 R   9.8  1.3   0:00.17 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16369 myuser     20   0 1772060 101696  74928 R   9.8  1.2   0:00.16 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16409 myuser     20   0 1783340 115752  77116 R   9.8  1.4   0:00.18 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16435 myuser     20   0 1770664 105088  81656 S   9.8  1.3   0:00.19 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16483 myuser     20   0 1772228 112008  83176 S   9.8  1.4   0:00.17 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16509 myuser     20   0 1772116 108544  81732 S   9.8  1.3   0:00.20 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16448 myuser     20   0 1771368 101300  74956 R   8.8  1.2   0:00.14 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16459 myuser     20   0 1692864 102668  80676 R   8.8  1.3   0:00.15 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16506 myuser     20   0 1766364  99588  78384 S   7.8  1.2   0:00.15 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16577 myuser     20   0 1767296 102268  80272 S   7.8  1.3   0:00.14 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
21462 myuser     20   0 2599480 493592  95284 S   7.8  6.1  17:00.39 /usr/lib64/firefox/firefox -contentproc -childID 13 -isForBrowser -prefsLen 51222 -schedulerPrefs 0001+ 
16417 myuser     20   0 1767568  99584  75992 R   5.9  1.2   0:00.12 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16530 myuser     20   0 1764332  99036  78768 S   5.9  1.2   0:00.11 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16341 myuser     20   0 1688088  96856  77776 S   4.9  1.2   0:00.09 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16395 myuser     20   0 1765648  96284  75132 S   4.9  1.2   0:00.10 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16464 myuser     20   0 1773864 104360  76260 S   4.9  1.3   0:00.12 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16467 myuser     20   0 1765740  96184  75520 S   4.9  1.2   0:00.10 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16491 myuser     20   0 1691968  96864  75744 S   3.9  1.2   0:00.14 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16496 myuser     20   0 1691964  97048  75852 S   3.9  1.2   0:00.18 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16501 myuser     20   0 1691492  92592  72604 S   3.9  1.1   0:00.10 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16578 myuser     20   0 1765432  93580  73868 S   3.9  1.1   0:00.10 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16587 myuser     20   0 1765416  93624  73856 S   3.9  1.1   0:00.10 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
28861 myuser     20   0 3503208 405676  91716 S   3.9  5.0  11:41.21 /usr/bin/firefox                                                                                        
16454 myuser     20   0 1617744  87852  70072 R   2.9  1.1   0:00.09 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
16548 myuser     20   0 1692100  97336  76440 S   2.9  1.2   0:00.13 /usr/lib64/chromium-browser/chrome --type=renderer --file-url-path-alias=/gen=/usr/lib64/chromium-brow+ 
 5430 root      20   0  510884 133980 116036 S   2.0  1.6  39:33.10 /usr/bin/X -nolisten tcp -auth /var/run/sddm/{0c17f929-befd-402b-a80b-207e92f61272} -background none -+ 
16011 myuser     20   0  140316   3192   2632 R   2.0  0.0   0:00.44 top -d1                                                                                                 
 5193 root     -51   0       0      0      0 S   1.0  0.0  97:33.55 [irq/46-iwlwifi]                                                                                        
 5601 myuser     20   0 3422104  59664  23276 S   1.0  0.7  41:55.20 /usr/bin/kwin_x11 -session 10147150e9da000152673938100000083010144_1534452204_442575

As you can see starting Chromium it just flooded the system with hungry for CPU processes, so many that even a decent machine with 4 cores will get into troubles with 9 running Chromium process for a while! The load at the first seconds goes to 5-9 (as you can see here is 4.77 from below 1 – actually 0.5 ).
Keep on reading!