Created
August 31, 2018 22:33
-
-
Save tyleransom/bbdea7a6f9f5cc9914b8e0dbcbee1d04 to your computer and use it in GitHub Desktop.
Script to build GCC 4.7.x on newer Linux distributions (using
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Download source | |
wget http://mirrors.concertpass.com/gcc/releases/gcc-4.7.2/gcc-4.7.2.tar.bz2 | |
tar xvfj gcc-4.7.2.tar.bz2 | |
cd gcc-4.7.2 | |
./contrib/download_prerequisites | |
#Download and apply fix to be able to build GCC 4.7 with GCC 5.x | |
wget https://patchwork.ozlabs.org/patch/504982/raw/ -O cfns-fix-mismatch-in-gnu_inline-attributes.patch | |
patch -p1 -i cfns-fix-mismatch-in-gnu_inline-attributes.patch | |
#Edit files to prevent errors with newer version of texinfo | |
sed -i "s|@itemx --help|@item -help|ig" gcc/doc/cppopts.texi | |
sed -i "s|@itemx -fenable-@var{kind}-@var{pass}|@item -fenable-@var{kind}-@var{pass}|ig" gcc/doc/invoke.texi #5182 | |
sed -i "s|@itemx -fdump-rtl-cprop_hardreg|@item -fdump-rtl-cprop_hardreg|ig" gcc/doc/invoke.texi #5330 | |
sed -i "s|@itemx -fdump-rtl-csa|@item -fdump-rtl-csa|ig" gcc/doc/invoke.texi #5334 | |
sed -i "s|@itemx -fdump-rtl-dce|@item -fdump-rtl-dce|ig" gcc/doc/invoke.texi #5345 | |
sed -i "s|@itemx -fdump-rtl-dbr|@item -fdump-rtl-dbr|ig" gcc/doc/invoke.texi #5349 | |
sed -i "s|@itemx -fdump-rtl-into_cfglayout|@item -fdump-rtl-into_cfglayout|ig" gcc/doc/invoke.texi #5394 | |
sed -i "s|@itemx -fdump-rtl-outof_cfglayout|@item -fdump-rtl-outof_cfglayout|ig" gcc/doc/invoke.texi #5424 | |
sed -i "s|@itemx -fdump-rtl-pro_and_epilogue|@item -fdump-rtl-pro_and_epilogue|ig" gcc/doc/invoke.texi #5436 | |
sed -i "s|@itemx POINTER_PLUS_EXPR|@item POINTER_PLUS_EXPR|ig" gcc/doc/generic.texi | |
sed -i "s|@itemx PLUS_EXPR|@item PLUS_EXPR|ig" gcc/doc/generic.texi | |
cd .. | |
mkdir objdir | |
cd objdir | |
../gcc-4.7.2/configure --enable-bootstrap --enable-languages=c,c++,fortran --prefix=/opt/apps/rhel7/gcc-4.7.2 --with-ppl=/opt/apps/rhel7/ppl-1.2 --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-arch_32=i686 --build=x86_64-redhat-linux | |
make | |
#install | |
sudo make install | |
#check the install | |
/usr/bin/gcc --version | |
/opt/apps/rhel7/gcc-4.7.2/bin/gcc --version | |
#delete directory | |
cd .. | |
rm -rf objdir |
@tyleransom
May be it is my network issues. Anyway , thanks all the same.
I've tried remove the gcc under /usr/local/bin first and then remove the default gcc-4.4.7-23.el6.x86_64 using
sudo yum remove gcc
and then re-install the default gcc again using
sudo yum install gcc
After that the gcc comes back to 4.4.7. Then I can upgrade it to 4.7.2 by compiling the source. It did work in centos 6.x
Glad to hear it worked out.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi tyler,
The link https://patchwork.ozlabs.org/patch/504982/raw/ seems unavailable now. Could you please put the contents directory into github?
Whether i just replace the cfns.gperf under the gcc-4.7.2/gcc/cp/ with the new one under gcc-5.y.z/gcc/cp is ok?
Br.
Ting