gcc3 hint

rwhron at earthlink.net rwhron at earthlink.net
Sun Oct 28 11:34:52 PST 2001


TITLE:          gcc-3.0.2 with gcc-2.95.3
LFS VERSION:    any
AUTHOR:         Randy Hron <rwhron at earthlink.net>

SYNOPSIS:
		How to have gcc-3.0.2 live peacefully on your LFS box with gcc-2.95.3

HINT:

The goal is to be able to choose either version of the compiler.  Hopefully just
export CC=/usr/local/bin/gcc will be sufficient if the configure/Makefile for the 
package you build is smart.

I originally was going to use --program-suffix=3, but "make -n install" was suggesting
that my 2.95.3 /usr/bin/{c++,g++} would be over-written.  So I took the easy way out 
and just plopped gcc-3.0.2 into /usr/local.  (hey, that's so simple you don't need a hint).

	
environment
-----------
The export commands below aren't required for building gcc3.  My usual CFLAGS gave an
internal error/segmentation fault.  The flags below don't include debug symbols.
Details are in gcc-3.0.2/INSTALL/install.html.

configure
---------

export CFLAGS="-O2" &&
export CPPFLAGS="$CFLAGS" &&
export CXXFLAGS="$CFLAGS" &&
export LIBCFLAGS="$CFLAGS" &&
export LIBCXXFLAGS="$CFLAGS -fno-implicit-templates" &&
mkdir ../gcc-build-3.0.2 &&
cd ../gcc-build-3.0.2 &&
./gcc-3.0.2/configure --prefix=/usr/local --enable-shared --enable-languages=c,c++ \
--enable-threads=posix --disable-nls &&
make bootstrap-lean &&
make check &&
make install

--disable-nls disables national language support.  Certainly not required.

make check isn't required, but I like to test packages before installation.
make check for gcc takes a long time even on a fast computer.  It requires
expect and dejagnu (and they both need tcl).

compiling with gcc3
-------------------

A well behaved package like ed understands the CC environment variable.

hrandoz at rushmore:/usr/src/sources/e/ed-0.2$ export CC=/usr/local/bin/gcc
hrandoz at rushmore:/usr/src/sources/e/ed-0.2$ ./configure --prefix=/usr --disable-nls && make

Another way to use gcc is to put /usr/local/bin first in the PATH:

export PATH=/usr/local/bin:$PATH


have fun!
Sun Oct 28 13:47:52 EST 2001
-- 
Randy Hron




More information about the hints mailing list