How To Fix a “gcc profile is invalid”
Scenario: (all as the “root” user, or via “sudo”)
You run an update with “emerge” and all goes well. Then for good housekeeping, you run a “depclean”.
And then you find that nothing will compile! Typical errors are such as any/all of:
- configure: error: C compiler cannot create executables
- ERROR: gentoo failed (configure phase)
- econf failed
- failed to run configure
- gcc profile is invalid
To check what gcc profile you are using, try:
# gcc-config -l
* gcc-config: Active gcc profile is invalid!
[1] x86_64-pc-linux-gnu-4.7.3
For a correctly selected profile, there will be an “*” alongside one of the numbered options. To select a gcc profile, use for example:
# gcc-config 1
* Switching native-compiler to x86_64-pc-linux-gnu-4.7.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
As instructed, then enter “. /etc/profile” (the “.” is an abbreviation for the command “source”) to update the environment variables for your running shell.
Now, running a:
# gcc-config -l
[1] x86_64-pc-linux-gnu-4.7.3 *
gives an appropriate selection to allow that version of gcc to compile.
Voila! (Or you’ve tripped over some other Gentoo-ism!)
And the source problem was: The depclean cleaned out your old version of gcc and the the newly installed most recent gcc version had not yet been selected… And and… As we all know, gcc is the GNU Compiler Collection used by emerge to compile all the source code into something executable…
Further details can be found on the Gentoo wiki: Upgrading GCC
All by the flexible power of Gentoo!
Leave a Reply
You must be logged in to post a comment.