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

"Haitao Huang" ([email protected] via blfs-dev Mailing List) <[email protected]> Fri, 13 Feb 2026 23:25:14 +0800
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <CAFLZeA4T-1HszJVx=ME7P=tOH8wg4JG=XxWwJkg3Q6XOZqBYxw@mail.gmail.com>
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: 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: linux-ata.o] Error 1
cc1: all warnings being treated as errors
make[1]: *** [/sources/efivar-39/src/include/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: guid.o] Error 1
cc1: all warnings being treated as errors
make[1]: *** [/sources/efivar-39/src/include/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.

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