I have a kernel module that was registered with dkms. When a recent upgrade bumped my kernel to 4.15.0-50 I started getting the below error from dkms. Apparently kernel 4.15.0-50 was compiled with gcc version 7.3.0, but part of the upgrade involved installing a new version of gcc (7.4.0), which is causing dkms to fail. gcc 7.3 is no longer available on my system. How do I install gcc 7.3 in addition to 7.4, or even downgrade 7.4 to 7.3?
DKMS make.log for nvidia-430.14 for kernel 4.15.0-50-generic (x86_64) Tue May 14 17:08:12 CDT 2019 make: Entering directory '/usr/src/linux-headers-4.15.0-50-generic' Makefile:976: "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" SYMLINK /var/lib/dkms/nvidia/430.14/build/nvidia/nv-kernel.o SYMLINK /var/lib/dkms/nvidia/430.14/build/nvidia-modeset/nv-modeset-kernel.o Compiler version check failed: The major and minor number of the compiler used to compile the kernel: gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3) does not match the compiler used here: cc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It is recommended to set the CC environment variable to the compiler that was used to compile the kernel. The compiler version check can be disabled by setting the IGNORE_CC_MISMATCH environment variable to "1". However, mixing compiler versions between the kernel and kernel modules can result in subtle bugs that are difficult to diagnose. *** Failed CC version check. Bailing out! *** /var/lib/dkms/nvidia/430.14/build/Kbuild:182: recipe for target 'cc_version_check' failed make: *** [cc_version_check] Error 1 make: *** Waiting for unfinished jobs.... Makefile:1552: recipe for target '_module_/var/lib/dkms/nvidia/430.14/build' failed make: *** [_module_/var/lib/dkms/nvidia/430.14/build] Error 2 make: Leaving directory '/usr/src/linux-headers-4.15.0-50-generic' Makefile:81: recipe for target 'modules' failed make: *** [modules] Error 2