Bug#1128547: grub2: FTBFS with glibc 2.43 due to ISO C23 const return types
Aurelien Jarno
aurel32 at debian.org
Fri Feb 20 22:47:45 GMT 2026
Source: grub2
Version: 2.14-2
Severity: important
Tags: ftbfs upstream
Justification: fails to build from source
User: debian-glibc at lists.debian.org
Usertags: glibc-2.43
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
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien at aurel32.net http://aurel32.net
More information about the Pkg-grub-devel
mailing list