Since the new gcc6 version (6.2.0) the compile script fails with the following message:
/var/lib/dkms/nvidia/367.44/build/nvidia/nv-frontend.c:1:0: error: code
model <b>kernel does not support PIC mode</b>
I have also tried the lastest driver (367.57), two different kernels (4.7 and 4.8) and with and w/o DKMS support, same error. I could solve the problem by adding these lines to the /usr/src/linux-headers-4.x.x.x-common/Makefile file.
KBUILD_CFLAGS += $(call cc-option, -fno-pie)
KBUILD_CFLAGS += $(call cc-option, -no-pie)
KBUILD_AFLAGS += $(call cc-option, -fno-pie)
KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)
Source: Re: Update to Sid, and cannot compile Nvidia module; PIC mode?
Is there a way to change the NVIDIA-Linux-x86_64-xxx.xx.run script instead of the system wide makefile?