# nvidia module fails to compile (amd64, 2.6.13)  --- SOLVED!!

## faceman

I'm trying a first install on a new AMD64 machine.

I'm using 2.6.13-gentoo-r3 for kernel.  My linux-headers are 2.6.11-r2.  I don't have Riva-fb in the kernel.

nvidia-kernel fails on every attempt, with all the ebuilds available in Portage and with nvidia's installer.

I've searched for 3 days, found similar errors but no solutions.

Here is the error message:

```

ld -m elf_x86_64  -r -o /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nvidia.o /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nv-kernel.o /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nv.o /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nv-vm.o /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/os-agp.o /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/os-interface.o /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/os-registry.o

ld: Relocatable linking with relocations from format elf32-i386 (/var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nv-kernel.o) to format elf64-x86-64 (/var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nvidia.o) is not supported

make[3]: *** [/var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nvidia.o] Error 1

make[2]: *** [_module_/var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv] Error 2

NVIDIA: left KBUILD.

nvidia.ko failed to build!

make[1]: *** [module] Error 1

make: *** [module] Error 2

!!! ERROR: media-video/nvidia-kernel-1.0.7676 failed.

!!! Function linux-mod_src_compile, Line 460, Exitcode 2

!!! Unable to make                                                IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux clean module.

```

Any help would be appreciated.  What have I forgotten to tell you?

----------

## alistair

how about trying to...

```
make mrproper

rm -r /lib/modules/2.6.13-gentoo-r3/

make menuconfig   --> go thru and double check all your options.  

make && make modules_install && emerge nvidia-kernel

cp arch/x86_64/boot/bzImage /boot/kernel-2.6.13-gentoo-r3

cp .config /boot/config-2.6.13-gentoo-r3
```

```

make[3]: *** [/var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nvidia.o] Error 1

make[2]: *** [_module_/var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv] Error 2

NVIDIA: left KBUILD.

nvidia.ko failed to build!

make[1]: *** [module] Error 1

make: *** [module] Error 2

!!! ERROR: media-video/nvidia-kernel-1.0.7676 failed.

!!! Function linux-mod_src_compile, Line 460, Exitcode 2

!!! Unable to make                                                IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux clean module. 
```

is this the 32bit or 64 bit version???

post emerge --info

----------

## faceman

Thanks for your reply.

It's 64-bit.

OK, I did all that, but nothing new.  Is there anything specific in the kernel that I need to be sure is not there?  I can post my config, if that will help.

I can't give you emerge --info (at work), but I can tell you that I have make.conf set to amd64, with the recommended flags (march=k8 -02).

Has anyone gotten this working with kernel 2.6.13-r3?  Maybe that's the problem?

----------

## faceman

Finally, here's emerge --info:

```

Portage 2.0.51.22-r3 (default-linux/amd64/2005.1, gcc-3.4.4, glibc-2.3.5-r2, 2.6.13-gentoo-r3 x86_64)

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

System uname: 2.6.13-gentoo-r3 x86_64 AMD Athlon(tm) 64 Processor 3700+

Gentoo Base System version 1.6.13

dev-lang/python:     2.3.5, 2.4.2

sys-apps/sandbox:    1.2.12

sys-devel/autoconf:  2.13, 2.59-r6

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1

sys-devel/binutils:  2.15.92.0.2-r10

sys-devel/libtool:   1.5.20

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="amd64"

AUTOCLEAN="yes"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=k8 -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-march=k8 -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks sandbox sfperms strict"

GENTOO_MIRRORS="http://gentoo.chem.wisc.edu/gentoo/ http://mirror.datapipe.net/gentoo http://lug.mtu.edu/gentoo http://mirror.datapipe.net/gentoo rsync://gentoo.mirrors.easynews.com/gentoo/ rsync://mirror.mcs.anl.gov/pub/gentoo/"

LDFLAGS="-Wl,-O1"

MAKEOPTS="-j2"

PKGDIR="/usr/local/gentoopkg"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

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

USE="amd64 X alsa apm avi berkdb bitmap-fonts bonobo cdr cmov cpudetection crypt cups curl cx8 de dvd dvdr dvdread eds emboss encode esd fam fbcon foomaticdb fortran fpu fxsr gif gimp gimpprint gpm gstreamer gtk gtk2 gtkhtml guile imagemagick imlib ipv6 jpeg lcms libpng lzw lzw-tiff mca mce mozilla mp3 mpeg msr mtrr network nls nptl nptlonly ogg oggvorbis opengl pae pam pat pdflib perl pge png pni ppds pse pse36 python qemu-fast quicktime readline real samba scanner sdl sep sox spell ssl svg syscall tcpd tiff truetype truetype-fonts tsc type1-fonts udev usb userlocales vme vorbis x86 xine xml xml2 xmms xpm xv zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LINGUAS

```

