Build failure on Ubuntu 26.04 with clang -std=c99 -pedantic #907

Open
opened 2026-09-10 02:19:07 -05:00 by gilles-peskine-arm · 0 comments
gilles-peskine-arm commented 2026-09-10 02:19:07 -05:00 (Migrated from github.com)

On Ubuntu 26.04, the build fails with clang -std=c99 -pedantic, due to conflicting ideas about portability in Glibc and clang which make strstr() unusable.

To reproduce:

CC=clang CFLAGS='-std=c99 -pedantic' cmake -B build-resolute
cmake --build build-resolute

The build failure (more in other files):

extras/pkparse.c:1297:9: error: '_Generic' is a C11 extension [-Werror,-Wc11-extensions]
 1297 |     if (strstr((const char *) *buf, "-----BEGIN ") != NULL) {
      |         ^
/usr/include/string.h:381:3: note: expanded from macro 'strstr'
  381 |   __glibc_const_generic (HAYSTACK, const char *,        \
      |   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic'
  838 |   _Generic (0 ? (PTR) : (void *) 1,                     \
      |   ^
1 error generated.

This affects all branches (3.6, 1.1, crypto) as of 3.6.7, 1.1.1 and 1.2.0. In 3.6, only the build of the tests is affected (tests/src/fork_helpers.c). Since TF-PSA-Crypto 1.0.0 and Mbed TLS 4.0.0, the library is also affected.

On Ubuntu 26.04, the build fails with `clang -std=c99 -pedantic`, due to conflicting ideas about portability in Glibc and clang which make `strstr()` unusable. To reproduce: ``` CC=clang CFLAGS='-std=c99 -pedantic' cmake -B build-resolute cmake --build build-resolute ``` The build failure (more in other files): ``` extras/pkparse.c:1297:9: error: '_Generic' is a C11 extension [-Werror,-Wc11-extensions] 1297 | if (strstr((const char *) *buf, "-----BEGIN ") != NULL) { | ^ /usr/include/string.h:381:3: note: expanded from macro 'strstr' 381 | __glibc_const_generic (HAYSTACK, const char *, \ | ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic' 838 | _Generic (0 ? (PTR) : (void *) 1, \ | ^ 1 error generated. ``` This affects all branches (3.6, 1.1, crypto) as of 3.6.7, 1.1.1 and 1.2.0. In 3.6, only the build of the tests is affected (`tests/src/fork_helpers.c`). Since TF-PSA-Crypto 1.0.0 and Mbed TLS 4.0.0, the library is also affected.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#907
No description provided.