improve error when /usr/include isn't found [PR90835]

Message ID 20230817185942.93988-1-egallager@gcc.gnu.org
State Accepted
Headers
Series improve error when /usr/include isn't found [PR90835] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Eric Gallager Aug. 17, 2023, 6:59 p.m. UTC
  This is a pretty simple patch that ought to help Darwin users understand
better why their build is failing when they forget to pass the
--with-sysroot= flag to configure.

gcc/ChangeLog:

        PR target/90835
        * Makefile.in: improve error message when /usr/include is
        missing
---
 gcc/Makefile.in | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Jeff Law Aug. 19, 2023, 8:11 p.m. UTC | #1
On 8/17/23 12:59, Eric Gallager via Gcc-patches wrote:
> Subject:
> [PATCH] improve error when /usr/include isn't found [PR90835]
> From:
> Eric Gallager via Gcc-patches <gcc-patches@gcc.gnu.org>
> Date:
> 8/17/23, 12:59
> 
> To:
> gcc-patches@gcc.gnu.org
> CC:
> iains@gcc.gnu.org, Eric Gallager <egallager@gcc.gnu.org>
> 
> 
> This is a pretty simple patch that ought to help Darwin users understand
> better why their build is failing when they forget to pass the
> --with-sysroot= flag to configure.
> 
> gcc/ChangeLog:
> 
>          PR target/90835
>          * Makefile.in: improve error message when /usr/include is
>          missing
OK.
jeff
  
Eric Gallager Aug. 20, 2023, 3:59 a.m. UTC | #2
Thanks, I committed the version with Iain's suggested change in wording:
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627796.html
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9a5d1fceb86a61c9ead380df89ce3c4ba387d2e5
(sorry that this got sent multiple times; I thought the email hadn't
gone through properly...)

On Sat, Aug 19, 2023 at 4:11 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 8/17/23 12:59, Eric Gallager via Gcc-patches wrote:
> > Subject:
> > [PATCH] improve error when /usr/include isn't found [PR90835]
> > From:
> > Eric Gallager via Gcc-patches <gcc-patches@gcc.gnu.org>
> > Date:
> > 8/17/23, 12:59
> >
> > To:
> > gcc-patches@gcc.gnu.org
> > CC:
> > iains@gcc.gnu.org, Eric Gallager <egallager@gcc.gnu.org>
> >
> >
> > This is a pretty simple patch that ought to help Darwin users understand
> > better why their build is failing when they forget to pass the
> > --with-sysroot= flag to configure.
> >
> > gcc/ChangeLog:
> >
> >          PR target/90835
> >          * Makefile.in: improve error message when /usr/include is
> >          missing
> OK.
> jeff
  

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 97e5450ecb5..535c475dfab 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -55,6 +55,7 @@  MAKEOVERRIDES =
 # -------------------------------
 
 build=@build@
+build_os=@build_os@
 host=@host@
 host_noncanonical=@host_noncanonical@
 host_os=@host_os@
@@ -3240,8 +3241,13 @@  stmp-fixinc: gsyslimits.h macro_list fixinc_list \
 	    multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
 	    fix_dir=include-fixed$${multi_dir}; \
 	    if ! $(inhibit_libc) && test ! -d ${BUILD_SYSTEM_HEADER_DIR}; then \
-	      echo The directory that should contain system headers does not exist: >&2 ; \
+	      echo "The directory (BUILD_SYSTEM_HEADER_DIR) that should contain system headers does not exist:" >&2 ; \
 	      echo "  ${BUILD_SYSTEM_HEADER_DIR}" >&2 ; \
+	      case ${build_os} in \
+	        darwin*) \
+	          echo "(on darwin this usually means you need to pass the --with-sysroot flag to configure to point it to where the system headers are actually put)" >&2; \
+	          ;; \
+	      esac; \
 	      tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \
 	      if test "x${BUILD_SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \
 	      then sleep 1; else exit 1; fi; \