Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x
@ 2026-05-03 23:56 Daniel Houck
  2026-05-04 13:17 ` Marcus Hoffmann via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Daniel Houck @ 2026-05-03 23:56 UTC (permalink / raw)
  To: buildroot; +Cc: Daniel Houck

It builds fine with glibc and gcc-15.x but conditionally includes code
with musl that fails.  See eg. commit 999fb19d4b.

Fixes #176.  See also https://savannah.gnu.org/bugs/index.php?68302

Signed-off-by: Daniel Houck <Software@DRHouck.me>
---
 package/make/make.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/make/make.mk b/package/make/make.mk
index 1d1a976eb4..7120548bcc 100644
--- a/package/make/make.mk
+++ b/package/make/make.mk
@@ -14,6 +14,14 @@ MAKE_CPE_ID_VENDOR = gnu
 
 MAKE_CONF_OPTS = --without-guile
 
+# Make doesn't build with C23 in some configurations; see upstream #68302
+# gcc-15 defaults to -std=gnu23, so we force "-std=gnu17" for gcc version
+# supporting it. Earlier gcc versions will work, since they are using the
+# older standard.
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
+MAKE_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu17"
+endif
+
 # Disable the 'load' operation for static builds since it needs dlopen
 ifeq ($(BR2_STATIC_LIBS),y)
 MAKE_CONF_OPTS += --disable-load
-- 
2.54.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x
  2026-05-03 23:56 [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x Daniel Houck
@ 2026-05-04 13:17 ` Marcus Hoffmann via buildroot
  2026-05-04 19:59   ` Daniel Houck
  2026-05-04 23:06 ` [Buildroot] [PATCH v2] " Daniel Houck
  2026-05-15 17:45 ` [Buildroot] [PATCH 1/1] " Thomas Perale via buildroot
  2 siblings, 1 reply; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2026-05-04 13:17 UTC (permalink / raw)
  To: Daniel Houck, buildroot

Hi Daniel,
thanks for the patch.

On 5/4/26 01:56, Daniel Houck wrote:
> It builds fine with glibc and gcc-15.x but conditionally includes code
> with musl that fails.  See eg. commit 999fb19d4b.

Alpine[1] and Gentoo[2][3] have a "proper" fix for this (meaning the fix 
the offending code instead of changing the std level.

There's also been a submission to the make mailing list[4], but without 
any reaction and only containing two of the three fixes the other 
patches have.

I think this is the better solution, even though it means carrying a 
patch until make eventually might fix this upstream.

I think we can just use the gentoo patch as-is I think? What do you think?

> 
> Fixes #176.  See also https://savannah.gnu.org/bugs/index.php?68302
> 
> Signed-off-by: Daniel Houck <Software@DRHouck.me>
> ---
Best,
Marcus

[1] 
https://github.com/alpinelinux/aports/blob/master/main/make/getopt-gcc15.patch
[2] https://bugs.gentoo.org/945968
[3] 
https://codeberg.org/gentoo/gentoo/src/branch/master/dev-build/make/files/make-4.4.1-c23.patch
[4] https://lists.gnu.org/archive/html/bug-make/2025-03/msg00032.html
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x
  2026-05-04 13:17 ` Marcus Hoffmann via buildroot
@ 2026-05-04 19:59   ` Daniel Houck
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Houck @ 2026-05-04 19:59 UTC (permalink / raw)
  To: Marcus Hoffmann, buildroot

Hi Marcus,

On 5/4/26 09:17, Marcus Hoffmann wrote:
> Alpine[1] and Gentoo[2][3] have a "proper" fix for this (meaning the fix 
> the offending code instead of changing the std level.
> 
> There's also been a submission to the make mailing list[4], but without 
> any reaction and only containing two of the three fixes the other 
> patches have.
Ah, I couldn't find any prior art, thanks for the links.  I'm kind of 
surprised it's only three places, but a few days ago I was surprised 
anyone still wrote C without prototypes like that, so what do I know?

> I think this is the better solution, even though it means carrying a 
> patch until make eventually might fix this upstream.
> 
> I think we can just use the gentoo patch as-is I think? What do you think?Yeah that sounds good.  I'll do a couple tests to make sure everything 
works as expected and then send that instead.

Thanks,
Daniel

PS. This is my first time sending to a list like this that doesn't like 
HTML emails; everyone else I talk to is fine with them.  I'm 95% sure I 
set up my mail client correctly, but if not, I apologize and I'll fix it 
for next time.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2] package/make: fix build with musl and gcc-15.x
  2026-05-03 23:56 [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x Daniel Houck
  2026-05-04 13:17 ` Marcus Hoffmann via buildroot
