Skip to content

Disable char8_t in C23 builds on glibc older than 2.36 - #189

Open
bdice wants to merge 1 commit into
NVIDIA:devfrom
bdice:fix-char8-glibc
Open

bdice wants to merge 1 commit into
NVIDIA:devfrom
bdice:fix-char8-glibc

Conversation

@bdice

@bdice bdice commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #188.

With GCC 15 (default C23) on glibc older than 2.36, nvtxExtPayloadTypeInfo.h fails with 'char8_t' undeclared. In C, char8_t comes from <uchar.h>, which glibc only provides as of 2.36, but NVTX_HAVE_CHAR8 was set for any C23 compile. ba4ec76 (the follow-up to #163) only changed the C++ detection.

This excludes C23 on glibc < 2.36 from NVTX_HAVE_CHAR8. The type is then reported as unsupported ({0, 0}), the same way it already is for Apple and Cygwin. C++ and non-glibc C libraries are unaffected.

Testing

  • tests/ built with -DCMAKE_C_STANDARD=23 -DCMAKE_CXX_STANDARD=20 on glibc 2.43: 106/106 pass.
  • C payload targets (coverage-ext-payload, payload-helper-macros-c) built against a glibc 2.34 sysroot with C23: fail with 'char8_t' undeclared on dev, build with this change.
  • Standalone compile of nvtx3/nvToolsExtPayload.h with GCC 15.3 at default -std: glibc 2.17, 2.28, 2.34 now compile with NVTX_HAVE_CHAR8 == 0; glibc 2.39 and 2.43 keep NVTX_HAVE_CHAR8 == 1. C++20 keeps NVTX_HAVE_CHAR8 == 1.
  • The #if block evaluated with __GLIBC__/__GLIBC_MINOR__ set to 2.35 (0), 2.36 (1), 2.37 (1), 3.0 (1), 1.9 (0), and with no glibc defined (1).

release-v3 has the same header and the same problem, so this likely wants a backport there.

In C, char8_t comes from <uchar.h>, which glibc provides as of 2.36. GCC 15 defaults to C23, so NVTX_HAVE_CHAR8 was set on older glibc where the type does not exist, and nvtxExtPayloadTypeInfo.h failed to compile with 'char8_t' undeclared. Treat char8_t as unsupported there, as is already done for Apple and Cygwin.

Signed-off-by: Bradley Dice <bdice@bradleydice.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

char8_t build failure in C with GCC 15 and glibc older than 2.36

1 participant