Skip to contentSkip to conversation

configure: Diagnose broken linkers directly

PATCH Applied Peter Maydell 2 participants 2 messages Nov 24, 2015 – Nov 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Diagnose broken linkers directly

Currently if the user's compiler works for creating .o files but their linker is broken such that compiling an executable from a C file does not work, we will report a misleading error message about the compiler not supporting __thread (since that happens to be the first test we run which requires a working linker). Explicitly check that compile_prog works as well as compile_object, so that people whose toolchain setup is broken get a more helpful error message.

---
 configure | 3 +++
 1 file changed, 3 insertions(+)
configure +3 -0
index 71d6cbc..21a8536 100755
@@ -1426,6 +1426,9 @@ if compile_object ; then
 else
     error_exit "\"$cc\" either does not exist or does not work"
 fi
+if ! compile_prog ; then
+    error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
+fi
 
 # Check that the C++ compiler exists and works with the C compiler
 if has $cxx; then
Signature · 1 line
1.9.1
#1 lore raw
Quoted 8 lines · Peter Maydell

Currently if the user's compiler works for creating .o files but their linker is broken such that compiling an executable from a C file does not work, we will report a misleading error message about the compiler not supporting __thread (since that happens to be the first test we run which requires a working linker). Explicitly check that compile_prog works as well as compile_object, so that people whose toolchain setup is broken get a more helpful error message.

Applied to -trivial, thanks!

/mjt