# nvidia-drivers can't find kernel version [SOLVED]

## kiss-o-matic

I'm on x86_64 (gentoo-sources 2.6.30-r5), trying to emerge nvidia-settings.  The card is a GeForce GT220.

I know many threads say this works:

```

cd /usr/src/linux

ln -s asm-x86 asm-i386

```

Doesn't work for me, presumably b/c of the architecture change.  I've tried some of the drivers from Nvidia, and they suck as well.... same error.  Anyone know specifically how it determines the kernel version?

Here's the full error:

```

*** Unable to determine the target kernel version. ***

make: *** [select_makefile] Error 1

 *

 * ERROR: x11-drivers/nvidia-drivers-180.60 failed.

 * Call stack:

 *               ebuild.sh, line   49:  Called src_compile

 *             environment, line 3942:  Called linux-mod_src_compile

 *             environment, line 2939:  Called die

 * The specific snippet of code:

 *               eval "emake HOSTCC=\"$(tc-getBUILD_CC)\"                                               CROSS_COMPILE=${CHOST}-                                          LDFLAGS=\"$(get_abi_LDFLAGS)\"                                          ${BUILD_FIXES}                                           ${BUILD_PARAMS}                                                 ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";

 *  The die message:

 *   Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS=  IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux                SYSOUT=/lib/modules/2.6.30-gentoo-r5/build HOST_CC=x86_64-pc-linux-gnu-gcc clean module

 *

```

Here's make.conf

```

CFLAGS="-O2 -pipe"

CXXFLAGS="-O2 -pipe"

# WARNING: Changing your CHOST is not something that should be done lightly.

# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.

CHOST="x86_64-pc-linux-gnu"

MAKEOPTS="-j5"

# These are the USE flags that were used in addition to what is provided by the

# profile used for building.

USE="alsa anthy apache2 automount cairo cjk dbus encode gimp gkrellm -gnome gtk hal \

        immqt-bc -immqt java jpeg kde lm_sensors m17n-lib mmx modplug mng mysql nas network \

        nls opengl php png qt qt3support samba sane scim sql sse sse2 svg tiff truetype \

        unicode usb webkit X xulrunner xvid"

INPUT_DEVICES="keyboard mouse"

VIDEO_CARDS="nvidia"

```

Talk to me.  I'm a good person... really.Last edited by kiss-o-matic on Sun Oct 25, 2009 1:06 pm; edited 3 times in total

----------

## kiss-o-matic

Unemerged gentoo-sources & vanilla-sources.  Wiped /usr/src clean.

Rebuilt gentoo-sources. Built & installed the kernel.  Tried again -- same damn thing.

Here's the build.log file.

```

 * Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Found kernel object directory:

 *     /lib/modules/2.6.30-gentoo-r5/build

 * Found sources for kernel version:

 *     2.6.30-gentoo-r5

 * Checking for MTRR support ...                                                                                                          [ ok ]

>>> Unpacking source...

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

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

>>> Preparing source in /var/tmp/portage/x11-drivers/nvidia-drivers-180.60/work/NVIDIA-Linux-x86_64-180.60-pkg2 ...

 * Applying NVIDIA_glx-defines.patch ...                                                                                                  [ ok ]

 * Applying NVIDIA_glx-glheader.patch ...                                                                                                 [ ok ]

 * Converting NVIDIA-Linux-x86_64-180.60-pkg2/usr/src/nv/Makefile.kbuild to use M= instead of SUBDIRS= ...                                [ ok ]

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/x11-drivers/nvidia-drivers-180.60/work/NVIDIA-Linux-x86_64-180.60-pkg2 ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/x11-drivers/nvidia-drivers-180.60/work/NVIDIA-Linux-x86_64-180.60-pkg2 ...

 * Preparing nvidia module

make -j5 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS= IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/lib/modules/2.6.30-gentoo-r5/build HOST_CC=x86_64-pc-linux-gnu-gcc clean module

If you are using a Linux 2.4 kernel, please make sure

you either have configured kernel sources matching your

kernel or the correct set of kernel headers installed

on your system.

If you are using a Linux 2.6 kernel, please make sure

you have configured kernel sources matching your kernel

installed on your system. If you specified a separate

output directory using either the "KBUILD_OUTPUT" or

the "O" KBUILD parameter, make sure to specify this

directory with the SYSOUT environment variable or with

the equivalent nvidia-installer command line option.

Depending on where and how the kernel sources (or the

kernel headers) were installed, you may need to specify

their location with the SYSSRC environment variable or

the equivalent nvidia-installer command line option.

*** Unable to determine the target kernel version. ***

make: *** [select_makefile] Error 1

 *

 * ERROR: x11-drivers/nvidia-drivers-180.60 failed.

 * Call stack:

 *               ebuild.sh, line   49:  Called src_compile

 *             environment, line 3942:  Called linux-mod_src_compile

 *             environment, line 2939:  Called die

 * The specific snippet of code:

 *               eval "emake HOSTCC=\"$(tc-getBUILD_CC)\"                                               CROSS_COMPILE=${CHOST}-                LDFLAGS=\"$(get_abi_LDFLAGS)\"                                           ${BUILD_FIXES}                                          ${BUILD_PARAMS} ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";

 *  The die message:

 *   Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS=  IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux               SYSOUT=/lib/modules/2.6.30-gentoo-r5/build HOST_CC=x86_64-pc-linux-gnu-gcc clean module

 *

 * If you need support, post the topmost build error, and the call stack if relevant.

 * A complete build log is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-180.60/temp/build.log'.

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

```

