Current gcc removed by depclean

I found that one Gentoo depclean removed the version of gcc that my system was configured to use, which is required for compiling packages. I got the following output from emerge -a --depclean, after carelessly giving it the go-ahead:

me@pc ~ $ sudo emerge --depclean
>>> Unmerging (198 of 203) sys-devel/gcc-4.8.4...
 * gcc-config: Could not locate 'x86_64-pc-linux-gnu-4.8.4' in '/etc/env.d/gcc/' !
 * Running ' 4.8.4'
Scanning libtool files for hardcoded gcc library paths...
 * gcc-config: Active gcc profile is invalid!
gcc-config: error: could not run/locate 'gcc'
:0: assertion failed: (gcc -dumpversion) | getline NEWVER)

When I later tried to emerge packages, I got the following error:

!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly
!!! other terminals also.

To fix, check whether you have a gcc version selected:

me@pc ~ $ sudo gcc-config -l
 * gcc-config: Active gcc profile is invalid!

 [1] x86_64-pc-linux-gnu-4.7.4
 [2] x86_64-pc-linux-gnu-4.9.3

If not (no star next to a version), then select one:

me@pc ~ $ sudo gcc-config 2
 * Switching native-compiler to x86_64-pc-linux-gnu-4.9.3 ...
>>> Regenerating /etc/                                                                                                                                                                                                     [ ok ]

 * If you intend to use the gcc from the new profile in an already
 * running shell, please remember to do:

 *   . /etc/profile


me@pc ~ $ sudo gcc-config -l
 [1] x86_64-pc-linux-gnu-4.7.4
 [2] x86_64-pc-linux-gnu-4.9.3 *

Reference: no gcc after –depclean

Last modified: 27/03/2016 Tags: ,

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top