public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error
@ 2024-06-10 15:07 marcuscalhounlopez at gmail dot com
  2024-06-10 15:36 ` [Bug bootstrap/115416] " sjames at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: marcuscalhounlopez at gmail dot com @ 2024-06-10 15:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

            Bug ID: 115416
           Summary: Setting --includedir to a nonexistent directory causes
                    a build error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcuscalhounlopez at gmail dot com
  Target Milestone: ---

A change made earlier this year[1] is causing troubles on the MacPorts build of
GCC.
MacPorts sets `--includedir=` to a directory that does not exist until after
the build is complete.
Since  `@includedir@` is not `$(prefix)/include` and `$(prefix)/include` does
not exist during the build, the Makefile exits[2].

[1] https://gcc.gnu.org/g:59e4c98173a79fcaa2c33253261409f38856c384
[2]
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/Makefile.in;h=6001c9e3b559a90291b4d571c2410db6da4ede94;hb=59e4c98173a79fcaa2c33253261409f38856c384#l3273

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

* [Bug bootstrap/115416] Setting --includedir to a nonexistent directory causes a build error
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
@ 2024-06-10 15:36 ` sjames at gcc dot gnu.org
  2024-06-10 15:39 ` [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f sjames at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-06-10 15:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjames at gcc dot gnu.org,
                   |                            |syq at gcc dot gnu.org

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
I think we've hit this too in Gentoo but I hadn't reported it yet as I hadn't
investigated, so I just worked around it.

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
  2024-06-10 15:36 ` [Bug bootstrap/115416] " sjames at gcc dot gnu.org
