public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] improve error for when /usr/include isn't found [PR90835]
@ 2023-08-17 19:35 Eric Gallager
  2023-08-17 19:58 ` Iain Sandoe
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Gallager @ 2023-08-17 19:35 UTC (permalink / raw)
  To: gcc-patches, iains

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

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

[-- Attachment #2: 0001-improve-error-for-when-usr-include-isn-t-found.patch --]
[-- Type: application/octet-stream, Size: 1624 bytes --]

From 0f86c32611a55b15668aa82306d2d17a9b395432 Mon Sep 17 00:00:00 2001
From: Eric Gallager <egallager@gcc.gnu.org>
Date: Wed, 25 May 2022 12:45:33 -0400
Subject: [PATCH] improve error for when /usr/include isn't found

addresses PR90835
---
 gcc/Makefile.in | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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; \
-- 
2.32.0 (Apple Git-132)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] improve error for when /usr/include isn't found [PR90835]
  2023-08-17 19:35 [PATCH] improve error for when /usr/include isn't found [PR90835] Eric Gallager
@ 2023-08-17 19:58 ` Iain Sandoe
  2023-08-18  3:38   ` Eric Gallager
  0 siblings, 1 reply; 4+ messages in thread
From: Iain Sandoe @ 2023-08-17 19:58 UTC (permalink / raw)
  To: Eric Gallager; +Cc: GCC Patches

Hi Eric,

thanks for working on this.

> On 17 Aug 2023, at 20:35, Eric Gallager <egall@gwmail.gwu.edu> wrote:
> 
> 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

1. the main issue with this approach is that the error does not happen until after the
   user has waited for the whole of the stage 1 build.

   (I had in mind the idea that top level configure can identify that the platform
    is Darwin, and that there is no sysroot configured; 
     then [for bootstrap] complain if there is no /use/include
     els [for non-bootstrap] complain always)

- this would mean that the fail occurs at initial configure time.

2. if we went with this patch as an incremental improvement:

+	      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; \

I think we need to put this in terms that relate to the system and things the user can find, so ;
“on Darwin this usually means you need to pass the --with-sysroot= flag to point to a valid MacOS SDK”

(In practice, the headers cause the first fail, but we also need to find the libraries when linking)

Iain




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] improve error for when /usr/include isn't found [PR90835]
  2023-08-17 19:58 ` Iain Sandoe
@ 2023-08-18  3:38   ` Eric Gallager
  2023-08-20  4:01     ` Eric Gallager
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Gallager @ 2023-08-18  3:38 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Patches

On Thu, Aug 17, 2023 at 4:05 PM Iain Sandoe <iain@sandoe.co.uk> wrote:
>
> Hi Eric,
>
> thanks for working on this.
>
> > On 17 Aug 2023, at 20:35, Eric Gallager <egall@gwmail.gwu.edu> wrote:
> >
> > 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
>
> 1. the main issue with this approach is that the error does not happen until after the
>    user has waited for the whole of the stage 1 build.
>
>    (I had in mind the idea that top level configure can identify that the platform
>     is Darwin, and that there is no sysroot configured;
>      then [for bootstrap] complain if there is no /use/include
>      els [for non-bootstrap] complain always)
>
> - this would mean that the fail occurs at initial configure time.
>
> 2. if we went with this patch as an incremental improvement:
>
> +             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; \
>
> I think we need to put this in terms that relate to the system and things the user can find, so ;
> “on Darwin this usually means you need to pass the --with-sysroot= flag to point to a valid MacOS SDK”
>

OK, so would it be ok with that change in wording?

> (In practice, the headers cause the first fail, but we also need to find the libraries when linking)
>
> Iain
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] improve error for when /usr/include isn't found [PR90835]
  2023-08-18  3:38   ` Eric Gallager
@ 2023-08-20  4:01     ` Eric Gallager
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Gallager @ 2023-08-20  4:01 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Patches

On Thu, Aug 17, 2023 at 11:38 PM Eric Gallager <egall@gwmail.gwu.edu> wrote:
>
> On Thu, Aug 17, 2023 at 4:05 PM Iain Sandoe <iain@sandoe.co.uk> wrote:
> >
> > Hi Eric,
> >
> > thanks for working on this.
> >
> > > On 17 Aug 2023, at 20:35, Eric Gallager <egall@gwmail.gwu.edu> wrote:
> > >
> > > 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
> >
> > 1. the main issue with this approach is that the error does not happen until after the
> >    user has waited for the whole of the stage 1 build.
> >
> >    (I had in mind the idea that top level configure can identify that the platform
> >     is Darwin, and that there is no sysroot configured;
> >      then [for bootstrap] complain if there is no /use/include
> >      els [for non-bootstrap] complain always)
> >
> > - this would mean that the fail occurs at initial configure time.
> >
> > 2. if we went with this patch as an incremental improvement:
> >
> > +             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; \
> >
> > I think we need to put this in terms that relate to the system and things the user can find, so ;
> > “on Darwin this usually means you need to pass the --with-sysroot= flag to point to a valid MacOS SDK”
> >
>
> OK, so would it be ok with that change in wording?
>
> > (In practice, the headers cause the first fail, but we also need to find the libraries when linking)
> >
> > Iain
> >

Committed with your proposed change in wording as
r14-3335-g9a5d1fceb86a61:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9a5d1fceb86a61c9ead380df89ce3c4ba387d2e5
(Jeff approved in reply to one of the other copies)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-20  4:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17 19:35 [PATCH] improve error for when /usr/include isn't found [PR90835] Eric Gallager
2023-08-17 19:58 ` Iain Sandoe
2023-08-18  3:38   ` Eric Gallager
2023-08-20  4:01     ` Eric Gallager

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).