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

Aurelien Jarno aurel32 at debian.org
Sun Mar 29 16:21:31 BST 2026


control: tag -1 + patch
control: tag -1 + fixed-upstream

Hi,

On 2026-02-20 23:47, Aurelien Jarno wrote:
> 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].

The issue has been fixed upstream with the following commits:

https://gitlab.freedesktop.org/gnu-grub/grub/-/commit/675d8581037dc8996cf6db21a61d26e28f7d44c1
https://gitlab.freedesktop.org/gnu-grub/grub/-/commit/b71ae6db282fa25ca4ea6f8169161a2131ee6b9a
https://gitlab.freedesktop.org/gnu-grub/grub/-/commit/9f4a586f1227a8287e1d6acd95893f6098756ee2
https://gitlab.freedesktop.org/gnu-grub/grub/-/commit/ce6f2b57f5450a8239022dcbfb2d750f273b83cb

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien at aurel32.net                     http://aurel32.net



More information about the Pkg-grub-devel mailing list