Use gccgo to bootstrap go on aarch64 (#30350)
The go-bootstrap package doesn't work on aarch64 platforms, so the only way to build Go is to use gccgo. Also, some versions of gccgo have a bug that prevents them from compiling go (see golang/go#47771), so this patch limits gcc to versions newer than 10.4.0 or 11.3.0. Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
parent
dc99fe98b9
commit
9486c76d70
@ -36,8 +36,8 @@ class GoBootstrap(Package):
|
|||||||
depends_on('git', type=('build', 'link', 'run'))
|
depends_on('git', type=('build', 'link', 'run'))
|
||||||
|
|
||||||
conflicts('os=monterey', msg="go-bootstrap won't build on new macOS")
|
conflicts('os=monterey', msg="go-bootstrap won't build on new macOS")
|
||||||
conflicts('target=aarch64:', when='platform=darwin',
|
conflicts('target=aarch64:',
|
||||||
msg='Go bootstrap is too old for Apple Silicon')
|
msg="Go bootstrap doesn't support aarch64 architectures")
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
if self.spec.satisfies('@:1.4.3'):
|
if self.spec.satisfies('@:1.4.3'):
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
@ -130,7 +131,20 @@ class Go(Package):
|
|||||||
provides('golang')
|
provides('golang')
|
||||||
|
|
||||||
depends_on('git', type=('build', 'link', 'run'))
|
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
|
# https://github.com/golang/go/issues/17545
|
||||||
patch('time_test.patch', when='@1.6.4:1.7.4')
|
patch('time_test.patch', when='@1.6.4:1.7.4')
|
||||||
|
Loading…
Reference in New Issue
Block a user