Skip to content

nvtx: support libc without char8_t#4531

Open
cwsmith wants to merge 2 commits into
spack:developfrom
SCOREC:cws/nvtxChar8
Open

nvtx: support libc without char8_t#4531
cwsmith wants to merge 2 commits into
spack:developfrom
SCOREC:cws/nvtxChar8

Conversation

@cwsmith

@cwsmith cwsmith commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a compilation issue with the nvtx 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).

A PR to the nvtx repo is here: NVIDIA/NVTX#163

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

@thomas-bouvier thomas-bouvier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution.

@becker33

becker33 commented May 5, 2026

Copy link
Copy Markdown
Member

It looks like this is trying to build python components even when ~python.

I think it's missing a conditional around the pip call for whether python is enabled.

@sethrj sethrj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@becker33 Shouldn't this be using the .patch file from the GitHub PR rather than a file filter?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants