*This installation procedure is provided “as is” for your convenience. AMD takes no responsibility for the results of these steps.

Downloading the gcc source (trunk) and installing the required packages to build the gcc compiler on AMD Family 10h (e.g. Barcelona, Shanghai) machines:

  1. Install svn to download the gcc trunk from the FSF repository.
    apt-get install -y subversion
  2. Download the latest gcc trunk.
    svn co svn:/gcc.gnu.org/svn/gcc/trunk gcc-trunk-4.4
    This command downloads the trunk into the “gcc-trunk-4.4″ folder.
  3. Required packages for building gcc:
    1. gcc, g++ (standard base compiler)
    2. flex
    3. bison
    4. binutils
    5. libmpfr-dev
    6. libc6-i386 (This is needed if you want the compiler to generate 32-bit binaries in addition to 64-bit)
    7. libc6-dev-i386 (This is needed if you want the compiler to generate 32-bit binaries in addition to 64-bit)
  4. Install the required packages using apt-get.
    apt-get install -y gcc g++ flex bison binutils  libmpfr-dev libc6-i386 libc6-dev-i386

Building and installing the gcc compiler:

  1. cd gcc-trunk-4.4 (Change directory to the gcc source directory)
  2. mkdir build (Create a build directory)
  3. cd build
  4. Configure the build
    1. To build a compiler that can only generate 64-bit binaries:
      ../configure –prefix=/opt/gcc4.4-trunk –enable-languages=c,c++,fortran –enable-bootstrap –disable-nls –disable-multilib
    2. To build a compiler that can generate both 32-bit and 64-bit binaries:
      ../configure –prefix=/opt/gcc4.4-trunk –enable-languages=c,c++,fortran –enable-bootstrap –disable-nls –enable-multilib

      The “–prefix=<install_location>” specifies the top level installation directory. This is the recommended way to install the tools into a directory other than the default (thus not overwriting the existing compiler). The top level installation directory defaults to /usr/local.

  5. Build the compiler
    make -j <number of threads/cores>
    (Speeds the installation by doing a parallel build)
  6. Install the compiler
    make install
    After this step, you can check to see if the compiler is installed at <install_location>, which is /opt/gcc4.4-trunk in this case.
  7. You can now use the new compiler by setting the environment variables below:
    export PATH=$GCCPATH/bin:$PATH