Gentoo clang-15: error: does not contain a GCC installation

Author:

main menu
emerge firefox

Trying to build a package resulted in a building failure because a Clang could not find GNU GCC installation as the error shows.

Executing just x86_64-pc-linux-gnu-clang-15 the same error.

[root@srv ~]# x86_64-pc-linux-gnu-clang-15 
clang-15: error: '/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0' does not contain a GCC installation
clang-15: error: no input files

Apparently, because the latest upgrade of GNU GCC went from 12.2.0 to 12.2.1_p20221008 and the directory changed to /usr/lib/gcc/x86_64-pc-linux-gnu/12.
The Clang binaries read several configuration files and one of them was not updated when the GCC had been upgraded. The configuration file /etc/clang/gentoo-gcc-install.cfg has the wrong path, because the gcc-config version was an old one or the configuration file is generated only on GCC major version, not in the minor. But the last upgrade didn’t modified the Clang configuration file /etc/clang/gentoo-gcc-install.cfg

To resolve this issue, the user may edit the file manually or just use gcc-config to revert to the older and then to the new GCC version at once. List the currently installed GCC versions in the system and choose one.

[root@srv ~]# gcc-config -l
 [1] x86_64-pc-linux-gnu-8.2.0
 [2] x86_64-pc-linux-gnu-8.3.0
 [3] x86_64-pc-linux-gnu-9.2.0
 [4] x86_64-pc-linux-gnu-10.3.0
 [5] x86_64-pc-linux-gnu-11.3.0
 [6] x86_64-pc-linux-gnu-12 *
[root@srv ~]# gcc-config x86_64-pc-linux-gnu-11.3.0
 * Switching native-compiler to x86_64-pc-linux-gnu-11.3.0 ...
>>> Regenerating /etc/ld.so.cache...                                                                  [ ok ]
 * If you intend to use the gcc from the new profile in an already
 * running shell, please remember to do:

 *   . /etc/profile

[root@srv ~]#  gcc-config x86_64-pc-linux-gnu-12
 * Switching native-compiler to x86_64-pc-linux-gnu-12 ...
>>> Regenerating /etc/ld.so.cache...                                                                  [ ok ]
 * If you intend to use the gcc from the new profile in an already
 * running shell, please remember to do:

 *   . /etc/profile
[root@srv ~]# . /etc/profile

Check the sys-devel/gcc-config for available upgrades and do them if there are!
More Gentoo tips here.

Leave a Reply

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