About | Home | Search


HOWTO: gcc
Description: GNU compiler collection
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# GCC
# ===
# Below are the latest releases in the 4.1.x, 4.0.x, and 3.4.x branches.
# 4.1.x is the current release series.
#
# Due to possible unknown bugs, I would stay away from the current release
# (4.1.x) if stability and build-ability is the top priority on the box
# you're installing it on.  (a client's remote (from you) server, etc.)  If
# you do install it, don't be surprised if you have to Google looking for
# patches when you try to build various things that have been out for a
# while.

# Note: do not downgrade gcc unless you either know what to expect or if
# you're insane.  ie. libstdc++.so.5 will probably be linked to the wrong
# library file (from the higher version of gcc), etc.

# Once gcc is upgraded, a replacement /usr/lib/libgcc_s.so.1 will be
# installed in place of the one listed in /var/adm/packages/*elflibs*
# (elflibs-* < Slackware 10.0, aaa_elflibs-* >= Slackware 10.0).  If you
# want to keep the package files cleaned up, open up that file with a text
# editor and remove that line.

# I use --disable-nls below because I'm in the US and only read/write
# (well) English.  If this is not the case for you, leave that off.


# GCC 4.1.1 (released May 24, 2006)
# =========
# 'make check' requires autogen

cd
test -f installed/gcc-4.1.1.tar.bz2 && mv installed/gcc-4.1.1.tar.bz2 .
test ! -f gcc-4.1.1.tar.bz2 &&
 wget http://ftp.gnu.org/gnu/gcc/gcc-4.1.1/gcc-4.1.1.tar.bz2

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "ad9f97a4d04982ccf4fd67cb464879f3  gcc-4.1.1.tar.bz2" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "a398b95d38b6e35f4c4e02c34c0a3bff79811f8f  gcc-4.1.1.tar.bz2" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys B75C61B8 > /dev/null 2>&1 || gpg --recv-keys B75C61B8 ) &&
 wget -nc http://ftp.gnu.org/gnu/gcc/gcc-4.1.1/gcc-4.1.1.tar.bz2.sig &&
  gpg --verify gcc-4.1.1.tar.bz2.sig && rm gcc-4.1.1.tar.bz2.sig

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gcc-*" -exec rm -r {} \;
tar xjvf ~/gcc-4.1.1.tar.bz2
cd gcc-4.1.1
test $UID = 0 && chown -R root:root .

# Verify that the files in the distribution are OK
md5sum -c MD5SUMS | grep -v "OK$"

mkdir objdir
cd objdir
../configure \
 --prefix=/usr \
 --enable-shared \
 --with-gnu-ld \
 --enable-threads=posix \
 --enable-__cxa_atexit \
 --disable-checking \
 --disable-nls
make bootstrap
make check

# Become root to install it
su

# DO NOT remove your existing gcc yet.  Run 'make install' first to get the
# new version installed.  Then remove the package for the old gcc.  Then run
# 'make install' again.

# Install it
make install

# Remove old Slackware packages
test -x /sbin/removepkg && /sbin/removepkg gcc_objc gcc_g77 gcc \
 egcsobjc egcs_g77 egcs \
 gcc-g++ gcc-g77 gcc-gnat gcc-java gcc-objc

# If you did remove an old Slackware package, install it again (now that
# some of it is missing)
cp gcc/libgcc_s.so.1 gcc/libgcc_s.so /usr/lib/
make install
ldconfig

# Create some common symlinks
rm -f /usr/bin/cc
ln -sf /usr/bin/cpp /lib/cpp
ln -sf /usr/bin/gcc /usr/bin/cc

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gcc-*.tar.*
mv gcc-4.1.1.tar.bz2 installed/


# GCC 4.0.3 (released March 10, 2006)
# =========
# 'make check' requires autogen

cd
test -f installed/gcc-4.0.3.tar.bz2 && mv installed/gcc-4.0.3.tar.bz2 .
test ! -f gcc-4.0.3.tar.bz2 &&
 wget http://ftp.gnu.org/gnu/gcc/gcc-4.0.3/gcc-4.0.3.tar.bz2

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "6ff1af12c53cbb3f79b27f2d6a9a3d50  gcc-4.0.3.tar.bz2" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "5a94943d9ab823cf8d080cc7f9e8a4a91797afea  gcc-4.0.3.tar.bz2" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys B75C61B8 > /dev/null 2>&1 || gpg --recv-keys B75C61B8 ) &&
 wget -nc http://ftp.gnu.org/gnu/gcc/gcc-4.0.3/gcc-4.0.3.tar.bz2.sig &&
  gpg --verify gcc-4.0.3.tar.bz2.sig && rm gcc-4.0.3.tar.bz2.sig

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gcc-*" -exec rm -r {} \;
tar xjvf ~/gcc-4.0.3.tar.bz2
cd gcc-4.0.3
test $UID = 0 && chown -R root:root .

# Verify that the files in the distribution are OK
md5sum -c MD5SUMS | grep -v "OK$"

mkdir objdir
cd objdir
../configure \
 --prefix=/usr \
 --enable-shared \
 --with-gnu-ld \
 --enable-threads=posix \
 --enable-__cxa_atexit \
 --disable-checking \
 --disable-nls
make bootstrap
make check

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg gcc_objc gcc_g77 gcc \
 egcsobjc egcs_g77 egcs \
 gcc-g++ gcc-g77 gcc-gnat gcc-java gcc-objc
make install
rm -f /usr/bin/cc
ln -sf /usr/bin/cpp /lib/cpp
ln -sf /usr/bin/gcc /usr/bin/cc
ldconfig

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gcc-*.tar.*
mv gcc-4.0.3.tar.bz2 installed/


# GCC 3.4.6 (released March 6, 2006)
# =========
cd
test -f installed/gcc-3.4.6.tar.bz2 && mv installed/gcc-3.4.6.tar.bz2 .
test ! -f gcc-3.4.6.tar.bz2 &&
 wget http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "4a21ac777d4b5617283ce488b808da7b  gcc-3.4.6.tar.bz2" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "97b290fdc572c8e490b3b39f243e69bacad23c2b  gcc-3.4.6.tar.bz2" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 902C9419 > /dev/null 2>&1 || gpg --recv-keys 902C9419 ) &&
 wget -nc http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2.sig &&
  gpg --verify gcc-3.4.6.tar.bz2.sig && rm gcc-3.4.6.tar.bz2.sig

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gcc-*" -exec rm -r {} \;
tar xjvf ~/gcc-3.4.6.tar.bz2
cd gcc-3.4.6
test $UID = 0 && chown -R root:root .
mkdir objdir
cd objdir
../configure \
 --prefix=/usr \
 --enable-shared \
 --with-gnu-ld \
 --enable-threads=posix \
 --enable-__cxa_atexit \
 --disable-checking \
 --disable-nls
make bootstrap
make check

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg gcc_objc gcc_g77 gcc \
 egcsobjc egcs_g77 egcs \
 gcc-g++ gcc-g77 gcc-gnat gcc-java gcc-objc
make install
rm -f /usr/bin/cc
ln -sf /usr/bin/cpp /lib/cpp
ln -sf /usr/bin/gcc /usr/bin/cc
ldconfig

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gcc-*.tar.*
mv gcc-3.4.6.tar.bz2 installed/

Back to the list


Last updated: Fri, 26 Mar 2010 13:18:56 -0400
Jason Englander <jason at englanders dot us>