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.

Leave a Reply

Your email address will not be published. Required fields are marked *