binutils and the error ld: unrecognized option ‘–no-dynamic-linker’

Yet another bites of an old bintuils installed in the system, which leads to an error and failed a building of glibc this time. The last time it was a kernel building failure, check out here – . Most of the time, these kind of errors occurs when upgrading an old system, so as soon as building the new binutils package with emerge it is mandatory to remove the old one to minimize compiling errors of this sort.

main menu
building failure

This time the error under Gentoo system is (but it could happen in any system with old and new binutils!):

/usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: unrecognized option '--no-dynamic-linker'
/usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status

To fix the error simply remove the (all) old binutils package(s) with emerge command:

[root@srv ~]# emerge -vaC =binutils-2.25-r1
 * This action can remove important packages! In order to be safer, use
 * `emerge -pv --depclean <atom>` to check for reverse dependencies before
 * removing packages.

>>> These are the packages that would be unmerged:

 sys-devel/binutils
    selected: 2.25-r1 
   protected: none 
     omitted: 2.41-r1 

All selected packages: =sys-devel/binutils-2.25-r1

>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.

Would you like to unmerge these packages? [Yes/No] yes
>>> Waiting 5 seconds before starting...
>>> (Control-C to abort)...
>>> Unmerging in: 5 4 3 2 1
>>> Unmerging (1 of 1) sys-devel/binutils-2.25-r1...
No package files given... Grabbing a set.
<<<          obj /usr/x86_64-pc-linux-gnu/binutils-bin/2.25/strip
<<<          obj /usr/x86_64-pc-linux-gnu/binutils-bin/2.25/strings
<<<          obj /usr/x86_64-pc-linux-gnu/binutils-bin/2.25/size
<<<          obj /usr/x86_64-pc-linux-gnu/binutils-bin/2.25/readelf
......
......

Keep on reading!

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.

Upgrading to systemd-utils and resolving systemd-tmpfiles soft blocking systemd-utils

main menu
News migrating to systemd-utils

Recently a new Gentoo package was added – sys-apps/systemd-utils, which should replace three separate packages sys-apps/systemd-tmpfiles, sys-boot/systemd-boot and sys-fs/udev. As the sys-fs/udev is one of the core packages in the OpenRC world and it can trigger multiple blocking errors and dependency problems.
The sys-apps/systemd-utils has three USE variables for the three replacing packages – udev, boot, and tmpfiles, so the user might add them in make.conf file.
It’s worth noting when upgrading to the sys-apps/systemd-utils, the sys-apps/systemd-tmpfiles and sys-boot/systemd-boot will be removed, but sys-fs/udev is staying in the system with version sys-fs/udev-250 and above. The sys-fs/udev-250 would always pull in sys-apps/systemd-utils[udev] as a dependency. Despite the names including systemd, these packages do not depend on systemd and are meant to be used in OpenRC system.
There is Gentoo news about this upgrade and it can be read with eselect. Check out the article ending for more information.
Here is what a blocking could look like:

root@srv ~ # emerge -vau world
......
......
[ebuild     U  ] dev-lang/php-8.0.27:8.0::gentoo [8.0.25:8.0::gentoo] USE="acl bcmath berkdb bzip2 calendar cli ctype curl enchant exif fileinfo filter flatfile fpm ftp gd gdbm gmp iconv imap intl ipv6 jit mhash mysql mysqli nls opcache pcntl pdo phar posix readline session session-mm sharedmem simplexml soap sockets sqlite ssl tidy tokenizer truetype unicode xml xmlreader xmlwriter xslt zip zlib -apache2 -apparmor -argon2 -cdb -cgi -cjk -coverage -debug -embed -ffi -firebird -inifile -iodbc -kerberos -ldap -ldap-sasl -libedit -lmdb -mssql -oci8-instant-client -odbc -phpdbg -postgres -qdbm (-selinux) -snmp -sodium -spell -systemd -sysvipc -test -threads -tokyocabinet -webp -xpm" 10549 KiB
[ebuild     UD ] sys-apps/man-pages-posix-2013a::gentoo [2017a::gentoo] 909 KiB
[ebuild     U  ] sys-apps/openrc-0.46::gentoo [0.45.2-r1::gentoo] USE="ncurses netifrc pam unicode -audit -bash -debug -newnet (-selinux) -sysv-utils" 242 KiB
[blocks B      ] sys-fs/eudev ("sys-fs/eudev" is soft blocking sys-apps/systemd-utils-251.10-r1)
[blocks B      ] sys-apps/systemd-utils[udev] ("sys-apps/systemd-utils[udev]" is soft blocking sys-fs/eudev-3.2.11-r3)

