Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install GCC 5.4.0
#!/bin/bash
# this script installs GCC 5.4.0
# to use it navigate to your home directory and type:
# sh install-gcc-5.4.0.sh
# download and install gcc 4.9.3
wget https://github.com/gcc-mirror/gcc/archive/gcc-5_4_0-release.tar.gz
tar xzf gcc-5_4_0-release.tar.gz
cd gcc-5_4_0-release
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
../gcc-5_4_0-release/configure --prefix=$HOME/gcc-5.4.0 --disable-nls --enable-languages=c,c++ --with-ld=/bin/ld --with-nm=/bin/nm --with-as=/usr/bin/as --disable- multilib
make
# install
make install
# clean up
rm -rf ~/objdir
rm -f ~/gcc-5_4_0-release.tar.gz
# add to path (you may want to add these lines to $HOME/.bash_profile)
export PATH=$HOME/gcc-5.4.0/bin:$PATH
export LD_LIBRARY_PATH=$HOME/gcc-5.4.0/lib:$HOME/gcc-5.4.0/lib64:$LD_LIBRARY_PATH
@tahakapasi

This comment has been minimized.

Copy link

tahakapasi commented Sep 7, 2018

You need to remove the space betweeen --disable- and multilib on line 16
It needs to be --disable-multilib

@gabefair

This comment has been minimized.

Copy link

gabefair commented Nov 17, 2018

Thanks for helping us by posting this!

@yli-aptiv

This comment has been minimized.

Copy link

yli-aptiv commented Sep 26, 2019

Common error: g++: error: gengtype-lex.c: No such file or directory
To solve it, you need to install flex:
sudo apt-get install flex

@StKyr

This comment has been minimized.

Copy link

StKyr commented Feb 14, 2020

The link to the Github repo is now invalid. Do you know where the tar ball is now located?

@radielazazy

This comment has been minimized.

Copy link

radielazazy commented Feb 15, 2020

The link to the Github repo is now invalid. Do you know where the tar ball is now located?

I'm looking for it right now too, were you able to find it?

@StKyr

This comment has been minimized.

Copy link

StKyr commented Feb 26, 2020

The link to the Github repo is now invalid. Do you know where the tar ball is now located?

I'm looking for it right now too, were you able to find it?

How about this link?
https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz

I think a change in the following directories from _ to . will be required as well

@RodriguezManuel

This comment has been minimized.

Copy link

RodriguezManuel commented Apr 8, 2020

I have fixed several errors in the archive, i leave the correct version of it down below
Also if you are still having problems try executing: sudo apt install gcc-multilib

install-gcc-5.4.0.sh
`
#!/bin/bash

this script installs GCC 5.4.0

to use it navigate to your home directory and type:

sh install-gcc-5.4.0.sh

download and install gcc 4.9.3

wget https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz
tar xzf gcc-5.4.0.tar.gz
cd gcc-5.4.0
./contrib/download_prerequisites
cd ..
mkdir objdir

cd objdir
../gcc-5.4.0/configure --prefix=$HOME/gcc-5.4.0 --disable-nls --enable-languages=c,c++ --with-ld=/bin/ld --with-nm=/bin/nm --with-as=/usr/bin/as --disable-multilib
make

install

make install

clean up

rm -rf ~/objdir
rm -f ~/gcc-5.4.0.tar.gz

add to path (you may want to add these lines to $HOME/.bash_profile)

export PATH=$HOME/gcc-5.4.0/bin:$PATH
export LD_LIBRARY_PATH=$HOME/gcc-5.4.0/lib:$HOME/gcc-5.4.0/lib64:$LD_LIBRARY_PATH

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.