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
...etc...
>>> 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 'fix_libtool_files.sh 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)
...etc...
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/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
Verify:
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