summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2021-10-04 13:24:57 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2021-10-04 18:30:19 -0700
commit84c878b66ac59c34b5df3c14a756419341c143e8 (patch)
tree845a7a98a5b72c8519f3ed9a979afe2bbf98cc18 /lib
parent052b2e1b08d54374694abca2321c789a98101243 (diff)
downloadspack-84c878b66ac59c34b5df3c14a756419341c143e8.tar.gz
spack-84c878b66ac59c34b5df3c14a756419341c143e8.tar.bz2
spack-84c878b66ac59c34b5df3c14a756419341c143e8.tar.xz
spack-84c878b66ac59c34b5df3c14a756419341c143e8.zip
cc: make error messages more clear
- [x] Our wrapper error messages are sometimes hard to differentiate from other build output, so prefix all errors from `die()` with '[spack cc] ERROR:' - [x] The error we raise when running, say, `fc` without a Fortran compiler was not clear enough. Clarify the message and the comment.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/spack/env/cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 4bef0ddf9e..c498db0583 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -70,7 +70,7 @@ SPACK_SYSTEM_DIRS"
# die MESSAGE
# Print a message and exit with error code 1.
die() {
- echo "$@"
+ echo "[spack cc] ERROR: $*"
exit 1
}
@@ -191,7 +191,7 @@ system_dir() {
# Fail with a clear message if the input contains any bell characters.
if eval "[ \"\${*#*${lsep}}\" != \"\$*\" ]"; then
- die "ERROR: Compiler command line contains our separator ('${lsep}'). Cannot parse."
+ die "Compiler command line contains our separator ('${lsep}'). Cannot parse."
fi
# ensure required variables are set
@@ -337,10 +337,11 @@ if [ "$SPACK_TEST_COMMAND" = "dump-mode" ]; then
exit
fi
-# Check that at least one of the real commands was actually selected,
-# otherwise we don't know what to execute.
+# If, say, SPACK_CC is set but SPACK_FC is not, we want to know. Compilers do not
+# *have* to set up Fortran executables, so we need to tell the user when a build is
+# about to attempt to use them unsuccessfully.
if [ -z "$command" ]; then
- die "ERROR: Compiler '$SPACK_COMPILER_SPEC' does not support compiling $language programs."
+ die "Compiler '$SPACK_COMPILER_SPEC' does not have a $language compiler configured."
fi
#
@@ -755,7 +756,7 @@ if [ -n "${SPACK_TEST_COMMAND=}" ]; then
eval "printf '%s\n' \"\$0: \$var: \$$var\""
;;
*)
- die "ERROR: Unknown test command: '$SPACK_TEST_COMMAND'"
+ die "Unknown test command: '$SPACK_TEST_COMMAND'"
;;
esac
fi