diff -r 1c68438f44f7 -r fe774e44305a scripts/crosstool-NG.sh.in
--- a/scripts/crosstool-NG.sh.in	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/crosstool-NG.sh.in	Mon Nov 19 14:31:05 2012 -0800
@@ -422,8 +422,7 @@
                 where=$(CT_Which "${tool}")
             fi
 
-            # Not all tools are available for all platforms, but some are really,
-            # bally needed
+            # Not all tools are available for all platforms, but some are required.
             if [ -n "${where}" ]; then
                 CT_DoLog DEBUG "  '${!v}-${tool}' -> '${where}'"
                 printf "#${BANG}${CT_CONFIG_SHELL}\nexec '${where}' \"\${@}\"\n" >"${CT_BUILDTOOLS_PREFIX_DIR}/bin/${!v}-${tool}"
@@ -475,17 +474,60 @@
         *)  ;;
     esac
 
+    # Now that we've set up $PATH, sanity test that GCC is runnable so that
+    # the user can troubleshoot problems if not.
+    CT_DoLog DEBUG "Sanity testing gcc"
+    gccout="${CT_BUILD_DIR}/.gcc-output"
+    GCC=${CT_HOST}-gcc
+    ret=0
+    ${GCC} -v > $gccout 2>&1 || ret=$?
+    if [ $ret != 0 ]; then
+        CT_DoLog DEBUG "Failed to invoke '${GCC} -v' (exited ${ret}): Output Follows:"
+        CT_DoLog DEBUG "$(cat ${gccout})"
+    fi
+    case $ret in
+	0)
+		;;
+	126)
+        	CT_Abort "${GCC}: cannot execute; check permissions."
+                ;;
+	127)
+        	CT_Abort "${GCC}: not found in PATH; check for metacharacters or other problems in PATH (PATH=${PATH})"
+                ;;
+	*)
+        	CT_Abort "Ran '${GCC} -v', but command failed with exit ${ret}"
+                ;;
+    esac
+    rm -f "${gccout}"
+
+    CT_DoLog DEBUG "Testing that gcc can compile a trivial program"
+    tmp="${CT_BUILD_DIR}/.gcc-test"
+    # Try a trivial program to ensure the compiler works.
+    if ! "${CT_HOST}-gcc" -xc - -o "${tmp}"  > ${gccout} 2>&1 <<-_EOF_
+				int main() {return 0; }
+			_EOF_
+    then
+        CT_DoLog DEBUG "'${GCC}' failed (exited ${ret}): Output Follows:"
+        CT_DoLog DEBUG "$(cat ${gccout})"
+        CT_Abort "Couldn't compile a trivial program using ${CT_HOST}-gcc"
+    fi
+    rm -f "${tmp}" "${gccout}"
+
     # Now we know our host and where to find the host tools, we can check
     # if static link was requested, but only if it was requested
     if [ "${CT_WANTS_STATIC_LINK}" = "y" ]; then
         tmp="${CT_BUILD_DIR}/.static-test"
-        if ! "${CT_HOST}-gcc" -xc - -static -o "${tmp}" >/dev/null 2>&1 <<-_EOF_
+
+        CT_DoLog DEBUG "Testing that gcc can compile a trivial statically linked program"
+        if ! "${CT_HOST}-gcc" -xc - -static -o "${tmp}" > ${gccout} 2>&1 <<-_EOF_
 				int main() { return 0; }
 			_EOF_
         then
-            CT_Abort "Static linking impossible on the host system '${CT_HOST}'"
+            CT_DoLog DEBUG "'${GCC}' failed (exited ${ret}): Output Follows:"
+            CT_DoLog DEBUG "$(cat ${gccout})"
+            CT_Abort "Static linking impossible on the host system '${CT_HOST}'; is libc.a installed?"
         fi
-        rm -f "${tmp}"
+        rm -f "${tmp}" "${gccout}"
     fi
 
     # Help gcc