----------

## faceman

Still have no clue...anyone?

----------

## alistair

I think your trying to compile a x86 version of the nvidia-kernel (or from the nvidia website)

yours

 *Quote:*   

> /var/tmp/portage/nvidia-kernel-1.0.7676/work/NVIDIA-Linux-x86-1.0-7676-pkg0/usr/src/nv/nvidia.o

 

mine

 *Quote:*   

> /var/tmp/portage/nvidia-kernel-1.0.6629-r4/work/NVIDIA-Linux-x86_64-1.0-6629-pkg2/usr/src/nv/nvidia.o

 

make sure you havent masked nvidia-kernel as ~x86 in package.keywords  it should be ~amd64

----------

## faceman

You may be on to something, but it's already listed that way in my package.keywords.  I've even tried the older versions - it won't apply the "shutup-warnings" patch, which is why I'm trying the newer version in the first place.

It also fails with the nvidia run file...says I might not have the right headers, but I do, as far as I can discern.

The ebuild tells it to make the directory labeled "64" like yours, but it doesn't, as if it wants to compile a 32-bit version.  However, deleting all of the "pkg1.run" files from distfiles, it does not download them, which shows that it's trying to compile it as 64-bit, I think.

What does this mean?

```
Relocatable linking with relocations from format elf32-i386 to format elf64-x86-64 is not supported
```

And how does one fix that problem?

----------

## /carlito

You should go to the nvidia website,download the correct driver and install it by hand. If that fails, look further on the emerge problem.

----------

## dryadcito

You have both amd64 and x86 in your USE flags. Delete x86 and leave amd64 because that USE flags are used to choose between binary versions of some packages. I think you could have run into the same problem with sun-jdk,for instance.

----------

## faceman

I've checked my use flags pretty well, and it doesn't look like there's anything wrong with them, but I'll check again when I get home.

I've tried installing the driver by hand, but now I get "no such device", which is most bothersome since I've got an nvidia card, irq is set to vga in bios, and I'm not using any other framebuffer device that should hold it up.

Anyway, I'm more interested in getting the emerge to work, so I'll check all my flags (maybe post my make.conf if I can't figure anything out) when I get home and report.

By the way, what else could make the driver default to x86 in make.conf or elsewhere?

----------

## dryadcito

 *Quote:*   

> 
> 
> USE="amd64 X alsa apm avi berkdb bitmap-fonts bonobo cdr cmov cpudetection crypt cups curl cx8 de dvd dvdr dvdread eds emboss encode esd fam fbcon foomaticdb fortran fpu fxsr gif gimp gimpprint gpm gstreamer gtk gtk2 gtkhtml guile imagemagick imlib ipv6 jpeg lcms libpng lzw lzw-tiff mca mce mozilla mp3 mpeg msr mtrr network nls nptl nptlonly ogg oggvorbis opengl pae pam pat pdflib perl pge png pni ppds pse pse36 python qemu-fast quicktime readline real samba scanner sdl sep sox spell ssl svg syscall tcpd tiff truetype truetype-fonts tsc type1-fonts udev usb userlocales vme vorbis x86 xine xml xml2 xmms xpm xv zlib userland_GNU kernel_linux elibc_glibc" 
> 
> 

 

Can you see x86 near the end of the line? That's from your emerge --info posted above. As I said before, that is your problem. If you remove x86 portage will download and install amd64 version ( as long as you don't remove amd64 from USE too).

