ci: build Git with GCC 9 in the 'osx-gcc' build job
diff mbox series

Message ID
State New, archived
Headers show
  • ci: build Git with GCC 9 in the 'osx-gcc' build job
Related show

Commit Message

SZEDER Gábor Nov. 27, 2019, 4:24 p.m. UTC
Our 'osx-gcc' build job on Travis CI relied on GCC 8 being installed
(but not linked) in the image we use [1].  Alas, since the last update
of this image a few days ago this is not the case anymore, and now it
contains GCC 9 (installed and linked) instead of GCC 8.  The results
are failed 'osx-gcc' jobs, because they can't find the 'gcc-8' command

Let's move on to use GCC 9, with hopefully better error reporting and
improved -Wfoo flags and what not.  On Travis CI this has the benefit
that we can spare a few seconds while installing dependencies, because
it already comes pre-installed, at least for now.  The Azure Pipelines
OSX image doesn't include GCC, so we have to install it ourselves
anyway, and then we might as well install the newer version.

In a vain attempt I tried to future-proof this a bit:

  - Install 'gcc@9' specifically, so we'll still get what we want even
    after GCC 10 comes out, and the "plain" 'gcc' package starts to
    refer to 'gcc@10'.

  - Run both 'brew install gcc@9' and 'brew link gcc@9'.  If 'gcc@9'
    is already installed and linked, then both commands are noop and
    exit with success.  But as we saw in the past, sometimes the image
    contains the expected GCC package installed but not linked, so
    maybe it will happen again in the future as well.  In that case
    'brew install' is still a noop, and instructs the user to run
    'brew link' instead, so that's what we'll do.  And if 'gcc@9' is
    not installed, then 'brew install' will install it, and the
    subsequent 'brew link' becomes a noop.

An additional benefit of this patch is that from now on we won't
unnecessarily install GCC and its dependencies in the 'osx-clang' jobs
on Azure Pipelines.

[1] 7d4733c501 (ci: fix GCC install in the Travis CI GCC OSX job,

Signed-off-by: SZEDER Gábor <>

On Mon, Nov 25, 2019 at 05:15:36PM -0800, Denton Liu wrote:
> It seems like gcc-8 doesn't exist anymore in our gcc OS X Travis job. As
> a result, that job has been failing consistently recently[1].
> An old similar thread here[2]. Not sure if the failure is related.

> [2]:

It's funny how merely two days after we talked about how/when Travis
CI images are updated, we got yet another update, which broke our
builds again... Oh, well.

 ci/ | 6 ++++--
 ci/                  | 3 +--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff mbox series

diff --git a/ci/ b/ci/
index 4e64a19112..93e3bba434 100755
--- a/ci/
+++ b/ci/
@@ -48,8 +48,10 @@  osx-clang|osx-gcc)
 	brew install caskroom/cask/perforce
 	case "$jobname" in
-		brew link gcc ||
-		brew link gcc@8
+		brew install gcc@9
+		# Just in case the image is updated to contain gcc@9
+		# pre-installed but not linked.
+		brew link gcc@9
diff --git a/ci/ b/ci/
index c8c2c38155..10b97c05ad 100755
--- a/ci/
+++ b/ci/
@@ -131,7 +131,6 @@  then
 	export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
 	export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
@@ -182,7 +181,7 @@  linux-clang|linux-gcc)
 	if [ "$jobname" = osx-gcc ]
-		export CC=gcc-8
+		export CC=gcc-9
 	# t9810 occasionally fails on Travis CI OS X