C compiler cannot create executables received after emerge world

Issue

When attempting to emerge a new package after a recent

emerge -DunNv world[/cci_bash] the new package emerge

fails with:

. . .
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for builtin ELF support... yes
checking for ELF core file support... yes
checking for file formats in man section 5... no
checking for i686-pc-linux-gnu-gcc... i686-pc-linux-gnu-gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
. . .

Cause

The issue is related to gcc being upgraded as part of a previously executed emerge world. The /etc/ld.so.conf and /etc/env.d/05gcc-i686-pc-linux-gnu files no longer point to valid gcc library and binary paths.

Resolution

Gentoo provides the gcc-config command to set the active gcc compiler profile.

Sample gcc-config run to list the available gcc profiles and set the active profile to option 1

root # gcc-config -l
    [1] i686-pc-linux-gnu-4.3.2 *
root # gcc-config 1
    * Switching native-compiler to i686-pc-linux-gnu-4.3.2 ...               [ ok ]

Reference

http://forums.gentoo.org/viewtopic.php?t=27486&highlight=gcc