# Nvidia driver not compiling with 2.6.5-mm [SOLVED]

## TenienteCastillo

Hello,

I have moved from 2.4 to 2.6.5-mm and when I try to emerge nvidia-kernel it shows this error:

```

Calculating dependencies ...done!

>>> emerge (1 of 1) media-video/nvidia-kernel-1.0.4496-r3 to /

>>> md5 src_uri ;-) NVIDIA-Linux-x86-1.0-4496-pkg0.run

>>> Unpacking source...

Creating directory NVIDIA-Linux-x86-1.0-4496-pkg0

Verifying archive integrity... OK

Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86 1.0-4496.........................................................

 * Linux kernel 2.6.5

>>> Source unpacked.

rm -f nv.o os-agp.o os-interface.o os-registry.o  nv-linux.o nv_compiler.h *.d NVdriver nvidia.o

echo \#define NV_COMPILER \"`gcc -v 2>&1 | tail -n 1`\" > nv_compiler.h

gcc -c -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wcast-qual -Wno-multichar  -O -MD -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4496  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86      -DREMAP_PAGE_RANGE_5  -I. -I/usr/src/linux/include -Wno-cast-qual nv.c

In file included from /usr/src/linux/include/linux/list.h:7,

                 from /usr/src/linux/include/linux/wait.h:14,

                 from /usr/src/linux/include/asm/semaphore.h:41,

                 from /usr/src/linux/include/linux/sched.h:18,

                 from /usr/src/linux/include/linux/module.h:10,

                 from nv-linux.h:28,

                 from nv.c:14:

/usr/src/linux/include/linux/prefetch.h: En la función `prefetch_range':

/usr/src/linux/include/linux/prefetch.h:62: aviso: se usó un puntero de tipo `void *' en la aritmética

En el fichero incluído de nv.c:14:

nv-linux.h:51:4: #error This driver does not support 2.6.x or newer kernels!

En el fichero incluído de /usr/src/linux/include/linux/irq.h:20,

                 de /usr/src/linux/include/asm/hardirq.h:6,

                 de /usr/src/linux/include/linux/delay.h:13,

                 de nv-linux.h:75,

                 de nv.c:14:

/usr/src/linux/include/asm/irq.h:16:25: irq_vectors.h: No existe el fichero o el directorio

In file included from /usr/src/linux/include/asm/hardirq.h:6,

                 from /usr/src/linux/include/linux/delay.h:13,

                 from nv-linux.h:75,

                 from nv.c:14:

/usr/src/linux/include/linux/irq.h: En el nivel principal:

/usr/src/linux/include/linux/irq.h:70: error: `NR_IRQS' undeclared here (not in a function)

In file included from /usr/src/linux/include/linux/irq.h:72,

                 from /usr/src/linux/include/asm/hardirq.h:6,

                 from /usr/src/linux/include/linux/delay.h:13,

                 from nv-linux.h:75,

                 from nv.c:14:

/usr/src/linux/include/asm/hw_irq.h:28: error: `NR_IRQ_VECTORS' undeclared here (not in a function)

/usr/src/linux/include/asm/hw_irq.h:32: error: `NR_IRQS' undeclared here (not in a function)

In file included from nv.c:14:

nv-linux.h: En la función `NV_IRQL_IS_RAISED':

nv-linux.h:490: aviso: implicit declaration of function `__save_flags'

nv.c: En la función `nv_kern_vma_open':

nv.c:958: aviso: `MOD_INC_USE_COUNT' is deprecated (declared at /usr/src/linux/include/linux/module.h:515)

nv.c: En la función `nv_kern_vma_release':

nv.c:992: aviso: `MOD_DEC_USE_COUNT' is deprecated (declared at /usr/src/linux/include/linux/module.h:527)

nv.c: En el nivel principal:

nv.c:1083: aviso: inicialización de tipo de puntero incompatible

nv.c: En la función `nv_kern_open':

nv.c:1189: aviso: al pasar el argumento 2 de `request_irq' de tipo de puntero incompatible

nv.c:1210: aviso: `MOD_INC_USE_COUNT' is deprecated (declared at /usr/src/linux/include/linux/module.h:515)

nv.c: En la función `nv_kern_close':

nv.c:1303: aviso: `MOD_DEC_USE_COUNT' is deprecated (declared at /usr/src/linux/include/linux/module.h:527)

nv.c: En la función `nv_kern_mmap':

nv.c:1470: aviso: `MOD_INC_USE_COUNT' is deprecated (declared at /usr/src/linux/include/linux/module.h:515)

nv.c: En la función `nv_kern_ioctl':

