Travis OS X and gcc



For the past little while all my OS X tests fail on travis, specifically the installation of gcc fails. I use this:

  - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
  - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install gcc; fi

and get the following error:

$ if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install gcc; fi
==> Installing dependencies for gcc: gmp, mpfr, libmpc, isl
==> Installing gcc dependency: gmp
==> Downloading
==> Pouring gmp-6.1.2_1.sierra.bottle.tar.gz
🍺  /usr/local/Cellar/gmp/6.1.2_1: 18 files, 3.1MB
==> Installing gcc dependency: mpfr
==> Downloading
==> Pouring mpfr-4.0.1.sierra.bottle.tar.gz
🍺  /usr/local/Cellar/mpfr/4.0.1: 28 files, 4.6MB
==> Installing gcc dependency: libmpc
==> Downloading
==> Pouring libmpc-1.1.0.sierra.bottle.tar.gz
🍺  /usr/local/Cellar/libmpc/1.1.0: 12 files, 353.9KB
==> Installing gcc dependency: isl
==> Downloading
==> Pouring isl-0.18.sierra.bottle.tar.gz
🍺  /usr/local/Cellar/isl/0.18: 80 files, 3.8MB
==> Installing gcc
==> Downloading
==> Pouring gcc-7.3.0.sierra.bottle.1.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/c++
Target /usr/local/include/c++
already exists. You may want to remove it:
  rm '/usr/local/include/c++'
To force the link and overwrite all conflicting files:
  brew link --overwrite gcc
To list all files that would be deleted:
  brew link --overwrite --dry-run gcc
Possible conflicting files are:
/usr/local/include/c++ -> /usr/local/Caskroom/oclint/0.11,15.6.0/oclint-0.11/include/c++
==> Summary
🍺  /usr/local/Cellar/gcc/7.3.0: 1,486 files, 284MB
The command "if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install gcc; fi" failed and exited with 1 during .

I was very surprised I didn’t find a relevant issue or discussion since I assume others must have the same problem, but apologies if this is discussed somewhere.


It looks like there’s some discussion of the issue here: (although I don’t know the right solution for your case).


Thank you, looks like adding

brew cask uninstall oclint

Before installing GCC solves the problem.