----------

## faceman

Hmm...I must have missed it.  Sorry.  I had just copied over my old make.conf from my athlon x86 box, thought I had gotten everything important.

Thank you very much!! You have been very helpful.  It compiled just fine.

Now I just have to figure out why in the world it won't load.  Will vesafb make it not load correctly?

Edit: got it working correctly by taking nvidia framebuffer (NOT RivaFB, mind you) out of the kernel.  But then my console framebuffer resolution went back to default, even though all the grub settings are there for vesafb as they should be.

Any suggestions to this problem?

----------

## /carlito

You could use vesafs-tng.

----------

## faceman

Actually, I've moved to 2.6.14, it's not in there any more (is it?)

----------

## /carlito

It should be under 

```
=> Device Drivers

  => Graphics Support

    => (*) VESA Vga Graphics Support

          VESA Driver type (vesafb-tng)

      (1280x1024) VESA Default Mode
```

----------

## faceman

For 64-bit, only the vesafb shows up; it says:

 *Quote:*   

> Choose this driver if you are experiencing problems with vesafb-tng or if you own a 64-bit system.

 

So, it appears I can't use it.  Any other suggestions?

----------

## Headrush

 *faceman wrote:*   

> For 64-bit, only the vesafb shows up; it says:
> 
>  *Quote:*   Choose this driver if you are experiencing problems with vesafb-tng or if you own a 64-bit system. 
> 
> So, it appears I can't use it.  Any other suggestions?

 

vesa-tng isn't supported on 64 bit yet.

Regular vesa should be more than sufficient and appear almost identical to vesa-tng.

----------

## /carlito

Could you post your grub.conf and the output of dmesg |grep vesafb please?

Also check out this guide (if you haven't already).

----------

## faceman

OK, went through that howto, no good.

Here's grub.conf:

```
default=0

timeout=8

splashimage=(hd0,0)/grub/splash.xpm.gz

title Gentoo Linux

   root (hd0,0)

   kernel=/boot/kernel root=/dev/sda3

   video=vesafb:ywrap,mtrr vga=0x318 splash=silent,fadein,theme:emergence quiet CONSOLE=/dev/tty2

   initrd /boot/fbsplash-emergence-1024x768
```

and grepping vesafb gives nothing.

Emerged fbset, it says  *Quote:*   

> open /dev/fb0: No such file or directory

 

Obviously, it's not working.  Maybe I should try a couple other modes...

----------

## faceman

No setting seem to work...I'll start a new thread for this problem.

----------

## /carlito

```
timeout 10

default 0

splashimage (hd0,4)/grub/splash.xpm.gz

title 2.6.13-r5

root (hd0,4)

kernel /kernel-2.6.13-r5 ro root=/dev/hda7 video=vesafb:1280x1024-32@75 splash=verbose,theme:emergence 

initrd /boot/fbsplash-emergence-1280x1024

```

Here's my grub setup.

----------

## Headrush

My GRUB:

```
gfxmenu (hd0,1)/boot/message

color white/blue black/light-gray

# Boot automatically after 30 secs.

timeout 5

# By default, boot the first entry.

default 0

title Gentoo Linux

root (hd0,1)

kernel /boot/kernel-2.6.14-gentoo-r2 root=/dev/sda2 vga=0x31a splash=silent,theme:livecd-2005.1 CONSOLE=/dev/tty1 quiet

initrd /boot/initrd-livecd-2005.1
```

Ignore the gfxmenu stuff, its for a graphical/animated GRUB screen.   :Wink: 

----------

