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[1]: 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

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[2]: *** [cc_version_check] Error 1
make[2]: *** Waiting for unfinished jobs....
Makefile:1552: recipe for target '_module_/var/lib/dkms/nvidia/430.14/build' failed
make[1]: *** [_module_/var/lib/dkms/nvidia/430.14/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-50-generic'
Makefile:81: recipe for target 'modules' failed
make: *** [modules] Error 2
  • Nvidia 430 is beta software, and as such may have issues with newer versions of kernel/gcc. Remove 430 and try the previous version 418. Report back.
    – heynnema
    May 15, 2019 at 16:30
  • 1
    @heynnema 'Latest Long Lived Branch Version: 430.14' nvidia.com/object/unix.html
    – andrew.46
    May 18, 2019 at 7:43
  • @andrew.46 When I wrote the comment, 430.09 had been marked as beta, and 430.14 had just been released that same day. We all know how stable the Nvidia drivers have been.... :-(
    – heynnema
    May 18, 2019 at 12:41
  • @heynnema the error is that the kernel was compiled with a version of gcc that is no longer available on the system. The reason I was trying nvidia 430 was because my previously installed nvidia 418 driver had failed (with this same error, it turns out), when I apt-get upgraded and 4.15.0-50 and/or gcc 7.4 got installed. (I believe 4.15.0-47 was the previous kernel version, with which 418 had installed with no problem) @wineunuuchs2unix's answer is the correct one for the question I asked (which is about DKMS install failing independent of the module being installed) May 20, 2019 at 2:12
  • and @klaphark's answer is correct for the case of the Nividia installer which I happened to use as the example in my question. May 20, 2019 at 2:13

3 Answers 3


Instead of installing multiple versions of gcc you can pass the following option to the nvidia installer:


Worked for me on Ubuntu 18.04.2, kernel 4.18.0-20 and nvidia 430.14.


As per this lengthy Debian report bug enter:


before upgrading.


I was given the option, in my case, to compile anyways but the installation failed. I think I need gcc 7.3. I was wondering if there was an option with the gcc 7.4 compiler to compile at v. 7.3.

Somebody else said you need to have the header files, but I received an error message when I attempted to add them.

As it stands, I would prefer to have the gcc 7.3 compiler, because I don't have much need for the gcc 7.4 compiler. I was not sure how to address this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.