Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 427202 - x11-drivers/nvidia-drivers-96.43.20 does not compile with sys-kernel/gentoo-sources-3.3.8 on x86 because of missing asm/unistd_32.h
Summary: x11-drivers/nvidia-drivers-96.43.20 does not compile with sys-kernel/gentoo-s...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Doug Goldstein (RETIRED)
URL: http://git.kernel.org/?p=linux/kernel...
Whiteboard:
Keywords:
Depends on: 438246
Blocks:
  Show dependency tree
 
Reported: 2012-07-19 09:55 UTC by Petr Pisar
Modified: 2012-11-18 23:04 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for nvidia-drivers-96.43.20. (nvidia-drivers-96.43.20-kernel-3.3.8-bug-427202.patch,709 bytes, patch)
2012-07-22 18:02 UTC, Andrew
Details | Diff
New ebuild to take advantage of patch. (nvidia-drivers-96.43.20-r1.ebuild,15.36 KB, text/plain)
2012-07-22 18:03 UTC, Andrew
Details
Patch to ebuild. (nvidia-drivers-96.43.20.ebuild.patch,618 bytes, patch)
2012-07-22 18:03 UTC, Andrew
Details | Diff
successful-build.log (build.log,17.64 KB, text/plain)
2012-07-31 14:35 UTC, Amadeusz Żołnowski (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisar 2012-07-19 09:55:35 UTC
After installing sys-kernel/gentoo-sources-3.3.8 I cannot emerge x11-drivers/nvidia-drivers-96.43.20 on x86:

>>> Emerging (1 of 1) x11-drivers/nvidia-drivers-96.43.20
 * NVIDIA-Linux-x86-96.43.20-pkg0.run SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/3.3.8-gentoo/build
 * Found sources for kernel version:
 *     3.3.8-gentoo
 * Checking for MTRR support ...                                         [ ok ]
>>> Unpacking source...
>>> Unpacking NVIDIA-Linux-x86-96.43.20-pkg0.run to /var/tmp/portage/x11-drivers/nvidia-drivers-96.43.20/work/NVIDIA-Linux-x86-96.43.20-pkg0
>>> Source unpacked in /var/tmp/portage/x11-drivers/nvidia-drivers-96.43.20/work
>>> Preparing source in /var/tmp/portage/x11-drivers/nvidia-drivers-96.43.20/work/NVIDIA-Linux-x86-96.43.20-pkg0 ...
 * Applying NVIDIA_glx-defines.patch ...                                 [ ok ]
 * Applying NVIDIA_glx-glheader.patch ...                                [ ok ]
 * Converting NVIDIA-Linux-x86-96.43.20-pkg0/usr/src/nv/Makefile.kbuild to use M= instead of SUBDIRS= ...                                                [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/x11-drivers/nvidia-drivers-96.43.20/work/NVIDIA-Linux-x86-96.43.20-pkg0 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/x11-drivers/nvidia-drivers-96.43.20/work/NVIDIA-Linux-x86-96.43.20-pkg0 ...
 * Preparing nvidia module
make -j2 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/3.3.8-gentoo/build 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. ***

This is because conftest.sh in /var/tmp/portage/x11-drivers/nvidia-drivers-96.43.20/work/NVIDIA-Linux-x86-96.43.20-pkg0/usr/src/nv cannot compile:

            #include <linux/version.h>
            #include <linux/utsname.h>
            #if defined(TEST_2_4) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
              #error \"!KERNEL_2_4\"
            #endif
            #if defined(TEST_2_6_OR_3) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
              #error \"!KERNEL_2_6_OR_3\"
            #endif" > conftest$$.c

This reason is:

# i686-pc-linux-gnu-gcc -O2 -D__KERNEL__ -nostdinc -isystem /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include -I/usr/src/linux/include/asm-i386/mach-default -I/usr/src/linux/include/asm-x86/mach-default -I/usr/src/linux/arch/x86/include/asm/mach-default -I/lib/modules/3.3.8-gentoo/build/include2 -I/lib/modules/3.3.8-gentoo/build/include -I/usr/src/linux/include -include /lib/modules/3.3.8-gentoo/build/include/generated/autoconf.h -I/usr/src/linux/arch/x86/include -DTEST_2_6_OR_3 -c conftest11221.c
In file included from /lib/modules/3.3.8-gentoo/build/include/linux/unistd.h:7:0,
                 from /usr/src/linux/arch/x86/include/asm/seccomp_32.h:4,
                 from /usr/src/linux/arch/x86/include/asm/seccomp.h:2,
                 from /lib/modules/3.3.8-gentoo/build/include/linux/seccomp.h:8,
                 from /lib/modules/3.3.8-gentoo/build/include/linux/sched.h:80,
                 from /lib/modules/3.3.8-gentoo/build/include/linux/utsname.h:35,
                 from conftest11221.c:5:
/usr/src/linux/arch/x86/include/asm/unistd.h:7:29: fatal error: asm/unistd_32.h: No such file or directory
compilation terminated.

The problem is in /usr/src/linux/arch/x86/include/asm/unistd.h if __KERNEL__ is defined:

#ifndef _ASM_X86_UNISTD_H
#define _ASM_X86_UNISTD_H 1

#ifdef __KERNEL__
# ifdef CONFIG_X86_32

#  include <asm/unistd_32.h>
#  define __ARCH_WANT_IPC_PARSE_VERSION
#  define __ARCH_WANT_STAT64
#  define __ARCH_WANT_SYS_IPC
#  define __ARCH_WANT_SYS_OLD_MMAP
#  define __ARCH_WANT_SYS_OLD_SELECT

# else

#  include <asm/unistd_64.h>
#  define __ARCH_WANT_COMPAT_SYS_TIME

# endif

# define __ARCH_WANT_OLD_READDIR
# define __ARCH_WANT_OLD_STAT
# define __ARCH_WANT_SYS_ALARM
# define __ARCH_WANT_SYS_FADVISE64
# define __ARCH_WANT_SYS_GETHOSTNAME
# define __ARCH_WANT_SYS_GETPGRP
# define __ARCH_WANT_SYS_LLSEEK
# define __ARCH_WANT_SYS_NICE
# define __ARCH_WANT_SYS_OLDUMOUNT
# define __ARCH_WANT_SYS_OLD_GETRLIMIT
# define __ARCH_WANT_SYS_OLD_UNAME
# define __ARCH_WANT_SYS_PAUSE
# define __ARCH_WANT_SYS_RT_SIGACTION
# define __ARCH_WANT_SYS_RT_SIGSUSPEND
# define __ARCH_WANT_SYS_SGETMASK
# define __ARCH_WANT_SYS_SIGNAL
# define __ARCH_WANT_SYS_SIGPENDING
# define __ARCH_WANT_SYS_SIGPROCMASK
# define __ARCH_WANT_SYS_SOCKETCALL
# define __ARCH_WANT_SYS_TIME
# define __ARCH_WANT_SYS_UTIME
# define __ARCH_WANT_SYS_WAITPID

/*
 * "Conditional" syscalls
 *
 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
 * but it doesn't work on all toolchains, so we just do it by hand
 */
# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#else
# ifdef __i386__
#  include <asm/unistd_32.h>
# else
#  include <asm/unistd_64.h>
# endif
#endif

#endif /* _ASM_X86_UNISTD_H */


The asm/unistd_32.h does not exist in "standard" path anymore. It has been moved to arch/x86/include/generated:

# find /usr/src/linux-3.3.8-gentoo/ -name unistd_32.h
/usr/src/linux-3.3.8-gentoo/arch/sh/include/asm/unistd_32.h
/usr/src/linux-3.3.8-gentoo/arch/x86/include/generated/asm/unistd_32.h
/usr/src/linux-3.3.8-gentoo/tools/perf/util/include/asm/unistd_32.h

Either the -D__KERNEL__ should be removed (I don't this so), or the kernel headers should be fixed.
Comment 1 Andrew 2012-07-22 18:01:03 UTC
I had the same issue after installing 3.3.8. I created the attached patches based on <http://weltall.heliohost.org/wordpress/2012/01/20/linux-kernel-3-3-rc1-and-nvidia-drivers/>.

These are the steps I followed to get this working on my system.

(1) Put 'nvidia-drivers-96.43.20-kernel-3.3.8-bug-427202.patch' in '/usr/portage/x11-drivers/nvidia-drivers/files'.

(2) Put 'nvidia-drivers-96.43.20-r1.ebuild' in '/usr/portage/x11-drivers/nvidia-drivers'. ('nvidia-drivers-96.43.20.ebuild.patch' shows my changes from 'nvidia-drivers-96.43.20.ebuild'.)

(3) Run 'ebuild /usr/portage/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.20-r1.ebuild manifest'.

(4) Remerge nvidia-drivers.
Comment 2 Andrew 2012-07-22 18:02:13 UTC
Created attachment 318920 [details, diff]
Patch for nvidia-drivers-96.43.20.
Comment 3 Andrew 2012-07-22 18:03:25 UTC
Created attachment 318922 [details]
New ebuild to take advantage of patch.
Comment 4 Andrew 2012-07-22 18:03:57 UTC
Created attachment 318924 [details, diff]
Patch to ebuild.
Comment 5 Petr Pisar 2012-07-24 11:29:48 UTC
The patch works for me.
Comment 6 Amadeusz Żołnowski (RETIRED) gentoo-dev 2012-07-31 14:35:41 UTC
Created attachment 319882 [details]
successful-build.log

I've tested -r1 ebuild with the patch both with 3.2.21-gentoo and 3.3.8-gentoo on x86.
Comment 7 dptr1988 2012-08-05 23:45:19 UTC
I recently switched from nouveau to nvidia while running the 3.3.8-gentoo kernel and encountered the same problem which was fixed by the patch given here
Comment 8 barrie backhurst 2012-08-07 09:07:44 UTC
Not sure whether I should open a new bug?

I installed testing branch(kernel-3.5.0) on a Dell Inspiron 8000 with Geforce2 MX graphics. Having found nouveau would not work I tried nvidia-96.43.20 and applied this patch, however it still failed and I had to apply the workaround found here

https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers/+bug/993506

All works well now, but there should be a better way I imagine?
Comment 9 Doug Goldstein (RETIRED) gentoo-dev 2012-11-18 05:17:59 UTC
Unfortunately the x86 arch stabilization is slacking and once the newer version is stable this problem would be solved.
Comment 10 Doug Goldstein (RETIRED) gentoo-dev 2012-11-18 23:04:14 UTC
Should be fixed since the newer version is stable.