# nvidia-drivers-340.76 fails to compile with kernel 4.0.5

## JanErik

Seems something has changed here? No newer driver is supported by my GPU.

```
/usr/src/linux-4.0.5-gentoo/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’

 # define likely(x) __builtin_expect(!!(x), 1)

                                        ^

In file included from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/stddef.h:1:0,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/stddef.h:4,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/posix_types.h:4,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/types.h:13,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/types.h:5,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/capability.h:16,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/capability.h:15,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/sched.h:15,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/utsname.h:5,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-linux.h:44,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-vm.c:14:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h: In function ‘copy_from_user’:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h:712:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  if (likely(sz < 0 || sz >= n))

                          ^

/usr/src/linux-4.0.5-gentoo/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’

 # define likely(x) __builtin_expect(!!(x), 1)

                                        ^

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h: In function ‘copy_to_user’:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h:730:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  if (likely(sz < 0 || sz >= n))

                          ^

/usr/src/linux-4.0.5-gentoo/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’

 # define likely(x) __builtin_expect(!!(x), 1)

                                        ^

In file included from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/stddef.h:1:0,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/stddef.h:4,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/posix_types.h:4,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/types.h:13,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/types.h:5,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/capability.h:16,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/capability.h:15,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/sched.h:15,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/utsname.h:5,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-linux.h:44,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-vtophys.c:15:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h: In function ‘copy_from_user’:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h:712:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  if (likely(sz < 0 || sz >= n))

                          ^

/usr/src/linux-4.0.5-gentoo/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’

 # define likely(x) __builtin_expect(!!(x), 1)

                                        ^

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h: In function ‘copy_to_user’:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h:730:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  if (likely(sz < 0 || sz >= n))

                          ^

/usr/src/linux-4.0.5-gentoo/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’

 # define likely(x) __builtin_expect(!!(x), 1)

                                        ^

In file included from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/stddef.h:1:0,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/stddef.h:4,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/posix_types.h:4,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/types.h:13,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/types.h:5,

                 from /usr/src/linux-4.0.5-gentoo/include/uapi/linux/capability.h:16,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/capability.h:15,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/sched.h:15,

                 from /usr/src/linux-4.0.5-gentoo/include/linux/utsname.h:5,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-linux.h:44,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/os-interface.c:15:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h: In function ‘copy_from_user’:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h:712:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  if (likely(sz < 0 || sz >= n))

                          ^

/usr/src/linux-4.0.5-gentoo/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’

 # define likely(x) __builtin_expect(!!(x), 1)

                                        ^

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h: In function ‘copy_to_user’:

/usr/src/linux-4.0.5-gentoo/arch/x86/include/asm/uaccess.h:730:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  if (likely(sz < 0 || sz >= n))

                          ^

/usr/src/linux-4.0.5-gentoo/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’

 # define likely(x) __builtin_expect(!!(x), 1)

                                        ^

/usr/src/linux-4.0.5-gentoo/Makefile:1390: recipe for target '_module_/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel' failed

make[2]: *** [_module_/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel] Error 2

make[2]: Leaving directory '/usr/src/linux-4.0.5-gentoo'

Makefile:145: recipe for target 'sub-make' failed

make[1]: *** [sub-make] Error 2

make[1]: Leaving directory '/usr/src/linux-4.0.5-gentoo'

NVIDIA: left KBUILD.

nvidia.ko failed to build!

Makefile:181: recipe for target 'nvidia.ko' failed

make: *** [nvidia.ko] Error 1

 * ERROR: x11-drivers/nvidia-drivers-340.76::gentoo failed (compile phase):

 *   emake failed

 * 

 * If you need support, post the output of `emerge --info '=x11-drivers/nvidia-drivers-340.76::gentoo'`,

 * the complete build log and the output of `emerge -pqv '=x11-drivers/nvidia-drivers-340.76::gentoo'`.

 * The complete build log is located at '/var/log/portage/x11-drivers:nvidia-drivers-340.76:20150609-180408.log'.

 * For convenience, a symlink to the build log is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/temp/environment'.

 * Working directory: '/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel'

 * S: '/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/
```

----------

## kernelOfTruth

Patch available at both:

https://devtalk.nvidia.com/default/topic/827836/-bug-nvidia-340-76-build-on-linux-64-fails-after-upgrade-of-kernel-v3-19-4-gt-v4-0-0/

https://forums.gentoo.org/viewtopic-p-7732136.html#7732136

----------

## JanErik

Oh, I searched but did not see it, obv too old thread.

Anyway, giving Nouveau a try once more for now, had some random lockups in the past together with Virtualbox and/or full-screen video, but it seems to work better.

----------

## kernelOfTruth

Yes,

things seem to have been a bit bumpy recently (3.17* worked fine for me - I skipped 3.18, 3.19 was rather prone to lock up X, skipped 4.0, 4.1-rc* is fine with nouveau)

----------

