RHEL/Rocky 8 ERROR: You do not appear to have libc header files installed on your system. Please install your distribution's libc development package

I’ve been trying to install the nvidia driver (NVIDIA-Linux-x86_64-470.141.03.run) for my K80’s on one of my GPU nodes. When I try to install, I get the error:
ERROR: You do not appear to have libc header files installed on your system. Please install your distribution’s libc development package.

I have glibc and glibc-devel installed for both x86_64 and i686. I have kernel and kernel-devel installed.
I can’t seem to figure out what it wants.

The -devel packages contain the sources, to get the headers, please install the -headers packages.
Furthermore, you should rather use a repo like elrepo or rpmfusion to install the nvidia driver.

All headers are also installed:
# rpm -qa |grep headers
glibc-headers-2.28-189.5.el8_6.x86_64
kernel-headers-4.18.0-372.19.1.el8_6.x86_64
glibc-headers-2.28-189.5.el8_6.i686

I also tried installing the rpmfusion driver before and nvidia-smi failed to find the driver.
# nvidia-smi
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

That’s what lead me to try to install from NVIDIA.

Please run nvidia-bug-report.sh as root and attach the resulting nvidia-bug-report.log.gz file to your post.

I finally got his running. Despite the headers warning, they were installed, but I ran this and it finally installed:

dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

I then had some issues that the kernel directory was empty, so I had to install it again:

yum install "kernel-devel-uname-r == $(uname -r)"