macOS build fails when brew-pouring gcc-8.2.0

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

And here is the error:

==> 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, 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

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?

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

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 and brew upgrade "sqlite" fails (because that’s how Homebrew works).
While if you do run brew update, Homebrew itself gets updated to version 1.7.7 and brew upgrade "sqlite" fails even though the upgrade seems to succeed.

Please report it at GitHub - Homebrew/brew: 🍺 The missing package manager for macOS (or Linux).

1 Like

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.

1 Like

Thanks for your comments.

Do you mean

brew link --overwrite gcc

?

Yes, that command.

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:

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?

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.

Won’t work since brew forbid running as root…

$ 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

FYI we just pushed a fix:

Thanks for your help!

1 Like

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 and you may solve it using

brew uninstall oclint

after updating homebrew.

1 Like

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

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

1 Like