Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/ccrypt: fix build with GCC 15 on musl
@ 2026-10-26 13:52 Yegor Yefremov via buildroot
  2026-10-26 21:51 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-10-26 13:52 UTC (permalink / raw)
  To: buildroot

When cross-compiling, ccrypt's configure can't run its getopt_long
test and always falls back to the bundled getopt. Its getopt.h only
prototypes getopt() when __GNU_LIBRARY__ is defined (glibc, uClibc),
so on musl it declares "extern int getopt ();", and getopt.c declares
"extern char *getenv ();". GCC 15 defaults to C23, where an empty
parameter list means (void), so the build fails:

  unistd.h:127:5: error: conflicting types for 'getopt'; have 'int(int,  char * const*, const char *)'
  ./include/getopt/getopt.h:150:12: note: previous declaration of 'getopt' with type 'int(void)'
  getopt.c:404:21: error: too many arguments to function 'getenv'; expected 0, have 1

Add a patch that always uses the full POSIX prototype for getopt()
and gives getenv() its standard prototype.

This issue has been present since commit 75891397abe6 ("package/gcc:
add support for GCC 15.x"), which made a C23-by-default compiler
available. It therefore affects 2025.08 and later, including the
2026.02.x LTS branch.

Fixes:
https://autobuild.buildroot.org/results/dd2b362542488a306a523fa05dedc859dfb0cf7e

Fixes: 75891397abe60dbe3d82a1ec39654ff81d1b1406 ("package/gcc: add support for GCC 15.x")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 ...h-C23-compilers-on-non-glibc-systems.patch | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 package/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch

diff --git a/package/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch b/package/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch
new file mode 100644
index 0000000000..002d011062
--- /dev/null
+++ b/package/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch
@@ -0,0 +1,56 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <yegorslists@googlemail.com>
+Date: Mon, 26 Oct 2026 14:41:24 +0100
+Subject: [PATCH] Fix build with C23 compilers on non-glibc systems
+
+C23 (the default since GCC 15) treats an empty parameter list as
+(void). The bundled getopt only prototypes getopt() when
+__GNU_LIBRARY__ is defined and declares getenv() without parameters,
+so building against e.g. musl fails:
+
+  unistd.h:127:5: error: conflicting types for 'getopt'; have 'int(int,  char * const*, const char *)'
+  ./include/getopt/getopt.h:150:12: note: previous declaration of 'getopt' with type 'int(void)'
+  getopt.c:404:21: error: too many arguments to function 'getenv'; expected 0, have 1
+
+Always use the full POSIX prototype for getopt() and give getenv() its
+standard prototype.
+
+Upstream: https://sourceforge.net/p/ccrypt/patches/7/
+Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
+---
+ src/getopt.c                | 2 +-
+ src/include/getopt/getopt.h | 7 -------
+ 2 files changed, 1 insertion(+), 8 deletions(-)
+
+diff --git a/src/getopt.c b/src/getopt.c
+index 23ab9c3..9974486 100644
+--- a/src/getopt.c
++++ b/src/getopt.c
+@@ -209,7 +209,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/include/getopt/getopt.h b/src/include/getopt/getopt.h
+index 1abae0f..d8b4edd 100644
+--- a/src/include/getopt/getopt.h
++++ b/src/include/getopt/getopt.h
+@@ -141,14 +141,7 @@ struct option
+    `getopt'.  */
+ 
+ #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__ */
+ 
+ # ifndef __need_getopt
+ extern int getopt_long (int argc, char *const *argv, const char *shortopts,
-- 
2.34.1

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

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

* Re: [Buildroot] [PATCH] package/ccrypt: fix build with GCC 15 on musl
  2026-10-26 13:52 [Buildroot] [PATCH] package/ccrypt: fix build with GCC 15 on musl Yegor Yefremov via buildroot
@ 2026-10-26 21:51 ` Thomas Petazzoni via buildroot
  2026-10-27 11:42   ` Yegor Yefremov via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-26 21:51 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: buildroot

On Mon, Oct 26, 2026 at 02:52:26PM +0100, Yegor Yefremov via buildroot wrote:
> When cross-compiling, ccrypt's configure can't run its getopt_long
> test and always falls back to the bundled getopt. Its getopt.h only
> prototypes getopt() when __GNU_LIBRARY__ is defined (glibc, uClibc),
> so on musl it declares "extern int getopt ();", and getopt.c declares
> "extern char *getenv ();". GCC 15 defaults to C23, where an empty
> parameter list means (void), so the build fails:
> 
>   unistd.h:127:5: error: conflicting types for 'getopt'; have 'int(int,  char * const*, const char *)'
>   ./include/getopt/getopt.h:150:12: note: previous declaration of 'getopt' with type 'int(void)'
>   getopt.c:404:21: error: too many arguments to function 'getenv'; expected 0, have 1
> 
> Add a patch that always uses the full POSIX prototype for getopt()
> and gives getenv() its standard prototype.
> 
> This issue has been present since commit 75891397abe6 ("package/gcc:
> add support for GCC 15.x"), which made a C23-by-default compiler
> available. It therefore affects 2025.08 and later, including the
> 2026.02.x LTS branch.
> 
> Fixes:
> https://autobuild.buildroot.org/results/dd2b362542488a306a523fa05dedc859dfb0cf7e
> 
> Fixes: 75891397abe60dbe3d82a1ec39654ff81d1b1406 ("package/gcc: add support for GCC 15.x")
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

Applied to master, thanks! To be honest, I'm not sure we should keep
ccrypt. No release since 2018... for a crypto related program. That
doesn't smell like a very active/maintained project.

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/ccrypt: fix build with GCC 15 on musl
  2026-10-26 21:51 ` Thomas Petazzoni via buildroot
@ 2026-10-27 11:42   ` Yegor Yefremov via buildroot
  0 siblings, 0 replies; 3+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-10-27 11:42 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot

Hi Thomas,

On Mon, Oct 26, 2026 at 10:51 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Mon, Oct 26, 2026 at 02:52:26PM +0100, Yegor Yefremov via buildroot wrote:
> > When cross-compiling, ccrypt's configure can't run its getopt_long
> > test and always falls back to the bundled getopt. Its getopt.h only
> > prototypes getopt() when __GNU_LIBRARY__ is defined (glibc, uClibc),
> > so on musl it declares "extern int getopt ();", and getopt.c declares
> > "extern char *getenv ();". GCC 15 defaults to C23, where an empty
> > parameter list means (void), so the build fails:
> >
> >   unistd.h:127:5: error: conflicting types for 'getopt'; have 'int(int,  char * const*, const char *)'
> >   ./include/getopt/getopt.h:150:12: note: previous declaration of 'getopt' with type 'int(void)'
> >   getopt.c:404:21: error: too many arguments to function 'getenv'; expected 0, have 1
> >
> > Add a patch that always uses the full POSIX prototype for getopt()
> > and gives getenv() its standard prototype.
> >
> > This issue has been present since commit 75891397abe6 ("package/gcc:
> > add support for GCC 15.x"), which made a C23-by-default compiler
> > available. It therefore affects 2025.08 and later, including the
> > 2026.02.x LTS branch.
> >
> > Fixes:
> > https://autobuild.buildroot.org/results/dd2b362542488a306a523fa05dedc859dfb0cf7e
> >
> > Fixes: 75891397abe60dbe3d82a1ec39654ff81d1b1406 ("package/gcc: add support for GCC 15.x")
> > Assisted-by: Claude:claude-opus-5-5
> > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>
> Applied to master, thanks! To be honest, I'm not sure we should keep
> ccrypt. No release since 2018... for a crypto related program. That
> doesn't smell like a very active/maintained project.

The strange thing is, the maintainer is still active:
https://sourceforge.net/p/ccrypt/bugs/31/. Though this doesn't lead to
a new release :-(

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

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

end of thread, other threads:[~2026-10-27 11:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 13:52 [Buildroot] [PATCH] package/ccrypt: fix build with GCC 15 on musl Yegor Yefremov via buildroot
2026-10-26 21:51 ` Thomas Petazzoni via buildroot
2026-10-27 11:42   ` Yegor Yefremov via buildroot

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