# nvidia-drivers-343.22-r2 on 3.14.14-gentoo does not compile

## New User

I have a fresh x86_64 install and when emerging the Nvidia driver, I get errors.  On previous systems, I never had an issue although this is my first experience with 64 bit.  I am noticing the PAX messages but don't know enough to say whether that is the real issue. Everything else on the system appears to be working well.  

CPU:

Intel(R) Core(TM) i7-5960X CPU @ 3.00GHz

Here is the build log:

```

^[[32;01m * ^[[39;49;00mPackage:    x11-drivers/nvidia-drivers-343.22-r2

^[[32;01m * ^[[39;49;00mRepository: gentoo

^[[32;01m * ^[[39;49;00mMaintainer: jer@gentoo.org

^[[32;01m * ^[[39;49;00mUSE:        abi_x86_64 amd64 elibc_glibc kernel_linux multilib pax_kernel userland_GNU

^[[32;01m * ^[[39;49;00mFEATURES:   preserve-libs sandbox userpriv usersandbox

 ^[[32;01m*^[[0m Determining the location of the kernel source code

 ^[[32;01m*^[[0m Found kernel source directory:

 ^[[32;01m*^[[0m     /usr/src/linux

 ^[[32;01m*^[[0m Found kernel object directory:

 ^[[32;01m*^[[0m     /lib/modules/3.14.14-gentoo/build

 ^[[32;01m*^[[0m Found sources for kernel version:

 ^[[32;01m*^[[0m     3.14.14-gentoo

>>> Unpacking source...

>>> Unpacking NVIDIA-Linux-x86_64-343.22.run to /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work

>>> Source unpacked in /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work

>>> Preparing source in /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work ...

 ^[[33;01m*^[[0m Using PAX patches is not supported. You will be asked to

 ^[[33;01m*^[[0m use a standard kernel should you have issues. Should you

 ^[[33;01m*^[[0m need support with these patches, contact the PaX team.

 ^[[32;01m*^[[0m Applying nvidia-drivers-331.13-pax-usercopy.patch ...

^[[A^[[72C ^[[34;01m[ ^[[32;01mok^[[34;01m ]^[[0m

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work ...

 ^[[32;01m*^[[0m Preparing nvidia module

make HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' ARCH=x86_64 IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/lib/modules/3.14.14-gentoo/build CC=x86_64-pc-linux-gnu-gcc clean module

NVIDIA: calling KBUILD...

make[1]: Entering directory `/usr/src/linux-3.14.14-gentoo'

make -C /lib/modules/3.14.14-gentoo/build \

KBUILD_SRC=/usr/src/linux-3.14.14-gentoo \

KBUILD_EXTMOD="/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel" -f /usr/src/linux-3.14.14-gentoo/Makefile \

modules

test -e include/generated/autoconf.h -a -e include/config/auto.conf || (                \

echo >&2;                                                       \

echo >&2 "  ERROR: Kernel configuration is invalid.";           \

echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\

echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";      \

echo >&2 ;                                                      \

/bin/false)

