On Ubuntu 16.04, I set the clang-4.0 compiler has been set as default for cc and c++ (using the update-alternatives command which replaces the /usr/bin/cc and /usr/bin/c++ symlinks).
With the system set up that way, I installed one of the nvidia drivers using apt. (Tried with multiple versions, 369, 390, others) It seems that during the installation process it compiles kernel modules.
Then the modules don’t seem to work proberly. I cannot login with lightdm (it does not launch the session and returns to the login screen.) “/var/log/lightdm/seat0-greeter.log” reports a “Resource temporarily unavailable (11)” error from the X11 driver.
“modprobe nvidia” also fails, and “dmesg” reports “nvidia: Unknown symbol count (err 0)”.
If gcc is selected as compiler, it seems to work correctly.