From 31d16f02761c05f3159813be269e50c0c42000d4 Mon Sep 17 00:00:00 2001 From: Duane Griffin Date: Fri, 30 May 2025 11:15:45 +1200 Subject: [PATCH] gh-117888: print failing command when platform triplet detection errors The build system determines the platform triplet using the C preprocessor. If that fails for whatever reason we presently just report "none" for the triplet and continue until the invalid triplet causes a messy failure down the line. Instead, store any error output, and in the event of a failure send it to stderr and fail immediately with a clear error message. --- .../Build/2025-05-30-11-19-19.gh-issue-117888.-4okIx.rst | 1 + configure | 6 +++--- configure.ac | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2025-05-30-11-19-19.gh-issue-117888.-4okIx.rst diff --git a/Misc/NEWS.d/next/Build/2025-05-30-11-19-19.gh-issue-117888.-4okIx.rst b/Misc/NEWS.d/next/Build/2025-05-30-11-19-19.gh-issue-117888.-4okIx.rst new file mode 100644 index 00000000000000..1fd1af6b654ea1 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-05-30-11-19-19.gh-issue-117888.-4okIx.rst @@ -0,0 +1 @@ +Report error if platform triplet detection fails. diff --git a/configure b/configure index c9ce9b4a73527d..b4e36d1b1af040 100755 --- a/configure +++ b/configure @@ -7161,14 +7161,14 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5 printf %s "checking for the platform triplet based on compiler characteristics... " >&6; } -if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then +if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>conftest.err; then PLATFORM_TRIPLET=`grep '^PLATFORM_TRIPLET=' conftest.out | tr -d ' '` PLATFORM_TRIPLET="${PLATFORM_TRIPLET#PLATFORM_TRIPLET=}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PLATFORM_TRIPLET" >&5 printf "%s\n" "$PLATFORM_TRIPLET" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 -printf "%s\n" "none" >&6; } + cat conftest.err >&2 + as_fn_error $? "platform triplet detection failed, see error output above" "$LINENO" 5 fi rm -f conftest.out diff --git a/configure.ac b/configure.ac index eb52365d95be21..22e10b5e8d4fd2 100644 --- a/configure.ac +++ b/configure.ac @@ -1151,12 +1151,13 @@ fi AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) -if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then +if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>conftest.err; then PLATFORM_TRIPLET=`grep '^PLATFORM_TRIPLET=' conftest.out | tr -d ' '` PLATFORM_TRIPLET="${PLATFORM_TRIPLET@%:@PLATFORM_TRIPLET=}" AC_MSG_RESULT([$PLATFORM_TRIPLET]) else - AC_MSG_RESULT([none]) + cat conftest.err >&2 + AC_MSG_ERROR([platform triplet detection failed, see error output above]) fi rm -f conftest.out