#1128547 grub2: FTBFS with glibc 2.43 due to ISO C23 const return types

Package:
src:grub2
Source:
src:grub2
Submitter:
Aurelien Jarno
Date:
2026-08-10 12:53:12 UTC
Severity:
normal
Tags:
#1128547#5
Date:
2026-02-20 22:47:45 UTC
From:
To:
Dear maintainer(s),

grub2 fails to build from source with glibc 2.43, currently in
experimental. From the build log:

| cc -DHAVE_CONFIG_H -I. -I../..  -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"util/resolve.c\" -I. -I../.. -I. -I../.. -I../../include -I./include -I../../grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/gnulib -I../../grub-core/lib/gnulib  -D_FILE_OFFSET_BITS=64 -std=gnu99 -fno-common -Wall -Wno-error=unused-result -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/grub2-2.14=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-error=attributes   -c -o util/grub_editenv-resolve.o `test -f 'util/resolve.c' || echo '../../'`util/resolve.c

...

| cc1: all warnings being treated as errors
| ../../util/resolve.c: In function ‘get_module_name’:
| ../../util/resolve.c:144:8: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   144 |   base = strrchr (str, '/');
|       |        ^
| ../../util/resolve.c: In function ‘get_module_path’:
| ../../util/resolve.c:172:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   172 |   ext = strrchr (str, '.');
|       |       ^
| ../../util/resolve.c:181:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   181 |   dir = strchr (str, '/');
|       |       ^

...

| cc -DHAVE_CONFIG_H -I. -I../..  -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"util/resolve.c\" -I. -I../.. -I. -I../.. -I../../include -I./include -I../../grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/gnulib -I../../grub-core/lib/gnulib  -D_FILE_OFFSET_BITS=64 -std=gnu99 -fno-common -Wall -Wno-error=unused-result -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/grub2-2.14=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-error=attributes -I/usr/include/efivar   -c -o util/grub_mkrescue-resolve.o `test -f 'util/resolve.c' || echo '../../'`util/resolve.c

| cc1: all warnings being treated as errors
| ../../util/resolve.c: In function ‘get_module_name’:
| ../../util/resolve.c:144:8: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   144 |   base = strrchr (str, '/');
|       |        ^
| ../../util/resolve.c: In function ‘get_module_path’:
| ../../util/resolve.c:172:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   172 |   ext = strrchr (str, '.');
|       |       ^
| ../../util/resolve.c:181:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   181 |   dir = strchr (str, '/');
|       |       ^
| ../../util/resolve.c: In function ‘get_module_name’:
| ../../util/resolve.c:144:8: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   144 |   base = strrchr (str, '/');
|       |        ^
| ../../util/resolve.c: In function ‘get_module_path’:
| ../../util/resolve.c:172:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   172 |   ext = strrchr (str, '.');
|       |       ^
| ../../util/resolve.c:181:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   181 |   dir = strchr (str, '/');
|       |       ^
| make[4]: *** [Makefile:9805: util/grub_editenv-resolve.o] Error 1
| make[4]: *** Waiting for unfinished jobs....
| In file included from ../../grub-core/osdep/ofpath.c:2:
| ../../grub-core/osdep/linux/ofpath.c: In function ‘check_sas’:
| ../../grub-core/osdep/linux/ofpath.c:491:14: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   491 |   char *ed = strstr (sysfs_path, "end_device");
|       |              ^~~~~~
| cc1: all warnings being treated as errors
| make[4]: *** [Makefile:11961: util/grub_mkstandalone-resolve.o] Error 1
| In file included from ../../grub-core/osdep/ofpath.c:2:
| ../../grub-core/osdep/linux/ofpath.c: In function ‘check_sas’:
| ../../grub-core/osdep/linux/ofpath.c:491:14: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|   491 |   char *ed = strstr (sysfs_path, "end_device");
|       |              ^~~~~~
| cc1: all warnings being treated as errors
| make[4]: *** [Makefile:11611: util/grub_mkrescue-resolve.o] Error 1
| cc1: all warnings being treated as errors
| make[4]: *** [Makefile:11429: grub-core/osdep/grub_mkrescue-ofpath.o] Error 1
| cc1: all warnings being treated as errors
| make[4]: *** [Makefile:11779: grub-core/osdep/grub_mkstandalone-ofpath.o] Error 1
| cc1: all warnings being treated as errors
| make[4]: *** [Makefile:11009: grub-core/osdep/grub_mknetdir-ofpath.o] Error 1
| make[4]: Leaving directory '/build/reproducible-path/grub2-2.14/obj/grub-efi-arm64'
| make[3]: *** [Makefile:12996: all-recursive] Error 1
| make[3]: Leaving directory '/build/reproducible-path/grub2-2.14/obj/grub-efi-arm64'
| make[2]: *** [Makefile:4187: all] Error 2
| make[2]: Leaving directory '/build/reproducible-path/grub2-2.14/obj/grub-efi-arm64'
| dh_auto_build: error: cd obj/grub-efi-arm64 && make -j128 returned exit code 2
| make[1]: *** [debian/rules:234: debian/stamps/build-grub-efi-arm64] Error 25
| make[1]: Leaving directory '/build/reproducible-path/grub2-2.14'
| make: *** [debian/rules:148: binary] Error 2
| dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2

The full build log is available here [1].

The issue is due to ISO C23 declaration of bsearch, memchr, strchr,
strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr,
which now returns a pointer to a const-qualified type when the input
argument is a pointer to a const-qualified type [2].

I would like to thanks Emanuele Rocca for doing the archive rebuild on
a fast arm64 server.

Regards
Aurelien

[1] https://people.debian.org/~ema/glibc-2.43-rebuilds/output-1/grub2_arm64.build
[2] https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=e271fb2e4d76903c77a302aaec1ca22ce31027d0;hb=f762ccf84f122d1354f103a151cba8bde797d521#l19

#1128547#21
Date:
2026-08-10 12:44:53 UTC
From:
To:
control: severity 1127629 serious
control: severity 1128547 serious
control: severity 1128734 serious
control: severity 1128740 serious
control: severity 1128528 serious
control: severity 1128532 serious
control: severity 1128534 serious
control: severity 1128541 serious
control: severity 1128544 serious
control: severity 1128545 serious
control: severity 1128548 serious
control: severity 1128549 serious
control: severity 1128551 serious
control: severity 1128615 serious
control: severity 1128678 serious
control: severity 1128680 serious
control: severity 1128681 serious
control: severity 1128697 serious
control: severity 1128736 serious
control: severity 1128737 serious
control: severity 1128738 serious
control: severity 1128741 serious
control: severity 1128742 serious
control: severity 1128743 serious
control: severity 1128750 serious
control: severity 1128757 serious
control: severity 1128761 serious
control: severity 1128763 serious
control: severity 1128764 serious
control: severity 1128875 serious
control: severity 1128952 serious
control: severity 1128542 serious
control: severity 1128679 serious
control: severity 1128682 serious
control: severity 1128744 serious
control: severity 1128748 serious
control: severity 1128867 serious

Hi,

With the upload of glibc 2.43 to unstable, the packages now FTBFS in
unstable, hence upgrading the severity to serious.

Note that as a quick workaround, it is possible to roll back to C/C++17
standard using -std=c17, -std=gnu17, std=c++17 or std=gnu++17. This was
the default up to GCC 14, and GCC 15 changed it to C/C23.

Regards
Aurelien