symlink is pointing to the right kernel sources: xblade ~ # ls /usr/src/ -l lrwxrwxrwx 1 root root 22 2008-11-15 17:36 linux -> linux-2.6.25-gentoo-r9 drwxr-xr-x 22 root root 848 2008-11-15 17:38 linux-2.6.25-gentoo-r9 xblade ~ # uname -a Linux xblade 2.6.25-gentoo-r9 #1 SMP Fri Nov 14 17:48:38 EST 2008 i686 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ AuthenticAMD GNU/Linux however emerge fails with following error: >>> Compiling source in /var/tmp/portage/x11-drivers/nvidia-drivers-173.14.09/work/NVIDIA-Linux-x86-173.14.09-pkg0 ... * Preparing nvidia module make -j3 HOSTCC=i686-pc-linux-gnu-gcc CROSS_COMPILE=i686-pc-linux-gnu- LDFLAGS= IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/lib/modules/2.6.25-gentoo-r9/build HOST_CC=i686-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-173.14.09 failed. * Call stack: * ebuild.sh, line 49: Called src_compile * environment, line 3654: Called linux-mod_src_compile * environment, line 2688: 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=i686-pc-linux-gnu-gcc CROSS_COMPILE=i686-pc-linux-gnu- LDFLAGS= IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/lib/modules/2.6.25-gentoo-r9/build HOST_CC=i686-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-173.14.09/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-173.14.09/temp/environment'. * I also tried nvidia-drivers-177.80 but it fails with same message Reproducible: Always xblade linux # emerge --info Portage 2.2_rc14 (default/linux/x86/2008.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.25-gentoo-r9 i686) ================================================================= System uname: Linux-2.6.25-gentoo-r9-i686-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-glibc2.0 Timestamp of tree: Sat, 15 Nov 2008 22:00:01 +0000 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ccache version 2.4 [disabled] app-shells/bash: 3.2_p33 dev-java/java-config: 1.3.7, 2.1.6 dev-lang/python: 2.4.4-r14, 2.5.2-r7 dev-python/pycrypto: 2.0.1-r6 dev-util/ccache: 2.4-r7 dev-util/cmake: 2.6.2 sys-apps/baselayout: 1.12.11.1 sys-apps/sandbox: 1.2.18.1-r2 sys-devel/autoconf: 2.13, 2.61-r2 sys-devel/automake: 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1 sys-devel/binutils: 2.18-r3 sys-devel/gcc-config: 1.4.0-r4 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.23-r3 ACCEPT_KEYWORDS="x86" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=athlon64 -pipe -ggdb" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/4.1/env /usr/kde/4.1/share/config /usr/kde/4.1/shutdown /usr/lib/fax /usr/share/config /var/spool/fax/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d" CXXFLAGS="-O2 -march=athlon64 -pipe -ggdb" DISTDIR="/usr/portage/distfiles" FEATURES="distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict stricter unmerge-orphans userfetch" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" LANG="en_CA.utf8" LDFLAGS="-Wl,-O1" LINGUAS="en ru fr" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="3dnow 3dnowext X a52 aac aalib accessibility acl acpi aiglx alsa amr amuled ao apache2 artswrappersuid artworkextra asf audiofile avahi bash-completion berkdb bluetooth bonobo bookmarks branding bzip2 cairo cdr cli cpudetection cracklib crypt css ctype cups cupsddk curl dbus device-mapper divx doc dri dts dv dvd dvdr dvdread eds emboss emerald emoticon encode esd evo examples exif fam fame fat fax fbcon ffmpeg firefox foomaticdb fortran gd gdbm gif gimp glibc-omitfp glitz gmedia gmp gnome gnutls gphoto2 gpm gstreamer gtk gtkhtml guile hal hddtemp hfs howl-compat icc iconv idn ieee1394 imagemagick imap imlib ipv6 isdnlog jack java java5 javascript jbig jfs jpeg kde kdeenablefinal kdeprefix kqemu lcms ldap libcaca libnotify live lm_sensors lzo mad madwifi maildir mdnsresponder-compat midi mikmod mjpeg mmx mmxext mng mono mozbranding mozilla mp3 mp4live mpeg mpeg2 mplayer msn mudflap multiuser musicbrainz mysql nautilus ncurses network networkmanager new-login nforce2 nls nptl nptlonly nsplugin ntfs nvidia oci8-instant-client odbc offensive ofx ogg openal opengl openmp pam pango pcre pdf pdo perl php pmu png ppds pppd print python qemu qmail qt3 qt3support qt4 quicktime quotes rar readline realmedia reflection reiser4 reiserfs remote samba sasl scanner sdl sensord session smp sms snmp softmmu speech spell spl sqlite srt sse sse-filters sse2 ssl startup-notification stats svg symlink sysfs tcl tcltk tcpd tetex theora thesaurus tidy tiff tk truetype unicode unzip usb v4l v4l2 vcd vim-with-x visualization vorbis widescreen wifi win32codecs wma wmf wmp wxwindows x264 x86 xfs xine xinerama xml xml2 xorg xsl xv xvid xvmc zeroconf zip zlib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ru fr" USERLAND="GNU" VIDEO_CARDS="nvidia nv vesa" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Fixed by completely removing kernel directory and then reemerging gentoo-sources and nvidia-drivers