Total: 113 packages (97 upgrades, 1 downgrade, 15 new), Size of downloads: 554077 KiB
Conflict: 3 blocks (2 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (sys-fs/eudev-3.2.11-r3:0/0::gentoo, installed) pulled in by
    sys-fs/eudev required by @selected 

  (sys-apps/systemd-utils-251.10-r1:0/0::gentoo, ebuild scheduled for merge) pulled in by
    sys-apps/systemd-utils[tmpfiles] required by (sys-apps/systemd-tmpfiles-250:0/0::gentoo, ebuild scheduled for merge) USE="" ABI_X86="(64)"
    sys-apps/systemd-utils[tmpfiles] required by (virtual/tmpfiles-0-r3:0/0::gentoo, installed) USE="" ABI_X86="(64)"
    sys-apps/systemd-utils[udev] required by (virtual/udev-217-r5:0/0::gentoo, installed) USE="" ABI_X86="(64)"


For more information about Blocked Packages, please refer to the following
section of the Gentoo Linux x86 Handbook (architecture is irrelevant):

https://wiki.gentoo.org/wiki/Handbook:X86/Working/Portage#Blocked_packages
root@srv ~ # emerge -va sys-apps/systemd-utils


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

Calculating dependencies... done!
Dependency resolution took 0.84 s.

[ebuild  N     ] acct-group/audio-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/cdrom-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/dialout-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/disk-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/kmem-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/lp-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/sgx-0::gentoo  0 KiB
[ebuild  N     ] acct-group/tape-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/tty-0-r1::gentoo  0 KiB
[ebuild  N     ] acct-group/video-0-r1::gentoo  0 KiB
[ebuild  N     ] sys-apps/systemd-utils-251.10-r1::gentoo  USE="acl kmod (split-usr) tmpfiles udev -boot (-selinux) -sysusers -test" ABI_X86="(64) -32 (-x32)" 11194 KiB
[blocks B      ] <sys-apps/systemd-tmpfiles-250 ("<sys-apps/systemd-tmpfiles-250" is soft blocking sys-apps/systemd-utils-251.10-r1)
[blocks B      ] sys-fs/eudev ("sys-fs/eudev" is soft blocking sys-apps/systemd-utils-251.10-r1)
[blocks B      ] sys-apps/systemd-utils[udev] ("sys-apps/systemd-utils[udev]" is soft blocking sys-fs/eudev-3.2.11-r3)

Total: 11 packages (11 new), Size of downloads: 11194 KiB
Conflict: 3 blocks (3 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (sys-apps/systemd-tmpfiles-249.9:0/0::gentoo, installed) pulled in by
    sys-apps/systemd-tmpfiles required by @selected 

  (sys-apps/systemd-utils-251.10-r1:0/0::gentoo, ebuild scheduled for merge) pulled in by
    sys-apps/systemd-utils

  (sys-fs/eudev-3.2.11-r3:0/0::gentoo, installed) pulled in by
    sys-fs/eudev required by @selected 


For more information about Blocked Packages, please refer to the following
section of the Gentoo Linux x86 Handbook (architecture is irrelevant):

https://wiki.gentoo.org/wiki/Handbook:X86/Working/Portage#Blocked_packages

A screenshot from the command line, which is colored properly.

main menu
Unresolved Soft blocking tmpfiles and eudev

To solve the soft blocking, first, deselect the old packages, which are soft blocking the sys-apps/systemd-utils. In the above example, the problematic packages are sys-fs/eudev and sys-apps/systemd-tmpfiles. Deselect the packages and try to build only sys-apps/systemd-utils:
Keep on reading!

List all Gentoo packages built against the old Lua or specific version

After similar articles about Python (List all Gentoo packages built against the old python or specific version) under Gentoo and Ruby List all Gentoo packages built against the old ruby or specific version, the Lua upgrade in Gentoo may have similar problems, so this article shows how to list old Lua modules and packages built against old Lua environments. Despite a clean upgrade without any blockers or masked packages, sometimes, on old machines, there might be packages left still built against an old version of Lua, which is even no longer available on the system!

main menu
equery USE lua_targets_lua5-4

On Gentoo, there are two important flags in the configuration make.conf file:

LUA_SINGLE_TARGET="lua5-4"
LUA_TARGETS="lua5-1 lua5-4"

The LUA_TARGETS controls the support of multiple Lua versions installed on the system. When the Gentoo package has a use flag lua, the builder emerge will build the Lua module for all the Lua versions in LUA_TARGETS. Some programs or libraries may not support multiple versions to be installed on the system and they may require to specify just one Lua library target, against which they are going to be built and that’s why LUA_SINGLE_TARGET exists. In most cases, the LUA_SINGLE_TARGET should be the active (default in the system) Lua version.
Keep on reading!

List all Gentoo packages built against the old ruby or specific version

After a similar article about Python (List all Gentoo packages built against the old python or specific version) under Gentoo, the Ruby upgrade in Gentoo may have similar problems, so this article shows how to list old Ruby modules and packages build against old ruby environments. Despite a clean upgrade without any blockers or masked packages, sometimes, on old machines, there might be packages left still built against an old version of Ruby, which is no longer available on the system!

main menu
equery with USE ruby_targets_ruby26

On Gentoo, there is one important flag in the configuration make.conf file:

RUBY_TARGETS="ruby30 ruby31"

The RUBY_TARGETS controls the support of multiple Ruby versions installed on the system. When the Gentoo package has a use flag ruby, the builder emerge will build the Ruby module for all the Ruby versions in RUBY_TARGETS.
Keep on reading!

List all Gentoo packages built against the old python or specific version

Updating python under Gentoo is not always straightforward work. Despite a clean upgrade without any blockers or masked packages, sometimes, on old machines, there might be packages left still built against an old version of python, which is no longer available on the system!

main menu
Query for USE with python_targets_python3_4, python_targets_python3_5 and python_targets_python3_6.

On Gentoo, there are two important flags in the configuration make.conf file:

PYTHON_TARGETS="python3_8 python3_10"
PYTHON_SINGLE_TARGET="python3_8"

The PYTHON_TARGETS and PYTHON_SINGLE_TARGET control the support of multiple Python versions installed on the system. When the Gentoo package has a use flag python, the builder emerge will build the python module for all the Python versions in PYTHON_TARGETS. Some programs or libraries may not support multiple versions to be installed on the system and they may require to specify just one Python library target, against which they are going to be built and that’s why PYTHON_SINGLE_TARGET exists. In most cases, the PYTHON_SINGLE_TARGET should be the active (default in the system) Python version.
Keep on reading!

Removing of kwayland-server and kwayland-server” is soft blocking kde-plasma/kwin-5.25.2

A big change for Plasma KDE happened two months ago – a “Merge kwayland-server into kwin“.
So after KDE Plasma 5.25, there is no kwayland-server any more (respectively no kwayland-server with version 5.25 and no package in Gentoo) and it may block a Gentoo update with the following error:

mydesktop root # emerge -va --verbose-conflicts --verbose --backtrack=300 $(qlist -IC|grep -i kde)
......
......
[ebuild     U  ] dev-util/kdevelop-php-22.04.2:5::gentoo [21.12.3:5::gentoo] USE="handbook -debug -test" 1,057 KiB
[ebuild     U  ] kde-apps/umbrello-22.04.2:5::gentoo [21.12.3:5::gentoo] USE="handbook php -debug -test" 5,544 KiB
[ebuild     U  ] kde-apps/kross-interpreters-22.04.2:5::gentoo [21.12.3:5::gentoo] USE="-debug" 149 KiB
[blocks B      ] kde-plasma/kwayland-server ("kde-plasma/kwayland-server" is soft blocking kde-plasma/kwin-5.25.2)

Total: 340 packages (329 upgrades, 5 new, 6 reinstalls), Size of downloads: 1,001,699 KiB
Conflict: 1 block (1 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (kde-plasma/kwayland-server-5.24.5-r1:5/5::gentoo, ebuild scheduled for merge) pulled in by
    kde-plasma/kwayland-server
    kde-plasma/kwayland-server:5::gentoo required by @selected 
    kde-plasma/kwayland-server required by @selected 

  (kde-plasma/kwin-5.25.2:5/5::gentoo, ebuild scheduled for merge) pulled in by
    >=kde-plasma/kwin-5.25.2:5 required by (kde-plasma/plasma-desktop-5.25.2:5/5::gentoo, ebuild scheduled for merge) USE="handbook ibus kaccounts scim semantic-desktop -debug -emoji -telemetry -test" ABI_X86="(64)"
    >=kde-plasma/kwin-5.25.2:5[lock] required by (kde-plasma/plasma-meta-5.25.2:5/5::gentoo, ebuild scheduled for merge) USE="accessibility bluetooth browser-integration crash-handler crypt desktop-portal display-manager elogind gtk handbook kwallet legacy-systray networkmanager pulseaudio sddm smart wallpapers -colord -discover (-firewall) -grub -plymouth -sdk -systemd -thunderbolt" ABI_X86="(64)"
    >=kde-plasma/kwin-5.25.2:5 required by (kde-plasma/libkworkspace-5.25.2:5/5::gentoo, ebuild scheduled for merge) USE="-debug -test" ABI_X86="(64)"
    >=kde-plasma/kwin-5.25.2:5 required by (kde-plasma/plasma-workspace-5.25.2:5/5::gentoo, ebuild scheduled for merge) USE="calendar fontconfig geolocation handbook policykit semantic-desktop -appstream -debug -gps -screencast -telemetry -test" ABI_X86="(64)"

emerge could not continue with the upgrade to KDE Platform 5.25.2.

main menu
emerge error

kwayland-server is pulled by selected, but the last version of the package is from 5.24 release, which should immediately signal that there is something wrong with it, because the emerge command shows the latest KDE Plasma version to be 5.25 (with the exact version 5.25.2).

Solution – deselect/remove kde-plasma/kwayland-server

The solution is simple, just deselect it from the world slot to be sure it won’t be pulled again in the future. Remove the package manually if the error still persists, but only deselecting should work. Of course, it should not be selected in the command-line with emerge, neither. In general, such package won’t be available any more.
Always keep eye on the pulled versions and the versions you are trying to install, most of the time the problem is obvious and from a single “wrong/bad” package, which may generate e great deal of erroneous and frightening dependencies output.

mydesktop root # emerge --deselect kwayland-server
>>> Removing kde-plasma/kwayland-server from "world" favorites file...
>>> Removing kde-plasma/kwayland-server:5::gentoo from "world" favorites file...

And now the emerge command is OK and no problem with the dependencies and blocks:

mydesktop root # emerge -va --verbose-conflicts --verbose --backtrack=300 $(qlist -IC|grep -i kde|grep -v kwayland-server)
......
......
[ebuild  N     ] kde-plasma/kwin-5.25.2:5::gentoo  USE="accessibility (caps) handbook lock multimedia -debug -gles2-only -plasma -screencast -test" 6,468 KiB
[uninstall     ] kde-plasma/kwayland-server-5.24.3:5::gentoo  USE="-debug -doc -test" 
[blocks b      ] kde-plasma/kwayland-server ("kde-plasma/kwayland-server" is soft blocking kde-plasma/kwin-5.25.2)
[ebuild     U  ] kde-plasma/libkworkspace-5.25.2:5::gentoo [5.24.3:5::gentoo] USE="-debug -test" 0 KiB
......
......
[ebuild     U  ] kde-apps/akregator-22.04.2:5::gentoo [21.12.3:5::gentoo] USE="handbook -debug -speech -telemetry -test" 2,209 KiB

Total: 339 packages (328 upgrades, 5 new, 6 reinstalls, 1 uninstall), Size of downloads: 1,001,483 KiB
Conflict: 1 block (all satisfied)

More on Gentoo blocking – Gentoo update tips when updating packages with blocks and masked files

Building python 3.10.4 and possibly undefined macro: AC_MSG_ERROR

Emerging the new python 3.10 in Gentoo may lead to the following error, despite all the dependencies installed. This error might also occur in any other Linux distro! During the configure stage the autoconf tool outputs error:

root@srv ~ # cat /var/tmp/portage/dev-lang/python-3.10.5/temp/autoconf.out 
***** autoconf *****
***** PWD: /var/tmp/portage/dev-lang/python-3.10.5/work/Python-3.10.5
***** autoconf --force

configure.ac:59: warning: The macro `AC_CONFIG_HEADER' is obsolete.
configure.ac:59: You should run autoupdate.
./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.ac:59: the top level
configure.ac:911: warning: AC_LINK_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
./lib/autoconf/specific.m4:364: AC_USE_SYSTEM_EXTENSIONS is expanded from...
configure.ac:911: the top level
configure.ac:2214: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:2214: You should run autoupdate.
./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
configure.ac:2214: the top level
configure.ac:4250: warning: The macro `AC_HEADER_TIME' is obsolete.
configure.ac:4250: You should run autoupdate.
./lib/autoconf/headers.m4:743: AC_HEADER_TIME is expanded from...
configure.ac:4250: the top level
configure.ac:18: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation

It appears a dependency is missing! First, build the package sys-devel/autoconf-archive and then the building of python-3.10.5 will finish successfully.

root@srv ~ # emerge -va autoconf-archive

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

Calculating dependencies... done!
[ebuild  N     ] sys-devel/autoconf-archive-2022.02.11::gentoo  660 KiB

Total: 1 package (1 new), Size of downloads: 660 KiB

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

Emerging the dev-lang/python-3.10.5::gentoo outputs the error and the building process stops. The error output in emerge command is so informative. The actual error is in the /var/tmp/portage/dev-lang/python-3.10.5/temp/autoconf.out.
Keep on reading!

Change found sources for kernel version when packages need the kernel sources to compile

Multiple Gentoo packages may need kernel sources to compile. There are packages, which are external modules such as virtualbox-modules or video drivers or wifi drivers or more. All these packages expect the current loaded kernel sources are present and to use them when compiling the external kernel module. But sometimes the proper kernel sources are missing, those needed to compile the kernel module in such a way to load it in the currently loaded kernel.

This article is valid not only for Gentoo Linux distribution but any Linux and kernel sources. So, if the user needs to have properly configured kernel sources for the currently loaded kernel, this is one way to do it right.

Here is an example: Updated kernel, but no sources are kept and then the VirtualBox needs to update to a newer version, but with the missing kernel sources of the currently loaded kernel updating the VirtualBox will cause the VirtualBox to stop working!

root@srv ~ # uname -a
Linux srv 5.15.5-gentoo #2 SMP Tue Nov 30 16:08:49 EET 2021 x86_64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz GenuineIntel GNU/Linux
root@srv ~ # emerge -va app-emulation/virtualbox-modules

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

[ebuild     U  ] app-emulation/virtualbox-modules-6.1.32:0/6.1::gentoo [6.1.26:0/6.1::gentoo] USE="dist-kernel -pax-kernel" 660 KiB

Total: 1 packages (1 upgrades), Size of downloads: 0 KiB

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

>>> Verifying ebuild manifests

>>> Running pre-merge checks for app-emulation/virtualbox-6.1.32-r1

>>> Emerging (1 of 1) app-emulation/virtualbox-modules-6.1.32::gentoo
 * Fetching files in the background.
 * To view fetch progress, run in another terminal:
 * tail -f /var/log/emerge-fetch.log
 * vbox-kernel-module-src-6.1.32.tar.xz BLAKE2B SHA512 size ;-) ...                                                                                                                   [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     5.14.2-gentoo-x86_64-genkernel-NEW2
 * Checking for suitable kernel configuration options...                                                                                                                              [ ok ]
>>> Unpacking source...
>>> Unpacking vbox-kernel-module-src-6.1.32.tar.xz to /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work
>>> Source unpacked in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work
>>> Preparing source in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work ...

Here is the problem: the currently loaded kernel is version 5.15.5-gentoo and the emerge system finds only sources for 5.14.2-gentoo-x86_64-genkernel-NEW2, which will use to produce modules for the 5.14.2-gentoo-x86_64-genkernel-NEW2. It is obvious enough the modules compiled against kernel sources of 5.14.2-gentoo-x86_64-genkernel-NEW2 version won’t be possible to be loaded under the currently load kernel with version 5.15.5-gentoo.
Here is how to fix this:

  1. Get the kernel sources for 5.15.5-gentoo in /usr/src/linux
  2. Save the currently loaded kernel config in /usr/src/linux/.config
  3. Load the configuration and prepare the kernel sources. No need to compile the kernel sources.

STEP 1) Get the kernel sources for 5.15.5-gentoo

emerge -v =gentoo-sources-5.15.5
rm -f /usr/src/linux
ln -s /usr/src/linux-5.15.5-gentoo /usr/src/linux

These commands will install the needed kernel version and a link to the kernel sources will be created.
Of course, change the kernel version to the proper version if needed.

STEP 2) Save the currently loaded kernel config in /usr/src/linux/.config

zcat /proc/config.gz > /usr/src/linux/.config

If the /proc/config.gz is missing, copy the configuration from the /boot for the currently loaded kernel:

cat /boot/config-5.15.5-gentoo > /usr/src/linux-5.15.5-gentoo/.config

STEP 3) Load the configuration and prepare the kernel sources.

