public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/115368] New: Wrong order of gcc include paths on musl systems
@ 2024-06-06  7:00 raj.khem at gmail dot com
  2024-06-06  7:03 ` [Bug driver/115368] " raj.khem at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: raj.khem at gmail dot com @ 2024-06-06  7:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115368
           Summary: Wrong order of gcc include paths on musl systems
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raj.khem at gmail dot com
  Target Milestone: ---

When doing cross-builds targeting musl based systems, gcc driver adds -iprefix
to cc1/cc1plus call, the path is based on gcc cross compiler installation
location, and points to GCC private headers which override some of system
headers e.g. stddef.h stdint.h, stdarg.h to name a few. This works ok with
glibc based systems but musl does not depend/use gcc's private headers [1] and
-iprefix prepends to search path which means the headers from gcc installation
will be picked up first. This causes problems e.g. when configuring python
build, it tries to detect platform and logic to detect musl system is based on
musl specific define coming from stdarg.h, however musl cross gcc feeds the
gcc's own stdarg.h header and the test fails. 

[1] https://gitlab.alpinelinux.org/alpine/aports/-/issues/12477#note_145159

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

* [Bug driver/115368] Wrong order of gcc include paths on musl systems
  2024-06-06  7:00 [Bug driver/115368] New: Wrong order of gcc include paths on musl systems raj.khem at gmail dot com
@ 2024-06-06  7:03 ` raj.khem at gmail dot com
  2024-06-06 16:56 ` raj.khem at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: raj.khem at gmail dot com @ 2024-06-06  7:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Khem Raj <raj.khem at gmail dot com> ---
Created attachment 58366
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58366&action=edit
potential fix

This patch uses -idirafter instead of -iprefix when building for musl. This
fixes the issue as the search paths get adjusted and sysroot is searched before
gcc headers dir.

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

* [Bug driver/115368] Wrong order of gcc include paths on musl systems
  2024-06-06  7:00 [Bug driver/115368] New: Wrong order of gcc include paths on musl systems raj.khem at gmail dot com
  2024-06-06  7:03 ` [Bug driver/115368] " raj.khem at gmail dot com
@ 2024-06-06 16:56 ` raj.khem at gmail dot com
  2024-06-06 18:33 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: raj.khem at gmail dot com @ 2024-06-06 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

Khem Raj <raj.khem at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58366|0                           |1
        is obsolete|                            |

--- Comment #2 from Khem Raj <raj.khem at gmail dot com> ---
Created attachment 58370
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58370&action=edit
potential fix v2

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

* [Bug driver/115368] Wrong order of gcc include paths on musl systems
  2024-06-06  7:00 [Bug driver/115368] New: Wrong order of gcc include paths on musl systems raj.khem at gmail dot com
  2024-06-06  7:03 ` [Bug driver/115368] " raj.khem at gmail dot com
  2024-06-06 16:56 ` raj.khem at gmail dot com
@ 2024-06-06 18:33 ` redi at gcc dot gnu.org
  2024-06-06 18:40 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2024-06-06 18:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Please send patch to the gcc-patches mailing list rather than attaching them
here.

https://gcc.gnu.org/contribute.html#patches

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

* [Bug driver/115368] Wrong order of gcc include paths on musl systems
  2024-06-06  7:00 [Bug driver/115368] New: Wrong order of gcc include paths on musl systems raj.khem at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-06 18:33 ` redi at gcc dot gnu.org
@ 2024-06-06 18:40 ` pinskia at gcc dot gnu.org
  2024-06-06 18:42 ` pinskia at gcc dot gnu.org
  2024-06-06 18:47 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-06 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note this patch does not work as OPTION_MUSL is not defined for all targets.
e.g. *-*-darwin and *-*-elf* targets do not define it.

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

* [Bug driver/115368] Wrong order of gcc include paths on musl systems
  2024-06-06  7:00 [Bug driver/115368] New: Wrong order of gcc include paths on musl systems raj.khem at gmail dot com
                   ` (3 preceding siblings ...)
  2024-06-06 18:40 ` pinskia at gcc dot gnu.org
@ 2024-06-06 18:42 ` pinskia at gcc dot gnu.org
  2024-06-06 18:47 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-06 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2024-06-06
     Ever confirmed|0                           |1

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also how come glibc targets get it correct:
[apinski@xeond2 gcc]$ ~/upstream-gcc-match/bin/gcc -E -Wp,-v -
ignoring nonexistent directory
"/home/apinski/upstream-gcc-match/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/apinski/upstream-gcc-match/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include
 /usr/local/include
 /home/apinski/upstream-gcc-match/include

/home/apinski/upstream-gcc-match/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include-fixed
 /usr/include

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

* [Bug driver/115368] Wrong order of gcc include paths on musl systems
  2024-06-06  7:00 [Bug driver/115368] New: Wrong order of gcc include paths on musl systems raj.khem at gmail dot com
                   ` (4 preceding siblings ...)
  2024-06-06 18:42 ` pinskia at gcc dot gnu.org
@ 2024-06-06 18:47 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-06 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> musl does not depend/use gcc's private headers

Which is wrong and broken.

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

end of thread, other threads:[~2024-06-06 18:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-06  7:00 [Bug driver/115368] New: Wrong order of gcc include paths on musl systems raj.khem at gmail dot com
2024-06-06  7:03 ` [Bug driver/115368] " raj.khem at gmail dot com
2024-06-06 16:56 ` raj.khem at gmail dot com
2024-06-06 18:33 ` redi at gcc dot gnu.org
2024-06-06 18:40 ` pinskia at gcc dot gnu.org
2024-06-06 18:42 ` pinskia at gcc dot gnu.org
2024-06-06 18:47 ` pinskia 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).