@ 2026-05-04 23:06 ` Daniel Houck
  2026-05-05  1:11   ` [Buildroot] [PATCH v3] " Daniel Houck
  2026-05-15 17:45 ` [Buildroot] [PATCH 1/1] " Thomas Perale via buildroot
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel Houck @ 2026-05-04 23:06 UTC (permalink / raw)
  To: buildroot; +Cc: Daniel Houck

Patch the parts of Make that use code invalid in C23.  It wasn't
included when compiling with glibc but failed to build with musl.

Fixes #176.  See also https://savannah.gnu.org/bugs/index.php?68302

Signed-off-by: Daniel Houck <Software@DRHouck.me>
---
Changes v1 -> v2:
  - patch make instead of using CFLAGS (suggested by Marcus)

 ...1-fix-compilation-on-musl-with-gcc15.patch | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 package/make/0001-fix-compilation-on-musl-with-gcc15.patch

diff --git a/package/make/0001-fix-compilation-on-musl-with-gcc15.patch b/package/make/0001-fix-compilation-on-musl-with-gcc15.patch
new file mode 100644
index 0000000000..aa2598df9a
--- /dev/null
+++ b/package/make/0001-fix-compilation-on-musl-with-gcc15.patch
@@ -0,0 +1,61 @@
+From 31bc8976fb7bfdde8b9293e6a4eb2becb29a73bc Mon Sep 17 00:00:00 2001
+From: Bobby Bingham <koorogi@koorogi.info>
+Date: Wed, 2 Jul 2025 18:09:28 -0500
+Subject: [PATCH] fix compilation on musl with gcc15
+
+---
+
+Patch originally from https://codeberg.org/gentoo/gentoo/raw/branch/master/dev-build/make/files/make-4.4.1-c23.patch
+
+ lib/fnmatch.c | 2 +-
+ src/getopt.c  | 2 +-
+ src/getopt.h  | 7 -------
+ 3 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/lib/fnmatch.c b/lib/fnmatch.c
+index 01da376..9b54022 100644
+--- a/lib/fnmatch.c
++++ b/lib/fnmatch.c
+@@ -121,7 +121,7 @@ USA.  */
+    whose names are inconsistent.  */
+ 
+ # if !defined _LIBC && !defined getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ # endif
+ 
+ # ifndef errno
+diff --git a/src/getopt.c b/src/getopt.c
+index 7a792de..9b56abe 100644
+--- a/src/getopt.c
++++ b/src/getopt.c
+@@ -202,7 +202,7 @@ static char *posixly_correct;
+    whose names are inconsistent.  */
+ 
+ #ifndef getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ #endif
+ 
+ static char *
+diff --git a/src/getopt.h b/src/getopt.h
+index df18cee..a6cc621 100644
+--- a/src/getopt.h
++++ b/src/getopt.h
+@@ -96,14 +96,7 @@ struct option
+ #define optional_argument	2
+ 
+ #if defined (__STDC__) && __STDC__
+-#ifdef __GNU_LIBRARY__
+-/* Many other libraries have conflicting prototypes for getopt, with
+-   differences in the consts, in stdlib.h.  To avoid compilation
+-   errors, only prototype getopt for the GNU C library.  */
+ extern int getopt (int argc, char *const *argv, const char *shortopts);
+-#else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
+-#endif /* __GNU_LIBRARY__ */
+ extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+ 		        const struct option *longopts, int *longind);
+ extern int getopt_long_only (int argc, char *const *argv,
+-- 
+2.50.0
-- 
2.54.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v3] package/make: fix build with musl and gcc-15.x
  2026-05-04 23:06 ` [Buildroot] [PATCH v2] " Daniel Houck
@ 2026-05-05  1:11   ` Daniel Houck
  2026-05-05  8:59     ` Marcus Hoffmann via buildroot
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Houck @ 2026-05-05  1:11 UTC (permalink / raw)
  To: buildroot; +Cc: Daniel Houck

Patch the parts of Make that use code invalid in C23.  It wasn't
included when compiling with glibc but failed to build with musl.

Fixes #176.  See also https://savannah.gnu.org/bugs/index.php?68302

Signed-off-by: Daniel Houck <Software@DRHouck.me>
---
Changes v3 -> v2:
  - Format the patch as specified in Buildroot manual.  I thought I'd
    done that for v2 but forgot to actually commit that change, oops.

Changes v1 -> v2:
  - patch make instead of using CFLAGS (suggested by Marcus)

 ...1-fix-compilation-on-musl-with-gcc15.patch | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 package/make/0001-fix-compilation-on-musl-with-gcc15.patch