mkdir -p /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/.tmp_versions ; rm -f /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/.tmp_versions/*

make -f /usr/src/linux-3.14.14-gentoo/scripts/Makefile.build obj=/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel

  x86_64-pc-linux-gnu-gcc -Wp,-MD,/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/.nv.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include -I/usr/src/linux-3.14.14-gentoo/arch/x86/include -Iarch/x86/include/generated  -I/usr/src/linux-3.14.14-gentoo/include -Iinclude -I/usr/src/linux-3.14.14-gentoo/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/usr/src/linux-3.14.14-gentoo/include/uapi -Iinclude/generated/uapi -include /usr/src/linux-3.14.14-gentoo/include/linux/kconfig.h   -I/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mno-mmx -mno-sse -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -DNV_MODULE_INSTANCE=0 -DNV_BUILD_MODULE_INSTANCES=0 -UDEBUG -U_DEBUG -DNDEBUG   -I/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel -Wall -MD -Wsign-compare -Wno-cast-qual -Wno-error -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"343.22\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -D__linux__ -DNV_DEV_NAME=\"nvidia\"  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(nv)"  -D"KBUILD_MODNAME=KBUILD_STR(nvidia)" -c -o /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.o /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.c

In file included from /usr/src/linux-3.14.14-gentoo/include/linux/kernel.h:10:0,

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

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

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

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.c:13:

/usr/src/linux-3.14.14-gentoo/include/linux/bitops.h: In function 'hweight_long':

/usr/src/linux-3.14.14-gentoo/include/linux/bitops.h:77:41: warning: signed and unsigned type in conditional expression [-Wsign-compare]

In file included from /usr/src/linux-3.14.14-gentoo/arch/x86/include/asm/cpumask.h:4:0,

                 from /usr/src/linux-3.14.14-gentoo/arch/x86/include/asm/msr.h:10,

                 from /usr/src/linux-3.14.14-gentoo/arch/x86/include/asm/processor.h:20,

                 from /usr/src/linux-3.14.14-gentoo/arch/x86/include/asm/thread_info.h:22,

                 from /usr/src/linux-3.14.14-gentoo/include/linux/thread_info.h:54,

                 from /usr/src/linux-3.14.14-gentoo/arch/x86/include/asm/preempt.h:6,

                 from /usr/src/linux-3.14.14-gentoo/include/linux/preempt.h:20,

                 from /usr/src/linux-3.14.14-gentoo/include/linux/spinlock.h:50,

                 from /usr/src/linux-3.14.14-gentoo/include/linux/seqlock.h:35,

                 from /usr/src/linux-3.14.14-gentoo/include/linux/time.h:5,

                 from /usr/src/linux-3.14.14-gentoo/include/uapi/linux/timex.h:56,

                 from /usr/src/linux-3.14.14-gentoo/include/linux/timex.h:56,

                 from /usr/src/linux-3.14.14-gentoo/include/linux/sched.h:17,

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

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

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.c:13:

/usr/src/linux-3.14.14-gentoo/include/linux/cpumask.h: In function 'cpumask_parse':

/usr/src/linux-3.14.14-gentoo/include/linux/cpumask.h:603:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]

In file included from /usr/src/linux-3.14.14-gentoo/include/linux/poll.h:11:0,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv-linux.h:97,

                 from /var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.c:13:

/usr/src/linux-3.14.14-gentoo/arch/x86/include/asm/uaccess.h: In function 'copy_from_user':

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

/usr/src/linux-3.14.14-gentoo/arch/x86/include/asm/uaccess.h: In function 'copy_to_user':

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

/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.c: In function 'nvidia_init_module':

/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.c:740:5: error: 'SLAB_USERCOPY' undeclared (first use in this function)

/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.c:740:5: note: each undeclared identifier is reported only once for each function it appears in

make[3]: *** [/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel/nv.o] Error 1

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

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

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

NVIDIA: left KBUILD.

nvidia.ko failed to build!

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

 ^[[31;01m*^[[0m ERROR: x11-drivers/nvidia-drivers-343.22-r2::gentoo failed (compile phase):

 ^[[31;01m*^[[0m   emake failed

 ^[[31;01m*^[[0m

 ^[[31;01m*^[[0m If you need support, post the output of `emerge --info '=x11-drivers/nvidia-drivers-343.22-r2::gentoo'`,

 ^[[31;01m*^[[0m the complete build log and the output of `emerge -pqv '=x11-drivers/nvidia-drivers-343.22-r2::gentoo'`.

 ^[[31;01m*^[[0m The complete build log is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/temp/build.log'.

 ^[[31;01m*^[[0m The ebuild environment file is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/temp/environment'.

 ^[[31;01m*^[[0m Working directory: '/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/kernel'

 ^[[31;01m*^[[0m S: '/var/tmp/portage/x11-drivers/nvidia-drivers-343.22-r2/work/'

```

And here is my emerge info:

```

localhost ~ # emerge --info '=x11-drivers/nvidia-drivers-343.22-r2::gentoo'

Portage 2.2.8-r2 (hardened/linux/amd64, gcc-4.7.3, glibc-2.19-r1, 3.14.14-gentoo x86_64)

=================================================================

                        System Settings

=================================================================

System uname: Linux-3.14.14-gentoo-x86_64-Intel-R-_Core-TM-_i7-5960X_CPU_@_3.00GHz-with-gentoo-2.2

KiB Mem:    16330084 total,  15035792 free

KiB Swap:    3156768 total,   3156768 free

Timestamp of tree: Sun, 05 Oct 2014 23:15:01 +0000

ld GNU ld (Gentoo 2.23.2 p1.0) 2.23.2

app-shells/bash:          4.2_p52

dev-lang/perl:            5.18.2-r1

dev-lang/python:          2.7.7, 3.3.5-r1

dev-util/cmake:           2.8.12.2-r1

dev-util/pkgconfig:       0.28-r1

sys-apps/baselayout:      2.2

sys-apps/openrc:          0.12.4

sys-apps/sandbox:         2.6-r1

sys-devel/autoconf:       2.69

sys-devel/automake:       1.11.6, 1.13.4

sys-devel/binutils:       2.23.2

sys-devel/gcc:            4.7.3-r1

sys-devel/gcc-config:     1.7.3

sys-devel/libtool:        2.4.2-r1

sys-devel/make:           3.82-r4

sys-kernel/linux-headers: 3.13 (virtual/os-headers)

sys-libs/glibc:           2.19-r1

Repositories: gentoo

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=core-avx2"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -pipe -march=core-avx2"

DISTDIR="/usr/portage/distfiles"

EMERGE_DEFAULT_OPTS="--autounmask=y"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://mirror.mcs.anl.gov/pub/gentoo/ rsync://mirror.mcs.anl.gov/gentoo/ ftp://gentoo.chem.wisc.edu/gentoo/ rsync://gentoo.chem.wisc.edu/gentoo/ http://mirrors.cs.wmich.edu/gentoo http://www.cyberuse.com/gentoo/ http://mirror.datapipe.net/gentoo http://www.gtlib.gatech.edu/pub/gentoo rsync://rsync.gtlib.gatech.edu/gentoo ftp://ftp.gtlib.gatech.edu/pub/gentoo ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ rsync://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://lug.mtu.edu/gentoo/ rsync://mirrors.rit.edu/gentoo/ ftp://mirrors.rit.edu/gentoo/ http://mirrors.rit.edu/gentoo/ ftp://mirror.iawnet.sandia.gov/pub/gentoo/ http://mirror.iawnet.sandia.gov/gentoo/ ftp://ftp.lug.udel.edu/pub/gentoo/ http://mirror.lug.udel.edu/pub/gentoo/ rsync://gentoo.cs.uni.edu/gentoo-distfiles http://gentoo.cs.uni.edu/ ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org"

LANG="en_US"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"

USE="acl alsa amd64 berkdb bindist bzip2 cli cracklib crypt cxx dri gdbm hardened iconv ipv6 justify mmx modules multilib ncurses nls nptl openmp pam pax_kernel pcre readline session sse sse2 ssl tcpd unicode urandom xattr xtpax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

----------

## Roman_Gruber

Usually the nvidia-driver works most of the time only with a kernel older as the release date of the nvidia-drivers.

the nvidia-driver package compiles a layer so the binary blob can work with the kernel. as the kernel often changes or the binary driver, they have to fit together. you could find the culprit in the kernel source or wait for a newer nvidia release.

usually you need a new patch for one of the two packages to get it working.

if you do not need that kernel release, use an older one

----------

## tomtom69

nvidia-drivers complains because either /usr/src/linux-3.14.14-gentoo/include/generated/autoconf.h or /usr/src/linux-3.14.14-gentoo/include/config/auto.conf are missing.

Normally these files are present when the kernel was built properly.

Did you compile kernel 3.14.14 on this machine successfully?

Did you try to follow the instructions: "make oldconfig && make prepare" in your kernel src directory (3.14.14)?

----------

## New User

While tw04l124's response sounds like the right answer for me, I'll respond to your's (tomtom69) to be thorough.

Yes, I compiled the kernel as I have done hundreds of time before with:

```
make && make modules_install
```

I didn't get any errors and it boots without any errors.

I tried the instruction to make the old config and that made no difference (even ran the command as recommended).

I am assuming that due to the other warning about PAX patches, which I believe the gentoo-sources contain, an additional specialized/custom patch needs to be added in the ebuild for the nvidia drivers to work.  Since the relavent kernel code has probably changed with the kernel version, I just have to wait for the expert to update that patch. 

If my assumption is correct, I would wonder why the ebuild doesn't specify the kernel version and alert on that.

----------

## Roman_Gruber

 *New User wrote:*   

> 
> 
> If my assumption is correct, I would wonder why the ebuild doesn't specify the kernel version and alert on that.

 

this is not that easy. I had it only once after I and several others run into issues that portage downgraded the nvidia-drivers.

Bear in mind not everone has a gpu from nvidia and uses the binary blob with the newest kernel.

Running unstable brings you such issues, although sometimes running stable can bring you troubles too, but I think thats very rare.

Also teh binary driver claims to work with every card supported but I highly doubt that, I had in the past some versions which did not work well but that was 2 years ago.

AS nvidia cards mostly only run on teh binary driver and they are not that convinced to help to develop an open source driver we are forced to deal with such issues  :Sad: 

----------

## New User

I have been working on this for a while.  I emerged and compiled gentoo-sources-3.12.21 r1 and got the very same results. I also tried the previous two nvidia-drivers versions (340.46 and 340.32-r1) and got the exact same results.

Then I tried the vanilla sources (3.17.0 and even back to 3.2.63) and still got the very same results.

So I am starting to believe that there is something wrong with the way I am building my kernel.  As a rule, i generally do not remove anything from the defaults in the menuconfig - I only add drivers for my hardware.  Is there something else that the kernel needs to have in order for the nvidia driver to work?

Also, the other setting that I changed when building the system was the CFLAGS (CFLAGS="-march=core-avx2 -O2 -pipe") according to this wiki since I have a Haswell processor:

http://wiki.gentoo.org/wiki/Safe_CFLAGS

Other than that, this is a pretty basic install.  Anything special about 64 bit? I must be missing something simple.

----------

## New User

OK.  Now I believe that there is definitely something wrong with the ebuilds.  I went for broke and used my initial kernel (mentioned in my first post).  Then I went to the Nvidia website and downloaded their driver (343.22) directly:

http://www.nvidia.com/Download/driverResults.aspx/77844/en-us

I ran it as is and it worked perfectly.

What is the ebuild for again?  It seems like using it has wasted a lot of my time.  Sorry if that sounds harsh.

Anyway, that appears to be the solution to this problem.

----------

## Hu

Generally, you use the ebuild instead of the vendor's installer because most vendor installers are sloppy and provide little or no support for removing the files when you want to upgrade or uninstall.  By design, the ebuild knows exactly what was installed, where it went, and what its checksum should be.

----------

## New User

You are right.  So I went back and started over again just because I want this to be right.  In the process, I decided to select a non-hardened profile.  After doing this, I emerged everything and had no problems with the Nvidia drivers ebuild.  it installed properly.

----------

