Skip to content

char8_t: support glibc <2.36 #163

Open
cwsmith wants to merge 1 commit into
NVIDIA:release-v3from
SCOREC:cws/char8t
Open

char8_t: support glibc <2.36 #163
cwsmith wants to merge 1 commit into
NVIDIA:release-v3from
SCOREC:cws/char8t

Conversation

@cwsmith

@cwsmith cwsmith commented Apr 27, 2026

Copy link
Copy Markdown

This PR addresses a compilation issue with the nvtx 3.3.0 package, with the python bindings enabled (as a dep of py-torch), when built with GCC 15.2.0 and glibc 2.34 on a RHEL9 system. IIUC, glibc 2.36 or newer is needed to use char8_t from the c20 standard (https://lists.gnu.org/archive/html/info-gnu/2022-08/msg00000.html).

I was installing via spack and have a PR for a patch here: spack/spack-packages#4531

Note, I have not directly built/tested these changes outside of spack. Please let me know if there is some testing I can/should do on my end.

On our system, the following code reproduces the bug:

$ cat foo.c 
#include <stdio.h> 
//---- uncomment the following block to compile ----
//#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
//#ifndef __cpp_char8_t
//typedef unsigned char char8_t;
//#endif
//#endif
int main() { char8_t a; printf("%ld\n", (long)__STDC_VERSION__); return 0; }

$ gcc --version
gcc (Spack GCC) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

##  show glibc version
$ ldd --version   
ldd (GNU libc) 2.34
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

$ gcc foo.c -o foo
foo.c: In function 'main':
foo.c:9:14: error: unknown type name 'char8_t'; did you mean 'char'?
    9 | int main() { char8_t a; printf("%ld\n", (long)__STDC_VERSION__); return 0; }
      |              ^~~~~~~
      |              char

Signed-off-by: Cameron Smith <smithc11@rpi.edu>
@evanramos-nvidia

Copy link
Copy Markdown
Collaborator

@cwsmith Thanks for the report and for the proposal! I believe there is a better way to approach this fix. Could you test my branch char8_t to see if it resolves the build failure on your system? https://github.com/NVIDIA/NVTX/tree/char8_t

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.

2 participants