User Tools

Site Tools


howto:compiling_gcc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
howto:compiling_gcc [2012/09/10 19:52]
adymond [Installation]
howto:compiling_gcc [2021/12/09 16:42] (current)
Line 1: Line 1:
 ====== Compiling GCC 4.7.1 from Source ====== ====== Compiling GCC 4.7.1 from Source ======
  
-This guide is written as to aid CHPC users who are struggling to compile the GCC version required for their codes. For the official guide on compiling GCC +This guide is written as to aid CHPC users who are struggling to compile the 
-please visit the [[http://gcc.gnu.org/install/|GCC website]]. This guide documents how GCC-4.7.1 would be built on the Sun Tsessbe Cluster login node, +GCC version required for their codes. For the official guide on compiling GCC 
-after the August 2012 upgrades. This guide is written for installing gcc 4.7.1 compilers for c,c++,fortran,objc.+please visit the [[http://gcc.gnu.org/install/|GCC website]]. This guide 
 +documents how GCC 4.7.1 would be built on the Sun Tsessbe Cluster login node, 
 +after the August 2012 upgrades.
  
-Before you begin, make sure your bash environmental variable are set to their +This guides use the temporary working  /tmp/$USER/gcc_build, the installation 
-defaults. i.e. All additions to the //~/.bashrc// file +directory of $HOME/local
-([[quick:start#what_you_can_do|example ]])should be commented out. You +
-should see the following from the shell +
-  gcc --version +
-    gcc (GCC) 4.1.2+
  
-Alsothis guide use the /tmp folder on the login node as the working directory to save disk space in your home directory.+Before you begincomment out all alterations to your //~/.bashrc// file 
 +([[quick:start#what_you_can_do|example ]]). Then log out and in again and you 
 +should see, should see the following from 
 +the shell 
 +  $ gcc -v 
 +  Using built-in specs. 
 +  Target: x86_64-unknown-linux-gnu 
 +  Configured with: /usr/local/gcc/gcc-4.3.4/configure --prefix=/opt/gridware/gcc-4.3 --disable-multilib 
 +  Thread model: posix 
 +  gcc version 4.1.2 20080704 (Red Hat 4.1.2-52) 
 + 
 +Note on the lib folder naming conventions, the standard in 2012 is to have 
 +libraries 64 bit by default, and some 32 bit libraries as well. In Ubuntu 
 +12.04 for example, the following library folder name convention is used 
 +  /usr/lib    /usr/lib32 
 + 
 +However, on the login node which is little older, its the other way round. The 
 +lib folder refers to 32 bit libraries by default, while the lib64 is for 64 bit 
 +libraries. ie its the chpc nodes have the following naming convention 
 +  /usr/lib64    /usr/lib 
 + 
 +So when you install software, which is 64 bit (default these days) remember you 
 +want to install it in the lib64 and not the lib folder, as the lib64 folders are 
 +searched first. ie use the following compilation flag --libdir=$HOME/local/lib64 
 + 
 +===== Setting up the latest GNU binutils and libtool ===== 
 + 
 +The latest version of of these libraries are going to be setup in the your 
 +local directory 
 + 
 +=== BinUtils === 
 + 
 +BinUtils version 
 +  $ ld --version 
 +  GNU ld version 2.17.50.0.6-20.el5_8.3 20061020 
 +  $ ld --verbose | grep SEARCH 
 +  SEARCH_DIR("/usr/x86_64-redhat-linux/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); 
 +  SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/x86_64-redhat-linux/lib"); 
 +  SEARCH_DIR("/usr/lib64");  SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); 
 + 
 +Install the latest version of GNU bin utils, as follows 
 +  $ mkdir -p /tmp/$USER/gcc_build 
 +  $ cd /tmp/$USER/gcc_build 
 +  $ wget http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.gz 
 +  $ tar -xf binutils-2.22.tar.gz 
 +  $ mkdir binutils-2.22/BUILD 
 +  $ cd binutils-2.22/BUILD 
 +  $ mkdir $HOME/local 
 +  $ ../configure --prefix=$HOME/local --libdir=$HOME/local/lib64 
 +  $ make # takes a couple of minutes 
 +  $ make check 1> make.check 2>&1 # should take 5 minutes to complete 
 +If all tests are passed: 
 +  $ grep -i -e pass -e fail -e summary make.check 
 +  === binutils Summary === 
 +  # of expected passes 94 
 +  === gas Summary === 
 +  # of expected passes         625 
 +  ===  ld Summary === 
 +  # of expected passes 703 
 +  # of expected failures 61 
 +  ./test-demangle: 844 tests, 0 failures 
 +proceed, 
 +  make install 
 + 
 +Add the following to bashrc file,  
 +  export PATH=$HOME/bin:$PATH 
 +  export PATH=$HOME/local/bin:$PATH 
 +  unset  LD_LIBRARY_PATH  # the default value is non-sensical now.. 
 + 
 +log in and out again, and 
 +  $ ld -v 
 +  GNU ld (GNU Binutils) 2.22 
 +And neatly enough, now your local paths have been added to the ld search pash 
 +  $ ld --verbose | grep SEARCH 
 +  SEARCH_DIR("/export/home/$USER/local/x86_64-unknown-linux-gnu/lib64"); 
 +  SEARCH_DIR("/export/home/$USER/local/lib64"); 
 +  SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); 
 +  SEARCH_DIR("/usr/lib64"); 
 +  SEARCH_DIR("/export/home/$USER/local/x86_64-unknown-linux-gnu/lib"); 
 +  SEARCH_DIR("/export/home/$USER/local/lib"); SEARCH_DIR("/usr/local/lib"); 
 +  SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); 
 +kewl, :) 
 + 
 +SideNote : the LD_LIBRARY_PATH variable does not effect the output of  
 +//ld --verbose | grep SEARCH // 
 + 
 +=== libtool === 
 + 
 +Take moment the reader though the libtool configuration, 
 +  $libtool --config | less 
 +  $libtool --version 
 +  ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06) 
 + 
 +Download source 
 +  $ cd /tmp/$USER/gcc_build 
 +  $ wget ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz 
 +  $ tar -xf libtool-2.4.2.tar.gz 
 +  $ cd libtool-2.4.2 
 +  $ mkdir BUILD 
 +  $ cd BUILD 
 +  $ ../configure --prefix=$HOME/local --libdir=$HOME/local/lib64 
 +  $ make 
 +  $ make check 1> make.check 2>& # takes about 10 minutes, so do inside 
 +  screen and tail output... 
 +  $ make install
  
-Finally note that, all binaries and libraries are installed home directory, i.e prefix=$HOME/usr.+check everything out 
 +  $libtool --version 
 +  libtool (GNU libtool) 2.4.2 
 +  $libtool --config | less
  
-===== Prerequisites ====+===== GCC Prerequisites =====
  
 A table showing what tools and package for building GCC, and what is available A table showing what tools and package for building GCC, and what is available
Line 26: Line 131:
 | A “working” POSIX compatible shell, or GNU bash | | bash available | | A “working” POSIX compatible shell, or GNU bash | | bash available |
 | awk                |GNU awk version 3.1.5 | GNU awk version 3.1.5 | | awk                |GNU awk version 3.1.5 | GNU awk version 3.1.5 |
-| GNU binutils | | |+| GNU binutils | | 2.17 |
 | gzip   | 1.2.4 | 1.3.5  | | gzip   | 1.2.4 | 1.3.5  |
 | gzip2  | 1.0.2  | 1.0.3  | | gzip2  | 1.0.2  | 1.0.3  |
Line 50: Line 155:
 but it's safer to use the exact versions documented" but it's safer to use the exact versions documented"
  
-All the gcc_libs are going to be stored in the $HOME/usr/gcc_libs folder, if +==== gcc-4.2.4 compilers ====
-that folder doesn't exist, +
-  $ mkdir -p $HOME/usr/gcc_libs +
- +
-However to compile these libraries, we are going to need c++ compilers ... +
- +
-==== c,c++ compilers ====+
  
 The gcc-4.2.4 c and c++ compilers are going to be used to build the require The gcc-4.2.4 c and c++ compilers are going to be used to build the require
Line 62: Line 161:
 the GMP, MPFR or MPC libraries. the GMP, MPFR or MPC libraries.
  
-create the temporary directory to compile the required codes +download source 
-  $  mkdir -p /tmp/$USER/gcc_build +  $ cd /tmp/$USER/gcc_build 
-  $  cd /tmp/$USER/gcc_build +  $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.2.4/gcc-4.2.4.tar.bz2 
- +uncompress  
-download nessary files +  $ tar -xf gcc-4.2.4.tar.bz2
- +
-  $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.2.4/gcc-core-4.2.4.tar.bz2 +
-  $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.2.4/gcc-g++-4.2.4.tar.bz2 +
-  $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.2.4/gcc-testsuite-4.2.4.tar.bz2 +
- +
-uncompress all +
-  $ tar -xf gcc-core-4.2.4.tar.bz2 +
-  $ tar -xf gcc-g++-4.2.4.tar.bz2 +
-  $ tar -xf gcc-testsuite-4.2.4.tar.bz2 +
-or +
-  $ for archive in *.tar.bz2 ; do tar -xf $archive ; done+
  
 configure configure
Line 84: Line 172:
   $ cd BUILD   $ cd BUILD
   $ mkdir /tmp/$USER/gcc_build/usr   $ mkdir /tmp/$USER/gcc_build/usr
-  $ ../configure --prefix=/tmp/$USER/gcc_build/usr+  $ ../configure --prefix=/tmp/$USER/gcc_build/usr --libdir=/tmp/$USER/gcc_build/usr/lib64
  
 build inside a screen session build inside a screen session
-  $ screen +  $ screen
   $ make > make.out 2>&1   $ make > make.out 2>&1
-  # crtl-d to detach screen+  # crtl-a crtl-d to detach screen
   $ tail -f make.out #to watch compilation progress   $ tail -f make.out #to watch compilation progress
-  # after the make is complete, close the screen session by $ screen -r, then ctrl-d+  # after the make is complete, close the screen session by $ screen -r, then 
 +  ctrl-d 
 + 
 +This compiliation took just under 2 hours to complete, when this guide was 
 +written. Future work, disabling the build of lib java will probabily reduce 
 +the build time to less then an hour
  
-This compiliation took just under 40 minutes to complete, when this guide was written. 
-  
 Before continuing its probabily a good idea to test the gcc build .... Before continuing its probabily a good idea to test the gcc build ....
  
Line 101: Line 192:
   $ screen   $ screen
   $ make -k check > make.check 2>&1   $ make -k check > make.check 2>&1
-  # ctrl-d +  # ctrl-a crtl-d
   $ tail -f make.check   $ tail -f make.check
  
-Tests took about 50 minutes to complete.+Tests took about 2 hours to complete.
  
-Test results+Test results, when writing this guide
   $ grep -e '# of ' -e Summary /tmp/$USER/gcc_build/gcc-4.2.4/BUILD/make.check   $ grep -e '# of ' -e Summary /tmp/$USER/gcc_build/gcc-4.2.4/BUILD/make.check
       === gcc Summary ===       === gcc Summary ===
Line 118: Line 209:
   # of expected failures 67   # of expected failures 67
   # of unsupported tests 106   # of unsupported tests 106
-     === libstdc++ Summary === 
-  # of expected passes 4478 
-  # of unexpected failures 7 
-  # of unexpected successes 1 
-  # of expected failures 14 
-     === libmudflap Summary === 
-  # of expected passes 1814 
-     === libgomp Summary === 
-  # of expected passes 496 
  
-which is all good :) 
  
-=== install gcc ===+Only continue with this guide if all the tests are passed
  
-Installed the compliled gcc if passed the testing phase +=== installation of gcc ===
-  $ make install+
  
 +Install the compliled gcc if
 +  $ make install
  
-finally, update your enviromental variables. Add the follow to your .bashrc +Next the [[ 
-file+http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Environment-Variables.html#Environment-Variables 
 +| environment variables affecting GCC 4.2.4 ]] need to be set. Add the 
 +following lines to your .bashrc script file,
   # temporary gcc 4.2.4 build   # temporary gcc 4.2.4 build
   export PATH=/tmp/$USER/gcc_build/usr/bin:$PATH   export PATH=/tmp/$USER/gcc_build/usr/bin:$PATH
-  export LD_LIBRARY_PATH=/tmp/$USER/gcc_build/usr/lib64:/tmp/$USER/gcc_build/usr/lib:$HOME/usr/gcc_libs/lib:$LD_LIBRARY_PATH +  export LD_LIBRARY_PATH=/tmp/$USER/gcc_build/usr/lib64:/tmp/$USER/gcc_build/usr/lib 
-  #add library flags, for future compliations +  export C_INCLUDE_PATH=$HOME/local/include 
-  export LDFLAGS="-L/tmp/$USER/gcc_build/usr/lib64 -L/tmp/$USER/gcc_build/usr/lib -L$HOME/usr/gcc_libs/lib"                       +  export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH 
-  #add include folder for headers +//Note//, the $HOME/localadditions are for the libraries which 
-  export CPPFLAGS="-I/tmp/$USER/gcc_build/usr/include -I$HOME/usr/gcc_libs/include"+going to be built using gcc 4.2.4 for the latest gcc version.
  
 then logout and in again. You should see the following then logout and in again. You should see the following
Line 150: Line 234:
     ...     ...
     gcc version 4.2.4     gcc version 4.2.4
 +
 +Also check your include paths, and library paths using
 +  $ echo | gcc -v -x c -E -
 +  $ echo | gcc -v -x c++ -E -
 +
 +Check, gcc
 +  $ gcc -Wl,--verbose | less
  
 ==== helper script  ==== ==== helper script  ====
  
-The libraries required all follow the same build procedure, so a helper script +The libraries required all follow the same build procedure, 
-is used to help automate the processTHe helper script +  1download and extract 
-//download_and_install_from_source.sh//which put in by $HOME/bin folder is +  2configure 
-as follows+  3. make 
 +  4. make checkand in some cases 
 +  5. make install
  
-  #! /usr/bin/env bash 
-  # 
-  # Script to install software from source, which requires the following steps 
-  # 1. download and extract 
-  # 2. configure  
-  # 3. make 
-  # 4. make check 
-  # 5. make install 
-   
-  EXPECTED_ARGS=4 
-  E_BADARGS=65 
-   
-  if [ $# -ne $EXPECTED_ARGS ] 
-  then 
-    echo "Usage: `basename $0`  TAR_URL  BUILD_DIR  CONFIGURE_OPTIONS 
-    INSTALL_DIR" 
-    exit $E_BADARGS 
-  fi 
-   
-  SOURCE_URL=$1 
-  SOURCE_ARCHIVE=`basename $1` 
-  SOURCE_FOLDER=${SOURCE_ARCHIVE%.*} 
-  SOURCE_FOLDER=${SOURCE_FOLDER%.*} 
-  echo source folder $SOURCE_FOLDER 
-   
-  BUILD_DIR=$2 
-  BDIR=BUILD 
-  CONFIGURE_OPTIONS=$3 
-  INSTALL_DIR=$4 
-   
-  cd ${BUILD_DIR} 
-  wget --continue ${SOURCE_URL} 
-  if [ ! -e ${SOURCE_FOLDER} ] ; then 
-      tar -xf ${SOURCE_ARCHIVE} 
-  fi 
-  cd ${SOURCE_FOLDER} 
-  mkdir $BDIR 
-  cd $BDIR 
-  echo $PWD 
-     
-  echo ../configure ${CONFIGURE_OPTIONS} --prefix=${INSTALL_DIR} 
-  ../configure ${CONFIGURE_OPTIONS} --prefix=${INSTALL_DIR} 
-  make uninstall | tee make.uninstall # clean up any previous installs... 
-  make clean | tee make.clean 
-  make | tee make.out 
-  make check | tee make.check 
-  make install | tee make.install  
-  cat make.check | grep -i  "fail\|Pass" 
-  echo FINISHED 
  
-If you cut and paste this code into +So a helper script is used to help automate the process. THe helper script 
-$HOME/bin/download_and_install_from_source.sh. Then make sure its excutable +//download_and_install_from_source.sh//, can be download as follows
-$ chmod +x $HOME/bin/download_and_install_from_source.sh+  $ mkdir $HOME/local/bin 
 +  $ cd $HOME/local/bin 
 +  $ wget http://dymond.co.za/download_and_install_from_source.sh 
 +  $ chmod +x download_and_install_from_source.sh
  
-add the following line to your //.bashrc// fileif its not there already. +return to your home folderand you should see 
-  export PATH=$HOME/bin:$PATH +  $ cd ~/
-logout and login again. Then you should see the following+
   $ download_and_install_from_source.sh   $ download_and_install_from_source.sh
-    Usage: download_and_install_from_source.sh  TAR_URL  BUILD_DIR  CONFIGURE_OPTIONS  INSTALL_DIR+    Usage: download_and_install_from_source.sh  TAR_URL  BUILD_DIR  CONFIGURE_OPTIONS  [INSTALL_DIR
 + 
 +This helper script, is used in the rest of the guide. DO NOT USE THIS SCRIPT BLINDLY 
 +WITH OUT READING THE APPS DOCUMENTATION AND CONFIGURATION OPTIONS. 
  
-This helper script, is used in the rest of the guide. 
  
 ==== GMP library ==== ==== GMP library ====
Line 231: Line 279:
   $ mkdir BUILD   $ mkdir BUILD
   $ cd BUILD   $ cd BUILD
-  $ ../configure --prefix=$HOME/usr/gcc_libs --enable-cxx+  $ ../configure --prefix=$HOME/local/gcc_libs --enable-cxx
   $ make   $ make
   $ make check   $ make check
Line 238: Line 286:
 OR simply use our helper script OR simply use our helper script
   $ download_and_install_from_source.sh ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 \   $ download_and_install_from_source.sh ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 \
-   /tmp/$USER/gcc_build --enable-cxx $HOME/usr/gcc_libs+   /tmp/$USER/gcc_build "--enable-cxx --libdir=$HOME/local/lib64" $HOME/local
  
 Assert that everyting went okay. When the Assert that everyting went okay. When the
Line 244: Line 292:
 check results. You should see a whole bunch of passes and no check results. You should see a whole bunch of passes and no
 fails. Do this for the following library builds as well. fails. Do this for the following library builds as well.
 +
 +Finally copy the libraries to the gcc 4.2.4 of search path folder
 +  $ cp -v $HOME/local/lib64/libgmp* /tmp/$USER/gcc_build/usr/lib64/
 + 
 +=== lib64 and lib ===
 +
 +gcc and the linker search the 64 bit library folders first then the normal (32
 +bit folders afterwards (check out $ ld --verbose ). By default the latest
 +versions of gmp install there 64 bit libraries under the lib folder and the
 +lib64 folder. Which kind of makes sense; i.e. in the future is there going to
 +need to be lib256 folder? 
 +
 +The problem is that on the login node gmp in installed in the /usr/lib64
 +folder. So this folder is found first using the linker and gcc compared to the
 +/usr/lib folder for example. That is why the compiled libraries are installed
 +and copied to the 64 bit folders.
  
 ==== MPFR library ==== ==== MPFR library ====
Line 250: Line 314:
  
   $ download_and_install_from_source.sh http://www.mpfr.org/mpfr-current/mpfr-3.1.1.tar.gz \    $ download_and_install_from_source.sh http://www.mpfr.org/mpfr-current/mpfr-3.1.1.tar.gz \ 
- /tmp/$USER/gcc_build " " $HOME/usr/gcc_libs +  /tmp/$USER/gcc_build "--libdir=$HOME/local/lib64" $HOME/local 
 +  $ cp -v $HOME/local/lib64/libmpfr* /tmp/$USER/gcc_build/usr/lib64/
  
 ==== MPC library====  ==== MPC library==== 
Line 259: Line 323:
  
   $ download_and_install_from_source.sh http://www.multiprecision.org/mpc/download/mpc-1.0.tar.gz \   $ download_and_install_from_source.sh http://www.multiprecision.org/mpc/download/mpc-1.0.tar.gz \
-  /tmp/$USER/gcc_build " " $HOME/usr/gcc_libs+  /tmp/$USER/gcc_build "--libdir=$HOME/local/lib64" $HOME/local 
 +  $ cp -v $HOME/local/lib64/libmpc* /tmp/$USER/gcc_build/usr/lib64/
  
 ==== PPL ==== ==== PPL ====
Line 271: Line 336:
   http://bugseng.com/external/ppl/download/ftp/releases/0.11.2/ppl-0.11.2.tar.bz2 \   http://bugseng.com/external/ppl/download/ftp/releases/0.11.2/ppl-0.11.2.tar.bz2 \
   /tmp/$USER/gcc_build \   /tmp/$USER/gcc_build \
-  "--enable-watchdog"+  "--enable-watchdog --libdir=$HOME/local/lib64" \ 
-   $HOME/usr/gcc_libs +   $HOME/local
-make, takes 15 minutes +
-make ckeck, takes 3 hours 15 minutes +
 detach_screen, and come back in 3 hours. To watch the progress use tail detach_screen, and come back in 3 hours. To watch the progress use tail
   $ tail -f /tmp/$USER/gcc_build/ppl-0.11.2/BUILD/make.out #for the building   $ tail -f /tmp/$USER/gcc_build/ppl-0.11.2/BUILD/make.out #for the building
   $ tail -f /tmp/$USER/gcc_build/ppl-0.11.2/BUILD/make.check # for the testing   $ tail -f /tmp/$USER/gcc_build/ppl-0.11.2/BUILD/make.check # for the testing
 +
 +make, takes 15 minutes
 +make ckeck, takes 3 hours 15 minutes
 +
 +copy libraries, to gcc 4.2.4 search path
 +  $ cp -v $HOME/local/lib64/libp* /tmp/$USER/gcc_build/usr/lib64/ 
 +
 +
  
 ==== CLOOG library ==== ==== CLOOG library ====
Line 285: Line 355:
   $ download_and_install_from_source.sh \   $ download_and_install_from_source.sh \
   ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.10.tar.bz2 \   ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.10.tar.bz2 \
-  /tmp/$USER/gcc_build " " $HOME/usr/gcc_libs+  /tmp/$USER/gcc_build "--libdir=$HOME/local/lib64" $HOME/local 
 +  $ cp -v $HOME/local/lib64/libisl* /tmp/$USER/gcc_build/usr/lib64/
  
 [[http://www.cloog.org/|CLooG]] is a free software and library to generate code for scanning Z-polyhedra [[http://www.cloog.org/|CLooG]] is a free software and library to generate code for scanning Z-polyhedra
Line 291: Line 362:
   $ download_and_install_from_source.sh    $ download_and_install_from_source.sh 
    http://www.bastoul.net/cloog/pages/download/cloog-0.17.0.tar.gz \    http://www.bastoul.net/cloog/pages/download/cloog-0.17.0.tar.gz \
-  /tmp/$USER/gcc_build  " "  $HOME/usr/gcc_libs+  /tmp/$USER/gcc_build  "--with-isl=system --libdir=$HOME/local/lib64 --with-bits=gmp $HOME/local 
 +  $ cp -v $HOME/local/lib64/libcl* /tmp/$USER/gcc_build/usr/lib64/
  
 With the required libraries now available, the main GCC build can begin. With the required libraries now available, the main GCC build can begin.
Line 306: Line 378:
   $ mkdir BUILD   $ mkdir BUILD
   $ cd BUILD   $ cd BUILD
-  $  ../configure --prefix=/export/home/$USER/usr +  $ ../configure --prefix=$HOME/local --disable-cloog-version-check \ 
-  --with-gmp=$HOME/usr/gcc_libs --with-mpc=$HOME/usr/gcc_libs +   --enable-cloog-backend=isl --libdir=$HOME/local/lib64 
-  --with-mpfr=$HOME/usr/gcc_libs --with-ppl=$HOME/usr/gcc_libs +   --with-mpc-include=$HOME/local/include    --with-mpc-lib=$HOME/local/lib64 
-  --disable-cloog-version-check --enable-cloog-backend=isl --with-cloog=$HOME/usr/gcc_libs +   --with-mpfr-include=$HOME/local/include   --with-mpfr-lib=$HOME/local/lib64 
-  --enable-languages=c,c++,fortran,objc +   --with-gmp-include=$HOME/local/include    --with-gmp-lib=$HOME/local/lib64 \ 
- +   --with-ppl-include=$HOME/local/include    --with-ppl-lib=$HOME/local/lib64 
-  The following languages will be built: c,c++,fortran,lto,objc +   --with-cloog-include=$HOME/local/include  --with-cloog-lib=$HOME/local/lib64 
-  *** This configuration is not supported in the following subdirectories: +The following languages will be built: c,c++,fortran,java,lto,objc 
-     gnattools target-libada target-libgo target-libffi target-zlib +*** This configuration is not supported in the following subdirectories: 
-     target-libjava target-boehm-gc +     gnattools target-libada target-libgo 
-      (Any other directories should still work fine.) +    (Any other directories should still work fine.)
 ===== Compiling GCC ===== ===== Compiling GCC =====
  
Line 324: Line 395:
   $ screen   $ screen
   $ make > make.out 2>&1   $ make > make.out 2>&1
-  # detach screen using ctrl-D+  # detach screen using ctrl-a crtl-d
   $ tail -f make.out   $ tail -f make.out
  
-Expect the build to take about 1 hour 40 minutes.+Expect the build to take about 2 hours to complete.
  
 The benefit about this screen approach beyond saving you grey hairs, is that The benefit about this screen approach beyond saving you grey hairs, is that
Line 335: Line 406:
 file. file.
  
 +==== Trouble shooting compilation errors ====
  
 +=== refer to config.log errors ===
 +   
 +When make encounters an error and aborts the stating refer to config.log for
 +further information. The trick is find the folder make was in when it threw
 +that error. This can be done by inspecting the last command executed before
 +make halted. the //ls// command with the -lh flag can also be used to find
 +which folder was modified last. 
 +
 +Once the folder is found, read through the config.log file to get further
 +information on the error. If nessary, take the config file contents available
 +in the configure.log file, and paste them into a temporary file
 +ie. //config_debug.c// and rerurn the broken xonfigure command using that
 +file. A big help here is to add the -v flag to the xgcc compiler.
  
 ===== Testing ===== ===== Testing =====
Line 343: Line 428:
   $ screen   $ screen
   $ make -k check > make.check 2>&1   $ make -k check > make.check 2>&1
-  # detach screen using Ctrl-D+  # detach screen using ctrl-a ctrl-d
   $ tail -f make.check   $ tail -f make.check
 +
 +Testing took  3hrs 30 minutes
  
 After the testing was completed, i had the following results After the testing was completed, i had the following results
   $ grep -e '# of ' -e Summary /tmp/$USER/gcc_build/gcc-4.7.1/BUILD/make.check   $ grep -e '# of ' -e Summary /tmp/$USER/gcc_build/gcc-4.7.1/BUILD/make.check
- === gcc Summary === +  === gcc Summary === 
-  # of expected passes 85973 +  # of expected passes 87683 
-  # of unexpected failures 39 +  # of unexpected failures 37 
-  # of unexpected successes 49 +  # of unexpected successes 40 
-  # of expected failures 264 +  # of expected failurea 273 
-  # of unsupported tests 2173 +  # of unsupported tests 1262 
-     === g++ Summary === +  === g++ Summary === 
-  # of expected passes 48668 +  # of expected passes 48687 
-  # of unexpected failures 6+  # of unexpected failures 8
   # of expected failures 286   # of expected failures 286
-  # of unsupported tests 568 +  # of unsupported tests 558 
-     === gfortran Summary === +  === gfortran Summary === 
-  # of expected passes 41004+  # of expected passes 41001
   # of expected failures 56   # of expected failures 56
-  # of unsupported tests 66 +  # of unsupported tests 69 
-     === objc Summary ===+  === objc Summary ===
   # of expected passes 2988   # of expected passes 2988
   # of expected failures 6   # of expected failures 6
   # of unsupported tests 74   # of unsupported tests 74
-     === libstdc++ Summary === +  === libstdc++ Summary === 
-  # of expected passes 8851+  # of expected passes 8900
   # of expected failures 43   # of expected failures 43
-  # of unsupported tests 146 +  # of unsupported tests 145 
-     === libmudflap Summary ===+  === libmudflap Summary ===
   # of expected passes 1905   # of expected passes 1905
   # of unexpected failures 1   # of unexpected failures 1
-     === libgomp Summary ===+  === libffi Summary === 
 +  # of expected passes 1634 
 +  # of expected failures 10 
 +  # of unsupported tests 55 
 +  === libjava Summary === 
 +  # of expected passes 2574 
 +  === boehm-gc Summary === 
 +  # of expected passes 12 
 +  # of unsupported tests 1 
 +  === libgomp Summary ===
   # of expected passes 2998   # of expected passes 2998
-     === libitm Summary ===+  === libitm Summary ===
   # of expected passes 26   # of expected passes 26
   # of expected failures 3   # of expected failures 3
   # of unsupported tests 1   # of unsupported tests 1
  
-which is acceptable 
  
-testing took 3 hours 15 minutes to finish+If the testing results are acceptable for your intended applications, proceed with the installation. 
  
 ===== Installation ===== ===== Installation =====
Line 390: Line 486:
   $ make install   $ make install
  
-remove the gcc 4.2.4 entries from your bashrc file and replace them with  +Remove all the lines added to your rc file since the start of this guide, and 
-  # gcc 4.7.1 installed under $HOME/usr +replace them with 
-  export PATH=$HOME/usr/bin:$PATH + 
-  export LD_LIBRARY_PATH=$HOME/usr/lib64:$HOME/usr/lib:$HOME/usr/gcc_libs/lib:$LD_LIBRARY_PATH +  export PATH=$HOME/bin:$HOME/local/bin:$PATH 
-  #add library flags, for future compliations +  export LD_LIBRARY_PATH=$HOME/local/lib64
-  export LDFLAGS="-L$HOME/usr/lib64 -L$HOME/usr/lib -L$HOME/usr/gcc_libs/lib" +
-  #add include folder for headers +
-  export CPPFLAGS="-I$HOME/usr/include -I$HOME/usr/gcc_libs/include" +
-  export F77=gfortran +
-  export FFLAGS=$CPPFLAGS # not a hundred percent certain if this one in necessary+
  
 log in and out again, and  log in and out again, and 
Line 408: Line 499:
   gcc version 4.7.1 (GCC)    gcc version 4.7.1 (GCC) 
  
 +also check out your default gcc paths for including and libraries
 +  $ echo | gcc -v -x c -E -
 +  $ echo | gcc -v -x c++ -E -
 +
 +check the ld loads paths as well
 +  $ ld --verbose | grep SEARCH
 +
 +BIG NB, THE LIB64 FOLDERS ARE SEARCHED FIRST. So if you install new libraries which by
 +default these days are 64 bit and go the lib folder, and the system also has
 +an installed version in the lib64 folder. The systems old version in a lib64
 +folder is selected before your newer version. So to be safe, when you install new
 +software, use the following options
 +  /--prefix=$HOME/local --libdir=$HOME/local/lib64
  
 size of install size of install
-  $ du -sh $HOME/usr +  $ du -sh $HOME/local 
-  694M+  1.2G
  
 clean up your build directory clean up your build directory
   $ rm -r /tmp/$USER/gcc_build   $ rm -r /tmp/$USER/gcc_build
      
/app/dokuwiki/data/attic/howto/compiling_gcc.1347299569.txt.gz · Last modified: 2021/12/09 16:42 (external edit)