Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 381407 - Unable to compile *anything* with gcc
Summary: Unable to compile *anything* with gcc
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: Normal major (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 08:36 UTC by richardfoley
Modified: 2011-09-01 12:22 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description richardfoley 2011-09-01 08:36:00 UTC
I'm running Gentoo on a VM and am unable to compile anything with gcc.  The error I'm seeing, when trying to compile a small package, (nano for instance), is:

checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/var/tmp/portage/app-editors/nano-2.3.1-r1/work/nano-2.3.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.

The relevant piece of the config log exposes the same error as when I try to compile a simple "hello world" program:

 92 configure:3237: checking whether the C compiler works
 93 configure:3259: x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe  -Wl,-O1 -Wl,--as-needed conftest.c  >&5
 94 <built-in>:0:0: internal compiler error: in ten_to_ptwo, at real.c:2246

Yes, I have seen the FAQ entry here: http://forums.gentoo.org/viewtopic.php?t=30565 -> http://forums.gentoo.org/viewtopic.php?t=294109

I've been through a number of the bug fix suggestions, including those in the FAQ above, to no avail.  Any help appreciated.

Reproducible: Always

Steps to Reproduce:
1. Create a small program (hello world).
2. Try to compile it.
3. Fail (internal compiler error).
Actual Results:  
$> cat test.c 
#include <stdio.h>

void main() {
    printf( "Hello world\n" );
}


$> gcc -v test.c -o test
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.5.3/work/gcc-4.5.3/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --disable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/python --enable-checking=release --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.3 p1.0, pie-0.4.5'
Thread model: posix
gcc version 4.5.3 (Gentoo 4.5.3 p1.0, pie-0.4.5) 
COLLECT_GCC_OPTIONS='-v' '-o' 'test' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/cc1 -quiet -v test.c -D_FORTIFY_SOURCE=2 -quiet -dumpbase test.c -mtune=generic -march=x86-64 -auxbase test -version -o /tmp/ccbCnIwy.s
GNU C (Gentoo 4.5.3-r1 p1.0, pie-0.4.5) version 4.5.3 (x86_64-pc-linux-gnu)
        compiled by GNU C version 4.5.3, GMP version 5.0.2, MPFR version 3.0.1, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include-fixed
 /usr/include
End of search list.
GNU C (Gentoo 4.5.3-r1 p1.0, pie-0.4.5) version 4.5.3 (x86_64-pc-linux-gnu)
        compiled by GNU C version 4.5.3, GMP version 5.0.2, MPFR version 3.0.1, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1fe28ca00b020e9bc4414c9f81a9ef31
<built-in>:0:0: internal compiler error: in ten_to_ptwo, at real.c:2246


Expected Results:  
runnable test program.


$> cat /etc/gentoo-release 
Gentoo Base System release 2.0.3

The host system has $> uname -a
Linux thpad 2.6.37.6-0.7-desktop #1 SMP PREEMPT 2011-07-21 02:17:24 +0200 x86_64 x86_64 x86_64 GNU/Linux

and the guest VM has: $> uname -a
Linux myvm 2.6.38-gentoo #1 SMP Tue Mar 29 01:38:59 CEST 2011 x86_64 Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz GenuineIntel GNU/Linux

My CFLAGS="-march=native -O2 -pipe"

I only have a single gcc available to me:
$> gcc-config -l 
 [1] x86_64-pc-linux-gnu-4.5.3 *
>

The /lib directory is a symlink from /lib64
Comment 1 richardfoley 2011-09-01 08:45:20 UTC
$> emerge --info
Portage 2.1.10.11 (default/linux/amd64/10.0/no-multilib, gcc-4.5.3, glibc-2.13-r3, 2.6.38-gentoo x86_64)
=================================================================
System uname: Linux-2.6.38-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_P8600_@_2.40GHz-with-gentoo-2.0.3
Timestamp of tree: Thu, 01 Sep 2011 07:45:01 +0000
app-shells/bash:          4.2_p10
dev-lang/python:          2.7.2, 3.1.3-r1, 3.2
dev-util/cmake:           2.8.4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21.1
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.38 (virtual/os-headers)
sys-libs/glibc:           2.13-r3
Repositories: gentoo perl-experimental x-portage
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/perl-experimental /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="amd64 emacs nls perl sse sse2 ssl unicode zlib" ELIBC="glibc" KERNEL="linux" LINGUAS="en" USERLAND="GNU"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 richardfoley 2011-09-01 08:50:21 UTC
I've also done the following:

$> emerge --sync

$> emerge gcc

...
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking for C compiler default output file name... 
configure: error: in `/var/tmp/portage/sys-devel/gcc-4.5.3-r1/work/build':
configure: error: C compiler cannot create executables
...

# sigh...
Comment 3 richardfoley 2011-09-01 09:00:22 UTC
Any positive assistance you can offer is appreciated here.

Thanks.

Rich.
Comment 4 richardfoley 2011-09-01 09:04:48 UTC
$> fix_libtool_files.sh 4.5.3
 * Scanning libtool files for hardcoded gcc library paths...
 *   [1/9] Scanning /lib ...
 *   [2/9] Scanning /usr/lib ...
 *   [3/9] Scanning /usr/x86_64-pc-linux-gnu/lib ...
 *   [4/9] Scanning /lib64 ...
 *   [5/9] Scanning /opt/intel/Compiler/11.1/072/idb/lib/intel64 ...
 *   [6/9] Scanning /opt/intel/Compiler/11.1/072/lib/intel64 ...
 *   [7/9] Scanning /usr/lib64 ...
 *   [8/9] Scanning /usr/local/lib ...
 *   [9/9] Scanning /usr/local/lib64 ...


$> gcc-config -c
x86_64-pc-linux-gnu-4.5.3
Comment 5 richardfoley 2011-09-01 09:51:15 UTC
This happens, whether I'm trying to compile a package manually, or whether I'm using emerge to compile (re-install) gcc itself.  Simple case:

$> cat test.c 
#include <stdio.h>

void main() {
    printf( "Hello world\n" );
}

$> gcc test.c -o test
<built-in>:0:0: internal compiler error: in ten_to_ptwo, at real.c:2246
Comment 6 Agostino Sarubbo gentoo-dev 2011-09-01 10:50:25 UTC
Try first to install from binary, gcc-4.4.5. Swich at it for recompile gcc-4.5.3. And re-switch to gcc-4.5.3
Comment 7 richardfoley 2011-09-01 12:22:20 UTC
(In reply to comment #6)
> Try first to install from binary, gcc-4.4.5. Swich at it for recompile
> gcc-4.5.3. And re-switch to gcc-4.5.3

Hi Agostino,

Thanks very much for your advice, that did the trick.  First I had to locate the binaries for gcc-4.4.5 and for glibc-2.11.3, and then follow the clear instructions from this (related) post:

  http://forums.funtoo.org/viewtopic.php?pid=2125#p2125

It took over an hour, but gcc is working now, many thanks!

Rich.