@ 2024-06-10 15:39 ` sjames at gcc dot gnu.org
  2024-06-10 16:09 ` syq at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-06-10 15:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           See Also|                            |https://bugs.gentoo.org/sho
                   |                            |w_bug.cgi?id=905118,
                   |                            |https://bugs.gentoo.org/sho
                   |                            |w_bug.cgi?id=925204,
                   |                            |https://bugs.gentoo.org/sho
                   |                            |w_bug.cgi?id=926059
   Last reconfirmed|                            |2024-06-10
     Ever confirmed|0                           |1

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
  2024-06-10 15:36 ` [Bug bootstrap/115416] " sjames at gcc dot gnu.org
  2024-06-10 15:39 ` [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f sjames at gcc dot gnu.org
@ 2024-06-10 16:09 ` syq at gcc dot gnu.org
  2024-06-10 17:01 ` syq at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: syq at gcc dot gnu.org @ 2024-06-10 16:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

--- Comment #2 from YunQiang Su <syq at gcc dot gnu.org> ---
Can you give me the configure command, so that I can have a test.

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-10 16:09 ` syq at gcc dot gnu.org
@ 2024-06-10 17:01 ` syq at gcc dot gnu.org
  2024-06-10 17:27 ` marcuscalhounlopez at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: syq at gcc dot gnu.org @ 2024-06-10 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

--- Comment #3 from YunQiang Su <syq at gcc dot gnu.org> ---
Since it doesn't exist, why use --includedir with it?
Anyway, so, maybe we should detect the existence of this dir.
Can you have a try of this patch?

--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -560,10 +560,11 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
 # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
 NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
 # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
-ifeq (@includedir@,$(prefix)/include)
-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
-else
-  CROSS_SYSTEM_HEADER_DIR = @includedir@
+CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ifneq (@includedir@,$(prefix)/include)
+  ifneq (,$(wildcard @includedir@))
+    CROSS_SYSTEM_HEADER_DIR = @includedir@
+  endif
 endif

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
                   ` (3 preceding siblings ...)
  2024-06-10 17:01 ` syq at gcc dot gnu.org
@ 2024-06-10 17:27 ` marcuscalhounlopez at gmail dot com
  2024-06-10 17:32 ` marcuscalhounlopez at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marcuscalhounlopez at gmail dot com @ 2024-06-10 17:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

--- Comment #4 from Marcus Calhoun-Lopez <marcuscalhounlopez at gmail dot com> ---
(In reply to YunQiang Su from comment #2)
> Can you give me the configure command, so that I can have a test.

The pertinent part of the configure command is
`configure --prefix=/opt/local --includedir=/opt/local/include/gcc
--libdir=/opt/local/lib/libgcc`

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
                   ` (4 preceding siblings ...)
  2024-06-10 17:27 ` marcuscalhounlopez at gmail dot com
@ 2024-06-10 17:32 ` marcuscalhounlopez at gmail dot com
  2024-06-10 17:41 ` syq at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marcuscalhounlopez at gmail dot com @ 2024-06-10 17:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

--- Comment #5 from Marcus Calhoun-Lopez <marcuscalhounlopez at gmail dot com> ---
(In reply to YunQiang Su from comment #3)
> Since it doesn't exist, why use --includedir with it?

/opt/local/include/gcc is where the header files will be installed after the
build, so there is no reason for it to exist before the build.

> Anyway, so, maybe we should detect the existence of this dir.
> Can you have a try of this patch?
> 
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -560,10 +560,11 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
>  # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
>  NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
>  # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
> -ifeq (@includedir@,$(prefix)/include)
> -  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
> -else
> -  CROSS_SYSTEM_HEADER_DIR = @includedir@
> +CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
> +ifneq (@includedir@,$(prefix)/include)
> +  ifneq (,$(wildcard @includedir@))
> +    CROSS_SYSTEM_HEADER_DIR = @includedir@
> +  endif
>  endif

Yes, this seems to work.
Thank you very much.

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
                   ` (5 preceding siblings ...)
  2024-06-10 17:32 ` marcuscalhounlopez at gmail dot com
@ 2024-06-10 17:41 ` syq at gcc dot gnu.org
  2024-06-11  9:10 ` syq at gcc dot gnu.org
  2024-06-11  9:35 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: syq at gcc dot gnu.org @ 2024-06-10 17:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

--- Comment #6 from YunQiang Su <syq at gcc dot gnu.org> ---
(In reply to Marcus Calhoun-Lopez from comment #5)
> (In reply to YunQiang Su from comment #3)
> > Since it doesn't exist, why use --includedir with it?
> 
> /opt/local/include/gcc is where the header files will be installed after the
> build, so there is no reason for it to exist before the build.
> 

Normally, we build gcc for 1st stage with/without --includedir, 
and then build libc with 1st stage gcc, and install the libc into the
destination.
Then we build gcc stage2 with --includedir.


Ohh, in fact that I am worrying that both you and I have a mistake: the
--includedir may be used for host instead of target.

Should we introduce a new build-time option?

Background: I add this patch due to Debian's cross toolchain install headers
into /usr/<triple>/include
instead of /usr/<triple>/sys-include

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
                   ` (6 preceding siblings ...)
  2024-06-10 17:41 ` syq at gcc dot gnu.org
@ 2024-06-11  9:10 ` syq at gcc dot gnu.org
  2024-06-11  9:35 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: syq at gcc dot gnu.org @ 2024-06-11  9:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

--- Comment #7 from YunQiang Su <syq at gcc dot gnu.org> ---
Maybe this patch is better

--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -560,11 +560,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
 # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
 NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
 # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
-ifeq (@includedir@,$(prefix)/include)
-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
-else
-  CROSS_SYSTEM_HEADER_DIR = @includedir@
-endif
+CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@

 # autoconf sets SYSTEM_HEADER_DIR to one of the above.
 # Purge it of unnecessary internal relative paths
@@ -581,7 +577,10 @@ BUILD_SYSTEM_HEADER_DIR = `echo @BUILD_SYSTEM_HEADER_DIR@
| sed -e :a -e 's,[^/]
 STMP_FIXINC = @STMP_FIXINC@

 # Test to see whether <limits.h> exists in the system header files.
-LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ]
+LIMITS_H_TEST = headdir=$(BUILD_SYSTEM_HEADER_DIR) && \
+               headdir_sys=`echo $$headdir | grep '/sys-include$$'` && \
+               headdir_nosys=`echo $$headdir | sed 's/sys-include/include/'`
&& \
+               [ -f $$headdir/limits.h -o -n $$headdir_sys -a -f
"$$headdir_nosys/limits.h" ]

 # Directory for prefix to system directories, for
 # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.


Background: For cross/no-with-sysroot, the BUILD_SYSTEM_HEADER_DIR value will
be `$(gcc_tooldir)/sys-include`.  Here, `sys-include` is used by
`--with-headers` option.


So let's detect $(gcc_tooldir)/include too.

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

* [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f
  2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
                   ` (7 preceding siblings ...)
  2024-06-11  9:10 ` syq at gcc dot gnu.org
@ 2024-06-11  9:35 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-11  9:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |14.1.0
   Target Milestone|---                         |13.4

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

end of thread, other threads:[~2024-06-11  9:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-10 15:07 [Bug bootstrap/115416] New: Setting --includedir to a nonexistent directory causes a build error marcuscalhounlopez at gmail dot com
2024-06-10 15:36 ` [Bug bootstrap/115416] " sjames at gcc dot gnu.org
2024-06-10 15:39 ` [Bug bootstrap/115416] [13/14/15 regression] Setting --includedir to a nonexistent directory causes a build error since r13-5490-g59e4c98173a79f sjames at gcc dot gnu.org
2024-06-10 16:09 ` syq at gcc dot gnu.org
2024-06-10 17:01 ` syq at gcc dot gnu.org
2024-06-10 17:27 ` marcuscalhounlopez at gmail dot com
2024-06-10 17:32 ` marcuscalhounlopez at gmail dot com
2024-06-10 17:41 ` syq at gcc dot gnu.org
2024-06-11  9:10 ` syq at gcc dot gnu.org
2024-06-11  9:35 ` rguenth at gcc dot gnu.org

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).