No need to compile the whole kernel source tree. Just to commands to configure and prepare the kernel sources:

cd /usr/src/linux-5.15.5-gentoo
make oldconfig
make prepare

The commands take Here is the output of the last commands:

root@srv1 ~ # cd /usr/src/linux-5.15.5-gentoo
root@srv1 linux # make oldconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
root@srv1 linux # make prepare
  SYNC    include/config/auto.conf.cmd
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/bin2c
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/sorttable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/extract-cert
  UPD     include/config/kernel.release
  UPD     include/generated/utsrelease.h
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  UPD     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
  UPD     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND objtool
  HOSTCC  /usr/src/linux-5.15.5-gentoo/tools/objtool/fixdep.o
  HOSTLD  /usr/src/linux-5.15.5-gentoo/tools/objtool/fixdep-in.o
  LINK    /usr/src/linux-5.15.5-gentoo/tools/objtool/fixdep
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/exec-cmd.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/help.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/pager.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/parse-options.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/run-command.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/sigchain.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/subcmd-config.o
  LD      /usr/src/linux-5.15.5-gentoo/tools/objtool/libsubcmd-in.o
  AR      /usr/src/linux-5.15.5-gentoo/tools/objtool/libsubcmd.a
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/arch/x86/special.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/arch/x86/decode.o
  LD      /usr/src/linux-5.15.5-gentoo/tools/objtool/arch/x86/objtool-in.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/weak.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/check.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/special.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/orc_gen.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/orc_dump.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/builtin-check.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/builtin-orc.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/elf.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/objtool.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/libstring.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/libctype.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/str_error_r.o
  CC      /usr/src/linux-5.15.5-gentoo/tools/objtool/librbtree.o
  LD      /usr/src/linux-5.15.5-gentoo/tools/objtool/objtool-in.o
  LINK    /usr/src/linux-5.15.5-gentoo/tools/objtool/objtool

