Unable to use 440 nvidia driver on ubuntu 20.04 and xps 15 7590

Hi I am trying to use the 440 nvidia driver on my dell xps 15 7590 machine instead of default X.Org X server for my GeForce GTX 1650. When I try to do that I get:
Done.
Loading new nvidia-440.100 DKMS files…
Building for 5.4.0-42-generic
Building for architecture x86_64
Building initial module for 5.4.0-42-generic
ERROR: Cannot create report: [Errno 17] File exists: ‘/var/crash/nvidia-dkms-440.0.crash’
Error! Bad return status for module build on kernel: 5.4.0-42-generic (x86_64)
Consult /var/lib/dkms/nvidia/440.100/build/make.log for more information.
dpkg: error processing package nvidia-dkms-440 (–configure):
installed nvidia-dkms-440 package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-440:
nvidia-driver-440 depends on nvidia-dkms-440 (<= 440.100-1); however:
Package nvidia-dkms-440 is not configured yet.
nvidia-driver-440 depends on nvidia-dkms-440 (>= 440.100); however:
Package nvidia-dkms-440 is not configured yet.

dpkg: error processing package nvidia-driver-440 (–configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for initramfs-tools (0.136ubuntu6.2) …
update-initramfs: Generating /boot/initrd.img-5.4.0-42-generic
Errors were encountered while processing:
nvidia-dkms-440
nvidia-driver-440
E: Sub-process /usr/bin/dpkg returned an error code (1)

Or when using Software&Updates: Screenshot from 2020-07-23 12-47-55
nvidia-bug-report.log.gz (122.9 KB)

I found out after inspecting the make logs of the driver that since my system had clang as the default compiler it failed to compile the drivers. I changed my default compiler to gcc and the drivers installed correctly. I am not sure why it failed with clang though…