summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/go-bootstrap/package.py4
-rw-r--r--var/spack/repos/builtin/packages/go/package.py16
2 files changed, 17 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/go-bootstrap/package.py b/var/spack/repos/builtin/packages/go-bootstrap/package.py
index 2549d526a0..ec10c89ee5 100644
--- a/var/spack/repos/builtin/packages/go-bootstrap/package.py
+++ b/var/spack/repos/builtin/packages/go-bootstrap/package.py
@@ -36,8 +36,8 @@ class GoBootstrap(Package):
depends_on('git', type=('build', 'link', 'run'))
conflicts('os=monterey', msg="go-bootstrap won't build on new macOS")
- conflicts('target=aarch64:', when='platform=darwin',
- msg='Go bootstrap is too old for Apple Silicon')
+ conflicts('target=aarch64:',
+ msg="Go bootstrap doesn't support aarch64 architectures")
def patch(self):
if self.spec.satisfies('@:1.4.3'):
diff --git a/var/spack/repos/builtin/packages/go/package.py b/var/spack/repos/builtin/packages/go/package.py
index 125355e81b..f7c0fc1f41 100644
--- a/var/spack/repos/builtin/packages/go/package.py
+++ b/var/spack/repos/builtin/packages/go/package.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
+import platform
import re
import llnl.util.tty as tty
@@ -130,7 +131,20 @@ class Go(Package):
provides('golang')
depends_on('git', type=('build', 'link', 'run'))
- depends_on('go-bootstrap', type='build')
+
+ # aarch64 machines (including Macs with Apple silicon) can't use
+ # go-bootstrap because it pre-dates aarch64 support in Go. These machines
+ # have to rely on Go support in gcc (which may require compiling a version
+ # of gcc with Go support just to satisfy this requirement). However,
+ # there's also a bug in some versions of GCC's Go front-end that prevents
+ # these versions from properly bootstrapping Go. (See issue #47771
+ # https://github.com/golang/go/issues/47771 ) On the 10.x branch, we need
+ # at least 10.4. On the 11.x branch, we need at least 11.3.
+
+ if platform.machine() == 'aarch64':
+ depends_on('gcc@10.4.0:10,11.3.0: languages=go', type='build')
+ else:
+ depends_on('go-bootstrap', type='build')
# https://github.com/golang/go/issues/17545
patch('time_test.patch', when='@1.6.4:1.7.4')