Installing Linux Display Drivers on Ubuntu 19.10 compile error

Hi

I am not sure if this is the correct place to post this, apologies if it isn’t.

I have a GTX 1660 Ti, and Ubuntu 19.10. I am running the nvidia-driver-418 from the ppa. It works fantastically for my 5.3.0 kernel.

However, I have installed the latest 5.6-rc4 (or rc1,2,3 I have tried all of them). And my X server does not startup (Login loop). This is with the ppa 418 driver installed. (which works fine with the older 5.3 kernel)

So I saw that the latest 440.64 driver supports the RC of 5.6 ( https://www.phoronix.com/scan.php?page=news_item&px=NVIDIA-440.64-Linux-Driver )

and I am attempting to build it (from 5.6 kernel, init level 3). However, I am getting a lot of compile errors.

sudo ./NVIDIA-Linux-x86_64-440.64.run
/tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/linux_nvswitch.c:1583:5: error: implicit declaration of function 'getnstimeofday'; did you mean 'efi_gettimeofday'? [-Werror=implicit-function-declaration]
 1583 |     getnstimeofday(&ts);
      |     ^~~~~~~~~~~~~~
      |     efi_gettimeofday
make[2]: *** [scripts/Makefile.build:268: /tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/nvlink_linux.o] Error 1
/tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/os-interface.c: In function '_os_ipmi_receive_resp':
/tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/os-interface.c:1957:29: error: storage size of 'tv' isn't known
 1957 |     struct timeval          tv;
      |                             ^~
/tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/os-interface.c:1957:29: warning: unused variable 'tv' [-Wunused-variable]
/tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/linux_nvswitch.c:1584:21: error: implicit declaration of function 'timespec_to_ns'; did you mean 'timespec64_to_ns'? [-Werror=implicit-function-declaration]
 1584 |     return ((NvU64) timespec_to_ns(&ts));
      |                     ^~~~~~~~~~~~~~
      |                     timespec64_to_ns
/tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/linux_nvswitch.c:1581:21: warning: unused variable 'ts' [-Wunused-variable]
 1581 |     struct timespec ts;
      |                     ^~
cc1: some warnings being treated as errors
/tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/linux_nvswitch.c:1585:1: warning: control reaches end of non-void function [-Wreturn-type]
 1585 | }
      | ^
make[2]: *** [scripts/Makefile.build:268: /tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/os-interface.o] Error 1
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:268: /tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/linux_nvswitch.o] Error 1
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:268: /tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel/nvidia/nv-procfs.o] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1681: /tmp/selfgz1311/NVIDIA-Linux-x86_64-440.64/kernel] Error 2
make[1]: Target 'modules' not remade because of errors.
make[1]: Leaving directory '/usr/src/linux-headers-5.6.0-050600rc3-generic'
make: *** [Makefile:81: modules] Error 2
ERROR: The nvidia kernel module was not created.
ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.  You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

This goes on and on and on.

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.2.1-9ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)
cat /proc/version
Linux version 5.3.0-40-generic (buildd@lcy01-amd64-026) (gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)) #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020

I think my issue might be the wrong GCC version, but I can’t find anything in the README to indicate what version I need.

Any help would be greatly appreciated.

Your GCC version is most likely just fine. The issue is that the article on Phoronix is a tad misleading – or rather, the release comment on the new driver is a bit off. The new driver “supports” 5.6 only in so much that it works with the missing ioremap_nocache function that 5.6-rc1 removed. For the rest of the list of changes that 5.6 introduced, including the y2038 changes of rc3, you still need to patch the driver.

My own patch for 5.6-rc3 (including rc4) isn’t exactly pretty, but it seems to work fine. Should you wish to give it a try, it’s here:
https://gitlab.com/snippets/1945940

Thank you! That was exactly the problem.

I extracted the source, applied the patch, and ran the installer as you described in your snippet, and it worked perfectly for me with rc4.

Thank you so much for your help!