nv.c:1568: error: structure has no member named `uc'

nv.c: En la función `nv_kern_isr':

nv.c:1712: aviso: implicit declaration of function `mark_bh'

nv.c:1712: error: `IMMEDIATE_BH' undeclared (first use in this function)

nv.c:1712: error: (Each undeclared identifier is reported only once

nv.c:1712: error: for each function it appears in.)

nv.c: En la función `nv_kern_ctl_open':

nv.c:1834: aviso: `MOD_INC_USE_COUNT' is deprecated (declared at /usr/src/linux/include/linux/module.h:515)

nv.c: En la función `nv_kern_ctl_close':

nv.c:1877: aviso: `MOD_DEC_USE_COUNT' is deprecated (declared at /usr/src/linux/include/linux/module.h:527)

nv.c: En la función `nv_kern_read_agpinfo':

nv.c:2012: error: structure has no member named `name'

make: *** [nv.o] Error 1

!!! ERROR: media-video/nvidia-kernel-1.0.4496-r3 failed.

!!! Function src_compile, Line 111, Exitcode 2

!!! (no error message)

```

I don't know what the problem is, and I searched the forums and people says that it compiles fine with 2.6.5.

Anyone can help me, please?

Many thanks.Last edited by TenienteCastillo on Fri Apr 30, 2004 5:23 am; edited 1 time in total

----------

## elabdel

Try : ACCEPT_KEYWORDS="~x86" emerge nvidia-kernel

And ACCEPT_KEYWORDS="~x86" emerge nvidia-glx

This should work.

Note: For kernels >= 2.6.5 don't compile the kernel with

[]Use register arguments (EXPERIMENTAL)

[]Use 4Kb for kernel stacks instead of 8Kb

Because The driver won't work.

I don't know why, and I want use ([]Use 4Kb for kernel stacks instead of 8Kb).

can someone help me to resolve the problem.

Thanks

----------

## TenienteCastillo

Well, ACCEPT_KEYWORDS="~x86" emerge nvidia-kernel works fine and it installs ver 1.0.5336-r2, but if I do 

```
modprobe nvidia
```

 I get this error:

```
FATAL: Error inserting nvidia (/lib/modules/2.6.5-mm6/video/nvidia.o): Invalid module format
```

I have no old nvidia module in memory (before someone asks me).

----------

## elabdel

It should create nvidia.ko but not nvidia.o!

remove the directory /lib/modules/2.6.5-mm6/video/, and try to reinstall it again. I don't know if the problem is here but just try.

----------

## lbrtuk

In 2.6.6 mainline a patch to do with 4g memory is being added which royally screws the nvidia drivers. (its nvidia's fault, not kernel dev's)

It is possible that andrew morton has put this patch into his mm6 kernel, being the forward thinking sort of bloke he is.

http://www.redhat.com/archives/fedora-test-list/2004-April/msg01460.html

This is just a possibility.

----------

## thenapalm

Ok, I've been getting the same error as TenienteCastillo.  I've been screwing around with it for the past 6 or so hours.

Relevant info:

2.6.5-love-r3

nVidia drivers 4496 (duh)

I was originally trying to upgrade to 2.6.6_rc1-love-r2 when I started getting errors.  I went back to 2.6.5-love-r3 and it still wouldn't compile.  I found this thread and a few others that where someone just re-compiled the kernel without changing anything.. so I did that and still doesn't work.  I tried updating to the 5536 drivers, but they say something about an incompatibility with a module with an earlier version.

This is the damndest thing because I've never had a problem with the nVidia drivers before.  Been using 4496 since December with absolutely no problems!

Oh, to my knowledge, I'm not using any 4k stacks or anything in my kernel.

----------

## TenienteCastillo

Problem solved!

Just make a symbolic link nvidia.o that point to nvidia.ko, recompile a couple of times and it works now.

Thanks.

----------

## elabdel

hello

For lbrtuk : thans, but I want to use 

[X]Use 4Kb for kernel stacks instead of 8Kb but not 4G of memory.[/b]

----------

## jonfr

I had this problem, i had to remove the nvidia.o file from /lib/modules/kernel-ver/video

I made an topic about that problem, where it is now. I don't know.

----------

## cyfred

A few things got a bit broken in a few recent commits.

These should all be fixed as of 10 minutes ago.

----------

## Schnacki

Yes, thank you  cyfred. emerge sync fixed the compiling problem for me.

By the way: @jonfr: The original poster couldn't compile the nvidia-driver. so why should he remove the old one?

----------

