Building GCC from source
A request was made to upgrade GCC to the latest version. Since the
current version 4.8.1 was not in the repo. I decided to build it from
scratch. Speaking of scratch, I used the instructions from LFS, which I had prevoiusly used to build GCC and four times. I downloaded and built several packages that were required for
the testing of GCC once it was built:
tcl8.6.1-src.tar.gz expect5.45.tar.gz dejagnu-1.5.1.tar.gz
Building required version of TCL:
cd unix && ./configure --prefix=/usr \ --without-tzdata \ --mandir=/usr/share/man \ $([ $(uname -m) = x86_64 ] && echo --enable-64bit) && make && sed -e "s@^\(TCL_SRC_DIR='\).*@\1/Installing TCL:usr/include'@" \ -e "/TCL_B/s@='\(-L\)\?.*unix@='\ 1/usr/lib@" \ -i tclConfig.sh
make install && make install-private-headers && ln -v -sf tclsh8.6 /usr/bin/tclsh && chmod -v 755 /usr/lib/libtcl8.6.soBuilding Expect:
./configure --prefix=/usr \ --with-tcl=/usr/lib \ --enable-shared \ --with-tclinclude=/usr/include && makeInstalling Expect:
make install && ln -svf expect5.45/libexpect5.45.so /usr/libBuilding Dejagnu:
./configure --prefix=/usr && makeinfo --html --no-split -o doc/dejagnu.html doc/dejagnu.texi && makeinfo --plaintext -o doc/dejagnu.txt doc/dejagnu.texiInstalling Dejagnu:
make install && install -v -dm755 /usr/share/doc/dejagnu-1.5.1 && install -v -m644 doc/dejagnu.{html,txt} \ /usr/share/doc/dejagnu-1.5.1Again, the three previous packages are for testing of the GCC installation, but with a package this large, it is wise to test it. Now on to the GCC build itself:
tar xvf gcc-4.8.1.tar.bz2 cd gcc-4.8.1GCC wants to be built in a separate directory:
sed -i 's/\(install.*:\) install-.*recursive/\1/' libffi/Makefile.in && sed -i 's/\(install-data-am:\).*/\1/' libffi/include/Makefile.in && sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in && case `uname -m` in i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;; esac && mkdir ../gcc-build && cd ../gcc-build && ../gcc-4.8.1/configure \ --prefix=/usr \ --libdir=/usr/lib \ --libexecdir=/usr/lib \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --disable-multilib \ --disable-bootstrap \ --disable-install-libiberty \ --with-system-zlib \ --enable-clocale=gnu \ --enable-lto \ --enable-languages=c,c++,Now to test the make. Warning, this check may take several hours:fortran,go,java,objc,obj-c++ && make
ulimit -s 32768 && make -k check && ../gcc-4.8.1/contrib/test_Now become root and install the build:summary
make install && ln -v -sf ../usr/bin/cpp /lib && ln -v -sf gcc /usr/bin/cc && chown -v -R root:root \ /usr/lib/gcc/*linux-gnu/4.8.1/include{,-fixed} \ /usr/lib/gcc/*linux-gnu/4.8.1/ ada{lib,include}
No comments:
Post a Comment