Unable to install the nvidia drivers 440.100

So I downloaded the nvidia driver runfile and tried to install the driver using this guide and also blacklisted the driver in grub but I still cannot install the driver. I ran sudo ./NVIDIA-Linux-x86_64-440.100.run --dkms --no-opengl-files and it fails on the dkms installation. The log reads
DKMS make.log for nvidia-440.100 for kernel 5.7.11-200.fc32.x86_64 (x86_64)
Thu Aug 6 17:28:07 IST 2020
make[1]: Entering directory ‘/usr/src/kernels/5.7.11-200.fc32.x86_64’
SYMLINK /var/lib/dkms/nvidia/440.100/build/nvidia/nv-kernel.o

Compiler version check failed:

The major and minor number of the compiler used to
compile the kernel:

gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC), GNU ld version 2.34-4.fc32

does not match the compiler used here:

SYMLINK /var/lib/dkms/nvidia/440.100/build/nvidia-modeset/nv-modeset-kernel.o
cc (GCC) 10.0.1 20200328 (Red Hat 10.0.1-0.11)
Copyright (C) 2020 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! ***

make[2]: *** [/var/lib/dkms/nvidia/440.100/build/Kbuild:191: cc_version_check] Error 1
make[2]: *** Waiting for unfinished jobs…
make[1]: *** [Makefile:1732: /var/lib/dkms/nvidia/440.100/build] Error 2
make[1]: Leaving directory ‘/usr/src/kernels/5.7.11-200.fc32.x86_64’
make: *** [Makefile:81: modules] Error 2

I am on fedora 32 kernel 5.7.11 and using a gtx 1650 ti. Also please do not tell to use rpmfusion drivers or negativo17 for that matter beacuse when I tried to install them they could not install beacuse dependency hell.
Edit :- I forgot to mention that when I compiled the kernel from source on fedora a few weeks ago beacuse fedora used kernel 5.6 which did not play well with my new amd integrated gpu whose support was in kernel 5.8 and I compiled release candidiate 7 and was able to install the drivers. I removed the compiled kernel once kernel 5.7 was availballe int the fedora repos which had better support for my new hardware but I am not compiling the kernel again even though it takes only 15 minutes I don’t wanna lose support for the fedora packages.

So I decided to debug the driver issue myself. After going through a lot of google search pages. I found this thread here and the first post said to run it with --no-cc-version-check and i ran sudo ./NVIDIA-Linux-x86_64-440.100.run --dkms --no-opengl-files and the kernel module was built and installed. Also I came to know that there is new driver version available I haven’t tested this solution with the new driver I will edit the post and let you know if this issue persists in the new driver version and if it does does this solution work or something else is reuqired

1 Like