Re: efivar-39 build failed against glibc-2.43 and gcc-15.2.0

"\"Douglas R. Reno\"" ([email protected] via blfs-dev Mailing List) <[email protected]> Fri, 13 Feb 2026 11:04:44 -0600
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <[email protected]>
On 2/13/26 9:25 AM, Haitao Huang ([email protected] via blfs-dev 
Mailing List) wrote:
> When building efivar-39 against glibc-2.43 and gcc-15.2.0 (which is 
> updated in the latest LFS development version), I got compilation errors:
>
> |gcc -Og -g3 -Wall -Wextra -Werror -std=gnu11 -funsigned-char 
> -fvisibility=hidden -specs=/sources/efivar-39/src/include/gcc.specs 
> -fno-merge-constants -DLIBEFIVAR_VERSION=39 -D_GNU_SOURCE 
> -D_FILE_OFFSET_BITS=64 -I/sources/efivar-39/src/include/ -c -o 
> linux-virtblk.o linux-virtblk.c gcc -Og -g3 -Wall -Wextra -Werror 
> -std=gnu11 -funsigned-char -fvisibility=hidden 
> -specs=/sources/efivar-39/src/include/gcc.specs -fno-merge-constants 
> -fPIC -DLIBEFIVAR_VERSION=39 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 
> -I/sources/efivar-39/src/include/ -c -o linux-virtual-root.o 
> linux-virtual-root.c gcc -Og -g3 -Wall -Wextra -Werror -std=gnu11 
> -funsigned-char -fvisibility=hidden 
> -specs=/sources/efivar-39/src/include/gcc.specs -fno-merge-constants 
> -fPIC -DLIBEFIVAR_VERSION=39 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 
> -I/sources/efivar-39/src/include/ -c -o sec.o sec.c linux-i2o.c: In 
> function 'parse_i2o': linux-i2o.c:35:23: error: initialization 
> discards 'const' qualifier from pointer target type 
> [-Werror=discarded-qualifiers] 35 | char *block = strstr(current, 
> "/block/"); | ^~~~~~ linux-ata.c: In function 'parse_ata': 
> linux-ata.c:98:22: error: initialization discards 'const' qualifier 
> from pointer target type [-Werror=discarded-qualifiers] 98 | char 
> *host = strstr(path, "/host"); | ^~~~~~ linux-ata.c:116:23: error: 
> initialization discards 'const' qualifier from pointer target type 
> [-Werror=discarded-qualifiers] 116 | char *block = strstr(current, 
> "/block/"); | ^~~~~~ linux-acpi-root.c: In function 'parse_acpi_root': 
> linux-acpi-root.c:64:15: error: assignment discards 'const' qualifier 
> from pointer target type [-Werror=discarded-qualifiers] 64 | colon = 
> strchr(current, ':'); | ^ linux.c: In function 'find_parent_devpath': 
> linux.c:41:14: error: assignment discards 'const' qualifier from 
> pointer target type [-Werror=discarded-qualifiers] 41 | node = 
> strrchr(child, '/'); | ^ cc1: all warnings being treated as errors 
> make[1]: *** [/sources/efivar-39/src/include/rules.mk:53 
> <http://rules.mk:53>: linux-i2o.o] Error 1 make[1]: *** Waiting for 
> unfinished jobs.... guid.c: In function '_get_common_guidname': 
> guid.c:88:13: error: assignment discards 'const' qualifier from 
> pointer target type [-Werror=discarded-qualifiers] 88 | tmp = 
> bsearch(&key, | ^ guid.c: In function 'efi_name_to_guid': 
> guid.c:205:16: error: assignment discards 'const' qualifier from 
> pointer target type [-Werror=discarded-qualifiers] 205 | result = 
> bsearch(&key, | ^ cc1: all warnings being treated as errors make[1]: 
> *** [/sources/efivar-39/src/include/rules.mk:53 <http://rules.mk:53>: 
> linux-ata.o] Error 1 cc1: all warnings being treated as errors 
> make[1]: *** [/sources/efivar-39/src/include/rules.mk:53 
> <http://rules.mk:53>: linux-acpi-root.o] Error 1 cc1: all warnings 
> being treated as errors make[1]: *** 
> [/sources/efivar-39/src/include/rules.mk:53 <http://rules.mk:53>: 
> guid.o] Error 1 cc1: all warnings being treated as errors make[1]: *** 
> [/sources/efivar-39/src/include/rules.mk:53 <http://rules.mk:53>: 
> linux.o] Error 1 make[1]: Leaving directory '/sources/efivar-39/src' 
> make: *** [Makefile:17: all] Error 2 (lfs chroot) 
> root:/sources/efivar-39# |
>
> I added |" -Wno-discarded-qualifiers" to CFLAGS as a temporary 
> workaround, but the better way might be a patch or a sed command. I 
> noticed the announcement from glibc-2.43, and the change below should 
> be the reason: |* The aforementioned change in ISO C23 of the declaration of bsearch,
>    memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr,
>    wcsstr, and wmemchr as const-preserving macros can lead to compilation
>    issues in code not set up for it. In particular, gnulib snapshots may need
>    to be updated.
>
Hi Haitao,

Thank you for the report!

We'll take a look at this soon, as a new release candidate of LFS that 
uses glibc-2.43 is coming tomorrow if all things go according to plan.

I advise against adding -Wno-discarded-qualifiers because while it may 
allow the package to build, it's still hiding a type system violation 
which could lead to undefined behavior or possibly a critical security 
issue (known as Type Confusion). We'll try to fix these as we come 
across them. It doesn't look like upstream is aware of this yet, so 
we'll also let them know about it as well!

- Doug

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page