close

Reference data: The Definitive Guide to GCC, second edition, William von Hagen
Environment: Ubuntu 7.10
Prerequisite: Prepare about 1.5 GB free disk space for building and installing GCC.

1. Install essential utilities (root)

apt-get install bash binutils bison dejagnu flex gcc g++ gnat make tar tcl(8.4) expect gperf autoconf automake texinfo gettext gfortran gcj autogen

2. Install the source code, set up the configuration settings, and compile the compilers (user)
    Download gcc-VERSION.bz2 and gcc-testsuite-VERSION.bz2 to ~/src directory. /* replace VERSION with the appropriate numeric value for the version of GCC that we are using */

mkdir -p ~/src/gcc-obj
cd ~/src
tar jxf gcc-VERSION.bz2 /* ~/src/ */
tar jxf gcc-testsuite-VERSION.bz2 /* ~/src/ */
cd ~/src/gcc-VERSION /* source directory */
cd ~/src/gcc-obj /* build directory */
../gcc-VERSION/configure --prefix=/usr/local/gccVERSION /* run configuration script & indicate the directory for installing GCC */
make bootstrap /* ~/src/gcc-obj/, it may take several hours to finish this job */

3. Test the build, optional operation (user)

make -k check                                            /* ~/src/gcc-obj/, make sure tcl, expect, gcc-testsuite, and dejagnu are installed */

    Submit the test results to the GCC project by using teh test_summary script

~/src/gcc-VERSION/contrib/test_summary [-p extra_info.txt] -m gcc-testresults@gcc.gnu.org | /bin/sh

4. Install GCC (root)

cd ~/src/gcc-obj
make install /* ~/src/gcc-obj/ */
ldconfig -v /* update the dynamic linker's chche file, locate the new shared libraries */

5. Change the PATH environment variable setting
    Add /usr/local/gccVERSION/bin to the PATH environment variable and make this setting before the original PATH setting of GCC.


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 nix 的頭像
    nix

    nix

    nix 發表在 痞客邦 留言(0) 人氣()