And from now on whenever the kernel sources are needed to compile modules or libraries against, the proper kernel sources will be used of the currently loaded kernel.
The Gentoo emerge command from the begging of this article, but this time with the properly configured kernel sources. The VirtualBox modules are compiled against the loaded kernel, so loading them is not an issue anymore!

root@srv ~ # uname -a
Linux srv 5.15.5-gentoo #2 SMP Tue Nov 30 16:08:49 EET 2021 x86_64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz GenuineIntel GNU/Linux
root@srv ~ # emerge -va app-emulation/virtualbox-modules

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

[ebuild     U  ] app-emulation/virtualbox-modules-6.1.32:0/6.1::gentoo [6.1.26:0/6.1::gentoo] USE="dist-kernel -pax-kernel" 660 KiB

Total: 1 packages (1 upgrades), Size of downloads: 0 KiB

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

>>> Verifying ebuild manifests

>>> Running pre-merge checks for app-emulation/virtualbox-6.1.32-r1

>>> Emerging (1 of 1) app-emulation/virtualbox-modules-6.1.32::gentoo
 * Fetching files in the background.
 * To view fetch progress, run in another terminal:
 * tail -f /var/log/emerge-fetch.log
 * vbox-kernel-module-src-6.1.32.tar.xz BLAKE2B SHA512 size ;-) ...                                                                                                                   [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     5.15.5-gentoo-gentoo
 * Checking for suitable kernel configuration options...                                                                                                                              [ ok ]
>>> Unpacking source...
>>> Unpacking vbox-kernel-module-src-6.1.32.tar.xz to /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work
>>> Source unpacked in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work
>>> Preparing source in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-emulation/virtualbox-modules-6.1.32/work ...
....
....
root@srv ~ # modprobe vboxdrv
Feb 15 14:15:10 www kernel: vboxdrv: loading out-of-tree module taints kernel.
Feb 15 14:15:10 www kernel: vboxdrv: Found 4 processor cores
Feb 15 14:15:10 www kernel: vboxdrv: TSC mode is Invariant, tentative frequency 2394461773 Hz
Feb 15 14:15:10 www kernel: vboxdrv: Successfully loaded version 6.1.32 r149290 (interface 0x00320000)
Feb 15 14:15:10 www kernel: VBoxNetFlt: Successfully started.

Gentoo – bash: su: command not found – missing su flag

Upgrading multiple packages may lead to interesting results especially if the queue has not finished yet or the fails with an error! Apparently, there are two main ways to have the basic command SU in the system installed:

  1. sys-apps/shadow
  2. sys-apps/util-linux

At some point, the default inclusion of su flags in the above packages had changed from sys-apps/shadow to sys-apps/util-linux, which may lead to the following interesting error:

user@srv ~ $ su
bash: /bin/su: command not found

Just check, which of the above packages includes the su flag and re-emerge it. At present, sys-apps/util-linux includes it by default and it should work without any explicit activation in portage package use (i.e. /etc/portage/package.use/mybase or /etc/portage/make.conf, for example) file.

At the moment, here is the default:

user@srv ~ # emerge -vp shadow util-linux

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

Calculating dependencies... done!
[ebuild   R    ] sys-apps/shadow-4.11.1:0/4::gentoo  USE="acl (audit) nls pam (selinux) (split-usr) xattr -bcrypt -cracklib -skey -su" 0 KiB
[ebuild   R    ] sys-apps/util-linux-2.37.2-r3::gentoo  USE="(audit) (caps) cramfs hardlink logger ncurses nls pam python readline (selinux) (split-usr) su suid udev (unicode) -build -cryptsetup -fdformat -kill -magic (-rtas) -slang -static-libs -systemd -test -tty-helpers" ABI_X86="32 (64) (-x32)" PYTHON_TARGETS="python3_8 -python3_9 -python3_10" 0 KiB

Total: 2 packages (2 reinstalls), Size of downloads: 0 KiB

su flag is missing in sys-apps/shadow and is included in sys-apps/util-linux