# macOS build fails when brew-pouring gcc-8.2.0

**URL:** <https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442>\
**Category:** macOS\
**Created:** [October 21, 2018, 9:38am UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442 "2018-10-21T09:38:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![franz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/franz/32/3832_2.png) [@franz](https://travis-ci.community/u/franz)\
**Post date:** [October 21, 2018, 9:38am UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/1 "2018-10-21T09:38:22Z")

</div>

Here is the job that fails:  
[https://travis-ci.org/appleseedhq/appleseed/jobs/444216375](https://travis-ci.org/appleseedhq/appleseed/jobs/444216375).

And here is the error:

```nohighlight
==> Pouring gcc-8.2.0.high_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.13.1,17.4.0/oclint-0.13.1/include/c++

```

I restart it and it failed with the exact same error so it doesn’t seem to be a fluke.

Our macOS build was fine until approximately 16 hours ago.

[Compared to the last working run of our macOS build](https://travis-ci.org/appleseedhq/appleseed/jobs/444126944), it seems that one of the package (gdal?) has a new dependency that ultimately results in gcc 8.2.0 being installed, and that fails.

I also see warning messages such as

```nohighlight
gdal dependency gcc was built with a different C++ standard library (libstdc++ from clang). This may cause problems at runtime.

```

earlier in the log of the failing job.

Any idea what’s going on?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 22, 2018, 12:49pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/2 "2018-10-22T12:49:47Z")

</div>

I think this is a problem with Homebrew. I’ll quote my comment from [osx: "brew upgrade" failed and exited with 1 during · Issue #10275 · travis-ci/travis-ci · GitHub](https://github.com/travis-ci/travis-ci/issues/10275#issuecomment-431719585:)

> We have not deployed anything over the weekend, and I believe this is an issue with Homebrew itself.
> 
> If you don’t run `brew update`, Homebrew version [remains at 1.7.5](https://travis-ci.org/BanzaiMan/travis_production_test/jobs/444519626#L595) and [`brew upgrade "sqlite"` fails](https://travis-ci.org/BanzaiMan/travis_production_test/jobs/444519626#L605)(because that’s how Homebrew works).  
> While if you do run `brew update`, Homebrew itself gets [updated to version 1.7.7](https://travis-ci.org/BanzaiMan/travis_production_test/jobs/444518489#L1253) and [`brew upgrade "sqlite"`](https://travis-ci.org/BanzaiMan/travis_production_test/jobs/444518489#L1470) fails even though the upgrade seems to succeed.
> 
> Please report it at [GitHub - Homebrew/brew: 🍺 The missing package manager for macOS (or Linux)](https://github.com/Homebrew/brew).

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 24, 2018, 9:32pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/3 "2018-10-24T21:32:32Z")

</div>

This was a somewhat misleading comment.

You are right about the issue being with the updated formulae, where a package now conflicts with the build image.

At the moment, I think the best way is to account for this change in formula, and run the suggested command during the build.

---

<div class="post-metadata">

**Author:** ![franz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/franz/32/3832_2.png) [@franz](https://travis-ci.community/u/franz)\
**Post date:** [October 24, 2018, 9:44pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/4 "2018-10-24T21:44:15Z")

</div>

Thanks for your comments.

> [@BanzaiMan](#):
>
> At the moment, I think the best way is to account for this change in formula, and run the suggested command during the build.

Do you mean

```auto
brew link --overwrite gcc

```

?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 24, 2018, 9:46pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/5 "2018-10-24T21:46:00Z")

</div>

Yes, that command.

---

<div class="post-metadata">

**Author:** ![franz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/franz/32/3832_2.png) [@franz](https://travis-ci.community/u/franz)\
**Post date:** [October 25, 2018, 6:26am UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/6 "2018-10-25T06:26:26Z")

</div>

Thanks, but the problem is that we _don’t_ pour gcc ourselves. Nowhere do we deal with gcc or even gdal. These appear to be dependencies of dependencies.

Here’s our full Travis setup on macOS, it’s fairly straightforward:

> <https://github.com/appleseedhq/appleseed/blob/master/travis/build-macos.sh>

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 25, 2018, 12:15pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/7 "2018-10-25T12:15:18Z")

</div>

I understand that you don’t. But the formula(e) you do use did change and now that’s causing a problem. You can try skipping `brew update` or `brew upgrade X`, but whether or not that is sufficient to get your build going (right now or far into the future) is unclear.

---

<div class="post-metadata">

**Author:** ![franz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/franz/32/3832_2.png) [@franz](https://travis-ci.community/u/franz)\
**Post date:** [October 25, 2018, 12:27pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/8 "2018-10-25T12:27:17Z")

</div>

> [@BanzaiMan](#):
>
> I understand that you don’t. But the formula(e) you do use did change and now that’s causing a problem. You can try skipping `brew update` or `brew upgrade X` , but whether or not that is sufficient to get your build going (right now or far into the future) is unclear.

I understand and agree wholeheartedly, however what I _don’t_ understand is what you suggest we should actually do. If we don’t request/install gcc ourselves, how can we do `brew link --overwrite gcc`? Or do you mean we should do it after brew update/upgrade?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 25, 2018, 2:48pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/9 "2018-10-25T14:48:11Z")

</div>

Ah, I see what you mean now. I would try something like this:

```
brew upgrade X || sudo brew link --overwrite gcc # for some X
brew upgrade

```

The problem here is that you don’t know ahead of time what packages are going to be upgraded if you just run `brew upgrade`. So you’d have to be really selective on what package to upgrade, and anticipate what commands are necessary to fix any problem that `brew` will encounter. Ideally `brew` would provide a flag to run these recommended commands, but I don’t know if such a thing exists.

---

<div class="post-metadata">

**Author:** ![Mizux](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mizux/32/274_2.png) [@Mizux](https://travis-ci.community/u/Mizux)\
**Post date:** [October 29, 2018, 3:06pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/10 "2018-10-29T15:06:40Z")

</div>

Won’t work since brew forbid running as root…

```auto
$ sudo brew link --overwrite gcc
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

```

cf: [https://travis-ci.org/google/or-tools/jobs/447831682#L1229](https://travis-ci.org/google/or-tools/jobs/447831682#L1229)

---

<div class="post-metadata">

**Author:** ![franz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/franz/32/3832_2.png) [@franz](https://travis-ci.community/u/franz)\
**Post date:** [October 29, 2018, 3:09pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/11 "2018-10-29T15:09:29Z")

</div>

FYI we just pushed a fix:

> <https://github.com/appleseedhq/appleseed/pull/2273/files>

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![PierreMarchand20](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/pierremarchand20/32/390_2.png) [@PierreMarchand20](https://travis-ci.community/u/PierreMarchand20)\
**Post date:** [November 8, 2018, 1:46pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/12 "2018-11-08T13:46:48Z")

</div>

it looks like you have an incompatibility due to the pre installed oclint, it may be related to a problem reported in [https://github.com/travis-ci/travis-ci/issues/8826](https://github.com/travis-ci/travis-ci/issues/8826) and you may solve it using

```
brew uninstall oclint

```

after updating homebrew.

---

<div class="post-metadata">

**Author:** ![franz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/franz/32/3832_2.png) [@franz](https://travis-ci.community/u/franz)\
**Post date:** [November 8, 2018, 2:22pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/13 "2018-11-08T14:22:34Z")

</div>

Thanks! I think we’ll live with our workaround for now, but it’s good to know of an alternate, possibly cleaner solution.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [November 8, 2018, 4:00pm UTC](https://travis-ci.community/t/macos-build-fails-when-brew-pouring-gcc-8-2-0/442/14 "2018-11-08T16:00:21Z")

</div>

We now remove `oclint` for every Mac build. [https://changelog.travis-ci.com/oclint-is-removed-from-mac-builds-79270](https://changelog.travis-ci.com/oclint-is-removed-from-mac-builds-79270)
