Compiling GCC

Paulo J. Matos pocm@soton.ac.uk
Wed Jan 31 10:52:00 GMT 2007


On 1/31/07, Andrew Haley <aph@redhat.com> wrote:
> Paulo J. Matos writes:
>  > Hello all,
>  >
>  > I'm trying to compile gcc in my home dir, just to make some tests but
>  > I've having some errors during compilation. Compilation is being
>  > performed in an intel duo core. This is what I do:
>  > ~/ tar -xvjf gcc-4.1.1.tar.bz2
>  > ~/ mkdir gcc-build
>  > ~/ cd gcc-build
>  > ~/ ../gcc-4.1.1/configure --prefix=/home/pmatos/gcc-bin
>  > --program-prefix=dr- --with-gnu-as --with-as=/usr/bin/as --with-gnu-ld
>  > --with-ld=/usr/bin/ld --host=x86_64-pc-linux-gnu
>  > --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls
>  > --without-included-gettext --with-system-zlib --disable-checking
>  > --disable-werror --enable-secureplt --disable-libunwind-exceptions
>  > --enable-multilib --disable-libmudflap --disable-libssp
>  > --disable-libgcj --enable-shared --enable-threads=posix
>  > --enable-__cxa_atexit --enable-clocale=gnu
>  > (Note: some of these flags were copied from the Gentoo build, since I
>  > really didn't know what to use, the dr- prefix is just something so
>  > that the final binary doesn't shadow my production gcc)
>
> The build system thinks you're building a cross-compiler.  This is bad.
>

Why do you say that? Why do you say that the system thinks I'm
building a crosscompiler?
Probably this is due to the fact that in Gentoo intel core duo follow
the amd64 branch, since they are 64 bit processors...

> You need to get rid of some of the configure arguments.
>
>  ~/ ../gcc-4.1.1/configure --prefix=/home/pmatos/gcc-bin
>  --disable-altivec --enable-nls
>  --without-included-gettext --with-system-zlib
>  --disable-werror --enable-secureplt --disable-libunwind-exceptions
>  --enable-multilib --disable-libmudflap --disable-libssp
>  --disable-libgcj --enable-shared --enable-threads=posix
>  --enable-__cxa_atexit --enable-clocale=gnu
>
> ought to do it.
>

Exactly the same error:
checking for x86_64-unknown-linux-gnu-gcc...
/home/pmatos/gcc411-build/./gcc/xgcc
-B/home/pmatos/gcc411-build/./gcc/
-B/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/bin/
-B/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/lib/ -isystem
/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/include -isystem
/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/sys-include  -m32
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run
C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/home/pmatos/gcc411-build'
make: *** [all] Error 2

In config.log:
configure:2406: /home/pmatos/gcc411-build/./gcc/xgcc
-B/home/pmatos/gcc411-build/./gcc/ -B
/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/bin/
-B/home/pmatos/gcc-bin/x86_64-unknown-l
inux-gnu/lib/ -isystem
/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/include -isystem /hom
e/pmatos/gcc-bin/x86_64-unknown-linux-gnu/sys-include  -m32 -o
conftest -O2 -g -O2    conf
test.c  >&5
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.so when
searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.a when searching for -lc
/usr/bin/ld: warning: i386:x86-64 architecture of input file
`/usr/lib/../lib/crt1.o' is i
ncompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file
`/usr/lib/../lib/crti.o' is i
ncompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file
`/usr/lib/../lib/crtn.o' is i
ncompatible with i386 output
configure:2409: $? = 0
configure:2443: checking for C compiler default output file name
configure:2446: /home/pmatos/gcc411-build/./gcc/xgcc
-B/home/pmatos/gcc411-build/./gcc/ -B
/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/bin/
-B/home/pmatos/gcc-bin/x86_64-unknown-l
inux-gnu/lib/ -isystem
/home/pmatos/gcc-bin/x86_64-unknown-linux-gnu/include -isystem /hom
e/pmatos/gcc-bin/x86_64-unknown-linux-gnu/sys-include  -m32 -O2 -g -O2
   conftest.c  >&5
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.so when
searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.a when searching for -lc
/usr/bin/ld: warning: i386:x86-64 architecture of input file
`/usr/lib/../lib/crt1.o' is i
ncompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file
`/usr/lib/../lib/crti.o' is i
ncompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file
`/usr/lib/../lib/crtn.o' is i
ncompatible with i386 output
configure:2449: $? = 0
configure:2495: result: a.out
configure:2500: checking whether the C compiler works
configure:2506: ./a.out
../../../../gcc-4.1.1/libstdc++-v3/configure: line 2507:  6624
Segmentation fault      ./$
ac_file
configure:2509: $? = 139
configure:2518: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

> Andrew.
>


Working gcc-4.1.1 compiler built by gentoo and working is:
$ gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/gcc-4.1.1-r1/work/gcc-4.1.1/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu
--disable-altivec --enable-nls --without-included-gettext
--with-system-zlib --disable-checking --disable-werror
--enable-secureplt --disable-libunwind-exceptions --enable-multilib
--disable-libmudflap --disable-libssp --disable-libgcj
--enable-languages=c,c++,fortran --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.1 (Gentoo 4.1.1-r1)


-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK



More information about the Gcc-help mailing list