Browny's Grotto :: http://www.clan-elite.info/

Gentoo: gcc update problems + solution

1 pages: [ 1 ] [ View newest post ] Post reply.
A recent emerge --update --deep world performed an upgrade of gcc. This was fine in itself; the problems came after running emerge --depclean, which removed my old gcc version and invalidated my current gcc profile.

But I did not actually realise gcc was broken until I tried emerging something else, and even then I did not immediately look to my gcc configuration!

Solution
These are the steps you should take when faced with upgrading gcc:

1. Before installing a new version, check that your current gcc is configured correctly:
Bash Script:
linux # gcc-config -l
linux # gcc-config 1

2. Install new version:
Bash Script:
# Manually:
linux # unset GCC_SPECS
linux # emerge gcc

# Or through a world update:
linux # emerge --update --deep world
linux # emerge --depclean
linux # revdep-rebuild

3. Update your environment:
Bash Script:
linux # source /etc/profile

4. Running gcc should now report no profile related errors:
Bash Script:
linux # gcc
gcc: no input files

Symptoms
The following errors are symptomatic of a broken gcc:

1. Problems emerging new software:
Bash Script:
linux # emerge geoip
...
configure: error: C compiler cannot create executables
See `config.log' for more details.

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/dev-libs/geoip-1.4.5/work/GeoIP-1.4.5/config.log
 * 
 * ERROR: dev-libs/geoip-1.4.5 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called src_compile
 *             environment, line 2627:  Called econf '--enable-shared'
 *               ebuild.sh, line  543:  Called die
 * The specific snippet of code:
 *   			die "econf failed"
 *  The die message:
 *   econf failed
 * 
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/dev-libs/geoip-1.4.5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-libs/geoip-1.4.5/temp/environment'.
 * 

2. emerge --info reports that gcc cannot be found:
Bash Script:
linux # emerge --info
!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly
!!! other terminals also.

3. gcc-config -l reports that your gcc profile is invalid:
Bash Script:
linux # gcc-config -l
 * gcc-config: Active gcc profile is invalid!
 [1] x86_64-pc-linux-gnu-4.3.2

4. Trying to switch gcc profiles with gcc-config 1 gives the following warning:
Bash Script:
 * Switching native-compiler to x86_64-pc-linux-gnu-4.3.2 ...

 * Your gcc has a bug with GCC_SPECS.
 * Please re-emerge gcc.
 * http://bugs.gentoo.org/68395

>>> 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:

 *   # source /etc/profile

5. Typing gcc on its own reports:
Bash Script:
linux # gcc
gcc-config error: Could not run/locate "gcc"
1 pages: [ 1 ] [ View newest post ] Post reply.