From 8d8ac637eee69aac0c4037661d7f53c5430cd2ca Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 13 Jun 2011 15:28:54 -0400 Subject: [PATCH] build: stop early if commands are missing If we fail due to a missing command (always bison) during the build, it is running many things in parallel and the error message gets lost in the noise. Also diagnose bison++. $ ./make.bash Your system's bison is bison++, a buggy copy of the original bison. Go needs the original bison instead. See http://golang.org/doc/install.html#ctools $ sudo apt-get remove bison++ ... ridiculous amount of output ... $ ./make.bash Cannot find 'bison' on search path. See http://golang.org/doc/install.html#ctools $ sudo apt-get install bison ... ridiculous amount of output ... $ ./make.bash ... works Fixes #1938. Fixes #1946. R=bradfitz CC=golang-dev https://golang.org/cl/4528137 --- src/env.bash | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/env.bash b/src/env.bash index ca3ecebe87..19402f3060 100644 --- a/src/env.bash +++ b/src/env.bash @@ -39,13 +39,56 @@ if [ ! -d "$GOBIN" -a "$GOBIN" != "$GOROOT/bin" ]; then fi export OLDPATH=$PATH -export PATH="$GOBIN":/bin:/usr/bin:$PATH +export PATH="$GOBIN":$PATH MAKE=make if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then MAKE=gmake fi +PROGS=" + ar + awk + bash + bison + chmod + cp + cut + echo + ed + egrep + gcc + grep + ls + mkdir + mv + pwd + rm + sed + sort + tee + touch + tr + true + uname + uniq +" + +for i in bison ed awk gcc $MAKE; do + if ! which $i >/dev/null 2>&1; then + echo "Cannot find '$i' on search path." 1>&2 + echo "See http://golang.org/doc/install.html#ctools" 1>&2 + exit 1 + fi +done + +if bison --version 2>&1 | grep 'bison++' >/dev/null 2>&1; then + echo "Your system's 'bison' is bison++." + echo "Go needs the original bison instead." 1>&2 + echo "See http://golang.org/doc/install.html#ctools" 1>&2 + exit 1 +fi + # Tried to use . <($MAKE ...) here, but it cannot set environment # variables in the version of bash that ships with OS X. Amazing. eval $($MAKE --no-print-directory -f Make.inc go-env | egrep 'GOARCH|GOOS|GOHOSTARCH|GOHOSTOS|GO_ENV') -- 2.50.0