From 84a33e8892ca58b00374797aba99404e20210952 Mon Sep 17 00:00:00 2001 From: Antti Kantee Date: Mon, 8 Feb 2016 12:40:57 +0000 Subject: [PATCH] build-rr: check cc/ld versions Issue a warning or error for old or prehistoric tools, respectively. XXX: not sure how the ld check will work with GNU gold. We'll see. Issue reported by a number of users recently, including in issue #69. --- build-rr.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/build-rr.sh b/build-rr.sh index 62a3b8a..24d4e8a 100755 --- a/build-rr.sh +++ b/build-rr.sh @@ -299,13 +299,51 @@ setvars () abspath RUMPSRC } -buildrump () +checktools () { # Check that a clang build is not attempted. [ -z "${BUILDRUMP_HAVE_LLVM}" ] \ || die rumprun does not yet support clang ${CC:+(\$CC: $CC)} + delay=5 + + # check that gcc is modern enough + vers=$(${CC:-cc} -E -dM - < /dev/null | awk ' + /__GNUC__/ {version += 100*$3} + /__GNUC_MINOR__/ {version += $3} + END { print version; if (version) exit 0; exit 1; }') + if [ ${vers} -lt 406 ]; then + die gcc is too old, need 4.6 or later. ${CC:+(\$CC: $CC)} + elif [ ${vers} -lt 408 ]; then + echo '>>' + echo ">> WARNING: gcc is old. ${CC:+(\$CC: $CC)}" + echo '>> Version 4.8 or later is recommended.' + echo ">> (continuing in ${delay} seconds)" + echo '>>' + sleep ${delay} + fi + + # check that ld is modern enough + vers=$(${CC:-cc} -Wl,--version 2>&1 | awk ' + /GNU ld.*Binutils/{version += 100*$NF} + END { print version; if (version) exit 0; exit 1; }') + if [ ${vers} -lt 223 ]; then + die ld is too old, need 2.23 or later. + elif [ ${vers} -lt 225 ]; then + echo '>>' + echo ">> WARNING: ld is old." + echo '>> Version 2.25 or later is recommended.' + echo ">> (continuing in ${delay} seconds)" + echo '>>' + sleep ${delay} + fi +} + +buildrump () +{ + + checktools checkprevbuilds extracflags= -- 2.39.5