Cannot install Nvidia driver 430 in Ubuntu 24.04

I have a notebook with an Nvidia GeForce GT 640M video card. According to the Nvidia Drivers Download page, the latest driver for this model is the 430.40 driver.

I installed Ubuntu 24.04 in the notebook and realize that it has no native support for this driver, therefore it is not possible to install it through the usual Additional Drivers tab in the Ubuntu update manager.

Thus, I downloaded the manual installer (NVIDIA-Linux-x86_64-430.40.run) and tried to install it, but I found a problem when trying to compile the kernel module.

The error is the following:

In file included from /var/lib/dkms/nvidia/430.40/build/nvidia/nv-frontend.c:12:
/var/lib/dkms/nvidia/430.40/build/common/inc/os-interface.h:27:10: fatal error: stdarg.h: Arquivo ou diretório inexistente
   27 | #include <stdarg.h>
      |          ^~~~~~~~~~

However, the “apparently missing” header file does exist in:

/usr/lib/gcc/x86_64-linux-gnu/13/include/stdarg.h

So, what’s wrong?

Kernel version is 6.8.0-39