----------

## kiss-o-matic

A good night's sleep did nothing for this problem.  Am I missing something?

```

amd64 # eselect kernel list

Available kernel symlink targets:

  [1]   linux-2.6.30-gentoo-r5 *

```

```

amd64 # ls -ltr /usr/src

total 4

lrwxrwxrwx  1 root root   22 Oct 25 01:26 linux -> linux-2.6.30-gentoo-r5

drwxr-xr-x 23 root root 4096 Oct 25 09:45 linux-2.6.30-gentoo-r5

```

Ran /usr/src/linux/make menuconfig

Compiled, installed

Ran /us/src/linux/make config 

and all that jazz as well. I have what appears to be a valid .config file, but I still don't have this driver installed.

----------

## jfp

In your /etc/make.conf I notice:

 *Quote:*   

> CFLAGS="-O2 -pipe"
> 
> CXXFLAGS="-O2 -pipe" 

 

You do not have -march or -mtune. My values are:

```
CFLAGS="-mtune=native -O2 -pipe"

CXXFLAGS="${CFLAGS}"

```

I don't know what the default values is for -mtune...

I have no idea whether this relates to your problem or not.

I am using the same kernel version (sys-kernel/tuxonice-sources-2.6.30-r6) and nvidia-driver version 180.60 and all is well.

----------

## kiss-o-matic

Yeah, mtune didn't help.

Is your architecture x86_64 or just x86?  I've done an nvidia install on x86 a million times... only once on x86_64 (but even that worked).  What's weirder is that the installer gives the same error, so it's not the ebuild or the installer per se.. but how it determines the version of the kernel from where the sources are installed.

I tried tuxonice since it couldn't hurt, but got the same thing.  The weird thing is I tried a completely external-to-portage kernel as well and got the same results which tells me my make.conf is fine.  Might go buy a Radeon and see what happens with that.

----------

## pappy_mcfae

You need to set the /usr/src/linux symlink. Post the results of eselect kernel list.

Blessed be!

Pappy

----------

## Anon-E-moose

what does this return 

```
gcc-config -l
```

People have been getting that symptom when they have a hardened gcc.

If the above command shows something like this

```
gcc-config -l

[1] x86_64-pc-linux-gnu-4.3.4 *

[2] x86_64-pc-linux-gnu-4.3.4 -hardenednopie

[3] x86_64-pc-linux-gnu-4.3.4 -vanilla 
```

then select the "hardenednopie" one, 

emerge the driver and set gcc back to what it was

----------

## jfp

 *Quote:*   

> is your architecture x86_64 or just x86?

 

I have two computers, both are x86_64 and both use a 2.36.30 kernel. One tuxonice and the other gentoo-sources. The one with gentoo-sources is gentoo-sources-2.6.30-r5. The same as what you showed earlier.

Both of the boxes are using nvidia-drivers-180.60. My gcc-config -l is:

```
john@speedy ~/vmware/shared $ gcc-config -l

 [1] x86_64-pc-linux-gnu-4.3.4 *

```

----------

## jfp

I just noticed in your original post:

 *Quote:*   

> Doesn't work for me, presumably b/c of the architecture change.

 

Just to clarify. Your are not trying to migrate an existing 32 bit to 64 bit by changing the CHOST are you?

----------

## jfp

 *Quote:*   

>  * Preparing nvidia module
> 
> make -j5 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS= IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/lib/modules/2.6.30-gentoo-r5/build HOST_CC=x86_64-pc-linux-gnu-gcc clean module
> 
> If you are using a Linux 2.4 kernel, please make sure
> ...

 

If it helps you, these messages are generated in 

```
/var/tmp/portage/x11-drivers/nvidia-drivers-180.60/work/NVIDIA-Linux-x86_64-180.60-pkg2/usr/src/nv/conftest.sh
```

----------

## kiss-o-matic

 *pappy_mcfae wrote:*   

> You need to set the /usr/src/linux symlink. Post the results of eselect kernel list.
> 
> 

 

This was the very, very, VERY first thing I checked.  It was fine.  

 *Quote:*   

> If it helps you, these messages are generated in 

 

Yeah, that's what I was looking for.  Too late now, solved by attrition.  I did a complete rebuild and it's working now (sort of).  I did learn my GPU isn't supported in the latest stable build, so I'm on an RC that's not even in portage.  That should be fun!

I still don't know exactly what could've caused it.  gcc was about the only thing I didn't check so we can presume that was it?  I really did try it against about 4 different kernels and even wiped /usr/src/linux clean one to make sure.  It seems all good now.

Cheers for everyone's input.  It's been a frustrating day.

----------