diff --git a/package/make/0001-fix-compilation-on-musl-with-gcc15.patch b/package/make/0001-fix-compilation-on-musl-with-gcc15.patch
new file mode 100644
index 0000000000..990aee0abf
--- /dev/null
+++ b/package/make/0001-fix-compilation-on-musl-with-gcc15.patch
@@ -0,0 +1,66 @@
+From 31bc8976fb7bfdde8b9293e6a4eb2becb29a73bc Mon Sep 17 00:00:00 2001
+From: Bobby Bingham <koorogi@koorogi.info>
+Date: Wed, 2 Jul 2025 18:09:28 -0500
+Subject: [PATCH] fix compilation on musl with gcc15
+
+Patch originally from https://codeberg.org/gentoo/gentoo/raw/branch/master/dev-build/make/files/make-4.4.1-c23.patch
+
+This addresses the same issues as, but is not quite identical to, the
+patch linked to as upstream.  Upstream has not acknowledged its patch in
+any way.
+
+Signed-off-by: Daniel Houck <Software@DRHouck.me>
+Upstream: https://lists.gnu.org/archive/html/bug-make/2025-03/msg00032.html
+---
+ lib/fnmatch.c | 2 +-
+ src/getopt.c  | 2 +-
+ src/getopt.h  | 7 -------
+ 3 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/lib/fnmatch.c b/lib/fnmatch.c
+index 01da376..9b54022 100644
+--- a/lib/fnmatch.c
++++ b/lib/fnmatch.c
+@@ -121,7 +121,7 @@ USA.  */
+    whose names are inconsistent.  */
+ 
+ # if !defined _LIBC && !defined getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ # endif
+ 
+ # ifndef errno
+diff --git a/src/getopt.c b/src/getopt.c
+index 7a792de..9b56abe 100644
+--- a/src/getopt.c
++++ b/src/getopt.c
+@@ -202,7 +202,7 @@ static char *posixly_correct;
+    whose names are inconsistent.  */
+ 
+ #ifndef getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ #endif
+ 
+ static char *
+diff --git a/src/getopt.h b/src/getopt.h
+index df18cee..a6cc621 100644
+--- a/src/getopt.h
++++ b/src/getopt.h
+@@ -96,14 +96,7 @@ struct option
+ #define optional_argument	2
+ 
+ #if defined (__STDC__) && __STDC__
+-#ifdef __GNU_LIBRARY__
+-/* Many other libraries have conflicting prototypes for getopt, with
+-   differences in the consts, in stdlib.h.  To avoid compilation
+-   errors, only prototype getopt for the GNU C library.  */
+ extern int getopt (int argc, char *const *argv, const char *shortopts);
+-#else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
+-#endif /* __GNU_LIBRARY__ */
+ extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+ 		        const struct option *longopts, int *longind);
+ extern int getopt_long_only (int argc, char *const *argv,
+-- 
+2.50.0
-- 
2.54.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3] package/make: fix build with musl and gcc-15.x
  2026-05-05  1:11   ` [Buildroot] [PATCH v3] " Daniel Houck
@ 2026-05-05  8:59     ` Marcus Hoffmann via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2026-05-05  8:59 UTC (permalink / raw)
  To: Daniel Houck, buildroot

On 5/5/26 03:11, Daniel Houck wrote:
> Patch the parts of Make that use code invalid in C23.  It wasn't
> included when compiling with glibc but failed to build with musl.
> 
> Fixes #176.  See also https://savannah.gnu.org/bugs/index.php?68302
> 
> Signed-off-by: Daniel Houck <Software@DRHouck.me>
> ---
Applied to master, thanks!

Marcus
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x
  2026-05-03 23:56 [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x Daniel Houck
  2026-05-04 13:17 ` Marcus Hoffmann via buildroot
  2026-05-04 23:06 ` [Buildroot] [PATCH v2] " Daniel Houck
@ 2026-05-15 17:45 ` Thomas Perale via buildroot
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Perale via buildroot @ 2026-05-15 17:45 UTC (permalink / raw)
  To: Daniel Houck; +Cc: Thomas Perale, buildroot

In reply of:
> It builds fine with glibc and gcc-15.x but conditionally includes code
> with musl that fails.  See eg. commit 999fb19d4b.
> 
> Fixes #176.  See also https://savannah.gnu.org/bugs/index.php?68302
> 
> Signed-off-by: Daniel Houck <Software@DRHouck.me>

Applied to 2026.02.x. Thanks

> ---
>  package/make/make.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/make/make.mk b/package/make/make.mk
> index 1d1a976eb4..7120548bcc 100644
> --- a/package/make/make.mk
> +++ b/package/make/make.mk
> @@ -14,6 +14,14 @@ MAKE_CPE_ID_VENDOR = gnu
>  
>  MAKE_CONF_OPTS = --without-guile
>  
> +# Make doesn't build with C23 in some configurations; see upstream #68302
> +# gcc-15 defaults to -std=gnu23, so we force "-std=gnu17" for gcc version
> +# supporting it. Earlier gcc versions will work, since they are using the
> +# older standard.
> +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
> +MAKE_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu17"
> +endif
> +
>  # Disable the 'load' operation for static builds since it needs dlopen
>  ifeq ($(BR2_STATIC_LIBS),y)
>  MAKE_CONF_OPTS += --disable-load
> -- 
> 2.54.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-05-15 17:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03 23:56 [Buildroot] [PATCH 1/1] package/make: fix build with musl and gcc-15.x Daniel Houck
2026-05-04 13:17 ` Marcus Hoffmann via buildroot
2026-05-04 19:59   ` Daniel Houck
2026-05-04 23:06 ` [Buildroot] [PATCH v2] " Daniel Houck
2026-05-05  1:11   ` [Buildroot] [PATCH v3] " Daniel Houck
2026-05-05  8:59     ` Marcus Hoffmann via buildroot
2026-05-15 17:45 ` [Buildroot] [PATCH 1/1] " Thomas Perale via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox