Installation of gcc
Apply the two patches, one to fix compilation and the other to stop the
fixincludes script from executing.
patch -Np1 -i ../gcc-&gcc2-version;-1.patch &&
patch -Np1 -i ../gcc-&gcc2-version;-no-fixinc.patch
The gcc development team recommends building in a seperate directory.
mkdir ../gcc-build &&
cd ../gcc-build
Configure gcc to build the c and c++ compilers and enable the related c++
options.
../gcc-&gcc2-version;/configure \
--prefix=/opt/gcc2 \
--enable-shared --enable-languages=c,c++ \
--enable-threads=posix
Compile and install gcc and remove unneeded directories (adjust the
machine triplet to match your architecture).
make bootstrap &&
make install &&
ln -sf gcc /opt/gcc2/bin/cc &&
rm -rf /opt/gcc2/{i686-pc-linux-gnu,info,man}
Make note of the library that is installed.
L=`find /opt/gcc2/lib -name "*libstdc++*.so" -type f` &&
IL=`basename $L`
Move the c++ libraries to the standard lib directory to avoid having to
add /opt/gcc2/lib to /etc/ld.so.conf.
for i in /opt/gcc2/lib/*.so*; do mv -f $i /usr/lib;
ln -sf /usr/lib/`basename $i` /opt/gcc2/lib; done
Create symlinks required by commercial and precompiled packages.
ln -sf $IL /usr/lib/libstdc++-libc6.1-1.so.2 &&
ln -sf $IL /usr/lib/libstdc++-libc6.2-2.so.3 &&
ln -sf $IL /usr/lib/libstdc++-libc6.3-2.so.3