Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Symlink GCC

Shaun Jackman edited this page Mar 24, 2017 · 1 revision

Create symlinks for /usr/bin/gcc in $(brew --prefix)/bin

These instructions are unneeded on Ubuntu or Debian, or if your preferred compiler already has GCC executables found in your path named gcc-4.?, gcc-5, or gcc-6.

GCC 5 or 6 (gcc-5 or gcc-6)

ln -s $(which gcc) $(brew --prefix)/bin/gcc-$(gcc -dumpversion |cut -d. -f1)
ln -s $(which g++) $(brew --prefix)/bin/g++-$(g++ -dumpversion |cut -d. -f1)
ln -s $(which gfortran) $(brew --prefix)/bin/gfortran-$(gfortran -dumpversion |cut -d. -f1)
brew install hello && brew test hello; brew remove hello

GCC 4.x (gcc-4.x)

ln -s $(which gcc) $(brew --prefix)/bin/gcc-$(gcc -dumpversion |cut -d. -f1,2)
ln -s $(which g++) $(brew --prefix)/bin/g++-$(g++ -dumpversion |cut -d. -f1,2)
ln -s $(which gfortran) $(brew --prefix)/bin/gfortran-$(gfortran -dumpversion |cut -d. -f1,2)
brew install hello && brew test hello; brew remove hello

GCC 4.4 (gcc44) on CentOS 5

sudo yum install gcc44 gcc44-c++
ln -s /usr/bin/gcc44 $(brew --prefix)/bin/gcc-4.4
ln -s /usr/bin/g++44 $(brew --prefix)/bin/g++-4.4
ln -s /usr/bin/gfortran44 $(brew --prefix)/bin/gfortran-4.4
brew install --cc=gcc-4.4 hello && brew test hello; brew remove hello