package/ccrypt: fix build with GCC 15 on musl
PATCH 1/1 package/ccrypt: fix build with GCC 15 on musl
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
--- ...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
package/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch new file +56 -0
@@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +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 <[email protected]> +--- + 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,
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedQuoted 19 lines · Yegor Yefremov via buildroot
When cross-compiling, ccrypt's configure can't run its
getopt_longtest and always falls back to the bundled getopt. Itsgetopt.honly prototypesgetopt()when__GNU_LIBRARY__is defined (glibc, uClibc), so on musl it declares "extern int getopt ();", andgetopt.cdeclares "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 1Add a patch that always uses the full POSIX prototype for
getopt()and givesgetenv()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.
Quoted 6 lines
Fixes:
https://autobuild.buildroot.org/results/dd2b362542488a306a523fa05dedc859dfb0cf7eFixes 75891397abe60dbe3d82a1ec39654ff81d1b1406 ("package/gcc: add support for GCC 15.x")Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>
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
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Thomas,
Quoted 24 lines · Thomas Petazzoni
Quoted 22 lines · Yegor Yefremov via buildroot
When cross-compiling, ccrypt's configure can't run its
getopt_longtest and always falls back to the bundled getopt. Itsgetopt.honly prototypesgetopt()when__GNU_LIBRARY__is defined (glibc, uClibc), so on musl it declares "extern int getopt ();", andgetopt.cdeclares "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 1Add a patch that always uses the full POSIX prototype for
getopt()and givesgetenv()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
Quoted 7 lines
Quoted 3 lines
Fixes 75891397abe60dbe3d82a1ec39654ff81d1b1406 ("package/gcc: add support for GCC 15.x")Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedIn reply of:
Quoted 19 lines
When cross-compiling, ccrypt's configure can't run its
getopt_longtest and always falls back to the bundled getopt. Itsgetopt.honly prototypesgetopt()when__GNU_LIBRARY__is defined (glibc, uClibc), so on musl it declares "extern int getopt ();", andgetopt.cdeclares "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 1Add a patch that always uses the full POSIX prototype for
getopt()and givesgetenv()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.
Quoted 6 lines
Fixes:
https://autobuild.buildroot.org/results/dd2b362542488a306a523fa05dedc859dfb0cf7eFixes 75891397abe60dbe3d82a1ec39654ff81d1b1406 ("package/gcc: add support for GCC 15.x")Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>
Applied to 2026.08.x. Thanks
Quoted 57 lines
--- ...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.patchpackage/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch new file +46
-0@@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +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 <[email protected]> +--- + 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__
package/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch line 56
Quoted 10 lines
package/ccrypt/0001-Fix-build-with-C23-compilers-on-non-glibc-systems.patch new file +10
-0+-/* 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,
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot