/var/lib/dkms/nvidia/346.35/build/nv-pat.c: In function ‘nv_disable_caches’:
/var/lib/dkms/nvidia/346.35/build/nv-pat.c:38:5: error: implicit declaration of function ‘read_cr4’ [-Werror=implicit-function-declaration]
*cr4 = read_cr4();
/var/lib/dkms/nvidia/346.35/build/nv-pat.c:39:5: error: implicit declaration of function ‘write_cr4’ [-Werror=implicit-function-declaration]
if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
I’m still having trouble building the nvidia module for Linux 4.0.0-rc1. I’ve applied this patch to the nvidia 346.47 drivers. Inside /usr/src/NVIDIA-Linux-x86_64-346.47/kernel I run:
# make SYSSRC=/usr/src/linux-4.0.0-rc1/
Lots of stuff happens, then I get the following output:
make: Leaving directory '/usr/src/linux-4.0.0-rc1'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
nvidia-modules-common.mk:248: recipe for target 'module' failed
make: *** [module] Error 1
There don’t seem to be any errors in the output that I can find. I’ve repackaged the driver back into a NVIDIA-Linux-x86_64-346.47-patched.run using makeself.sh. This also fails to build, and the log in /var/log/nvidia-installer.log files says that it can’t find include/generated/autoconf.h or include/config/auto.conf.
I’m pretty new to building kernels. I thought I installed everything correctly. I built Linux 4.0 with make deb-pkg, then installed the headers and image. The autoconf files are in the correct directories. I tried giving the paths to the source and headers to the nvidia build, but I keep failing on nvidia-modules-common.mk.
I’ve never had an issue building for 3.16.1 and from what I can tell I’ve done everything the same for 4.0. But both drivers (using the repackaged .run installer) install fine on 3.16.1.
Just to update. Apparently performing a make clean removes conftest/. For some reason conftest.sh was not generating this directory during the build. Not sure why. I don’t think it could determine the kernel version for some reason. I’m not sure that it uses the correct kernel source directory. Building 4.0 on Linux 3.16.1; only speculation.
I attempted to build the nvidia module under 3.16.1 source. While it failed eventually, it got far enough to create conftest/ for me. Going back to build with 4.0 source everything seemed to work fine. I used the nvidia-installer at this point, and I’m now running just fine. I’m curious about why the whole thing wouldn’t build, but that will be for another day.
I am struggling to find the right version of nv-pat.c to edit. I’m assuming there is one inside my NVIDIA-Linux-x86_64-340.76.run file that overwrites the ones in /var/lib/dkms/nvidia/340.76/build/. I’m just not sure where to make the change so that when I execute NVIDIA-Linux-x86_64-340.76.run, my change is taken.
jlflammia: I think what’s you’re looking for is
$sh ./NVIDIA-Linux-x86_64-340.76.run --extract-only
Replace 340.76 if necessary with whatever version you’re using. You get a directory with all of the sources, nv-pat.c is under the kernel subfolder.
If you want to proceed with the standard installation, run (from the root of the source directory)
This is probably coming late and hopefully you worked this out by now, but seeing no response I figured I’d tell you just in case.
translucent: I’ve been trying to get this thing to build for the better part of a very frustrating day, getting the same “failed to build” with no errors!; still trying to get my GTX 970 to run Xorg on a Linux From Scratch system and I’m hoping this will do it. I have my nvidia.ko now at least, thanks to you! (I also used the suggestion by andresu so thanks to you as well!)
The problem seems to be fixed in 340.93
I dropped the “fixes-for-kernel-4.0.0.patch” in the debian 340.76 package (added in 340.76-2) and rebuild it with 340.93.
Tested against 3.16, 3.18 and 4.1. No errors and works great!