# [SOLVED]virtualbox-modules fails to build with gentoo-kernel

## NForce

I can't find out why virtualbox-modules-3.1.4 fails to build with kernel 2.6.33. I could build it with 2.6.32 kernel. Here is build log:

```

>>> Emerging (1 of 1) app-emulation/virtualbox-modules-3.1.4

 * vbox-kernel-module-src-3.1.4.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...  [ ok ]

 * checking ebuild checksums ;-) ...                                     [ ok ]

 * checking auxfile checksums ;-) ...                                    [ ok ]

 * checking miscfile checksums ;-) ...                                   [ ok ]

 * CPV:  app-emulation/virtualbox-modules-3.1.4

 * REPO: gentoo

 * USE:  amd64 elibc_glibc kernel_linux multilib userland_GNU

 * Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Found kernel object directory:

 *     /lib/modules/2.6.33-gentoo/build

 * Found sources for kernel version:

 *     2.6.33-gentoo

>>> Unpacking source...

>>> Unpacking vbox-kernel-module-src-3.1.4.tar.bz2 to /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work

>>> Source unpacked in /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work

>>> Preparing source in /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work ...

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work ...

ln: creating symbolic link `Module.symvers': File exists

 * Preparing vboxdrv module

make -j3 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS= KERN_DIR=/usr/src/linux KERNOUT=/lib/modules/2.6.33-gentoo/build all 

*** Building 'vboxdrv' module ***

make[1]: Entering directory `/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv'

make KBUILD_VERBOSE= -C /usr/src/linux SUBDIRS=/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv SRCROOT=/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv modules

make[2]: Entering directory `/usr/src/linux-2.6.33-gentoo'

  CC [M]  /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/SUPDrv.o

  CC [M]  /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/SUPDrv-linux.o

  CC [M]  /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/SUPDrvAgnostic.o

In file included from include/linux/gfp.h:4,

                 from include/linux/slab.h:12,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/SUPDrvInternal.h:105,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/SUPDrv.c:35:

include/linux/mmzone.h:18:30: error: generated/bounds.h: No such file or directory

include/linux/mmzone.h:258:5: warning: "MAX_NR_ZONES" is not defined

include/linux/mmzone.h:260:7: warning: "MAX_NR_ZONES" is not defined

include/linux/mmzone.h:262:7: warning: "MAX_NR_ZONES" is not defined

In file included from include/linux/gfp.h:4,

                 from include/linux/slab.h:12,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/SUPDrvInternal.h:105,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/SUPDrv.c:35:

include/linux/mmzone.h:300: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)

In file included from include/linux/gfp.h:4,

                 from include/linux/slab.h:12,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/../SUPDrvInternal.h:105,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/SUPDrv-linux.c:37:

include/linux/mmzone.h:18:30: error: generated/bounds.h: No such file or directory

include/linux/mmzone.h:258:5: warning: "MAX_NR_ZONES" is not defined

include/linux/mmzone.h:260:7: warning: "MAX_NR_ZONES" is not defined

include/linux/mmzone.h:262:7: warning: "MAX_NR_ZONES" is not defined

In file included from include/linux/gfp.h:4,

                 from include/linux/slab.h:12,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/../SUPDrvInternal.h:105,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/SUPDrv-linux.c:37:

include/linux/mmzone.h:300: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)

In file included from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/r0drv/linux/the-linux-kernel.h:82,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/SUPDrv-linux.c:38:

include/linux/mm.h:454:63: warning: "NR_PAGEFLAGS" is not defined

include/linux/mm.h:502:62: warning: "NR_PAGEFLAGS" is not defined

In file included from /usr/src/linux-2.6.33-gentoo/arch/x86/include/asm/unistd_64.h:695,

                 from /usr/src/linux-2.6.33-gentoo/arch/x86/include/asm/unistd.h:5,

                 from include/linux/unistd.h:7,

                 from /usr/src/linux-2.6.33-gentoo/arch/x86/include/asm/seccomp_64.h:4,

                 from /usr/src/linux-2.6.33-gentoo/arch/x86/include/asm/seccomp.h:4,

                 from include/linux/seccomp.h:8,

                 from include/linux/sched.h:80,

                 from include/linux/smp_lock.h:5,

                 from include/linux/hardirq.h:6,

                 from include/linux/pagemap.h:15,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/r0drv/linux/the-linux-kernel.h:83,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/SUPDrv-linux.c:38:

/usr/src/linux-2.6.33-gentoo/arch/x86/include/asm/asm-offsets.h:1:35: error: generated/asm-offsets.h: No such file or directory

make[3]: *** [/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/SUPDrv.o] Error 1

make[3]: *** Waiting for unfinished jobs....

  CC [M]  /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/r0drv/alloc-r0drv.o

make[3]: *** [/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/linux/SUPDrv-linux.o] Error 1

In file included from include/linux/gfp.h:4,

                 from include/linux/kmod.h:22,

                 from include/linux/module.h:13,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/include/internal/iprt.h:56,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/r0drv/alloc-r0drv.c:36:

include/linux/mmzone.h:18:30: error: generated/bounds.h: No such file or directory

include/linux/mmzone.h:258:5: warning: "MAX_NR_ZONES" is not defined

include/linux/mmzone.h:260:7: warning: "MAX_NR_ZONES" is not defined

include/linux/mmzone.h:262:7: warning: "MAX_NR_ZONES" is not defined

In file included from include/linux/gfp.h:4,

                 from include/linux/kmod.h:22,

                 from include/linux/module.h:13,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/include/internal/iprt.h:56,

                 from /var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/r0drv/alloc-r0drv.c:36:

include/linux/mmzone.h:300: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)

make[3]: *** [/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv/r0drv/alloc-r0drv.o] Error 1

make[2]: *** [_module_/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv] Error 2

make[2]: Leaving directory `/usr/src/linux-2.6.33-gentoo'

make[1]: *** [vboxdrv] Error 2

make[1]: Leaving directory `/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work/vboxdrv'

make: *** [all] Error 2

 * ERROR: app-emulation/virtualbox-modules-3.1.4 failed:

 *   Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS=  KERN_DIR=/usr/src/linux KERNOUT=/lib/modules/2.6.33-gentoo/build all

 * 

 * Call stack:

 *     ebuild.sh, line   48:  Called src_compile

 *   environment, line 3567:  Called linux-mod_src_compile

 *   environment, line 2754:  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}";

 * 

 * If you need support, post the output of 'emerge --info =app-emulation/virtualbox-modules-3.1.4',

 * the complete build log and the output of 'emerge -pqv =app-emulation/virtualbox-modules-3.1.4'.

 * The complete build log is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/temp/environment'.

 * S: '/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work'

>>> Failed to emerge app-emulation/virtualbox-modules-3.1.4, Log file:

>>>  '/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/temp/build.log'

 * Messages for package app-emulation/virtualbox-modules-3.1.4:

 * ERROR: app-emulation/virtualbox-modules-3.1.4 failed:

 *   Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS=  KERN_DIR=/usr/src/linux KERNOUT=/lib/modules/2.6.33-gentoo/build all

 * 

 * Call stack:

 *     ebuild.sh, line   48:  Called src_compile

 *   environment, line 3567:  Called linux-mod_src_compile

 *   environment, line 2754:  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}";

 * 

 * If you need support, post the output of 'emerge --info =app-emulation/virtualbox-modules-3.1.4',

 * the complete build log and the output of 'emerge -pqv =app-emulation/virtualbox-modules-3.1.4'.

 * The complete build log is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/temp/environment'.

 * S: '/var/tmp/portage/app-emulation/virtualbox-modules-3.1.4/work'

```

Last edited by NForce on Sun Mar 21, 2010 6:46 pm; edited 1 time in total

----------

## rahulthewall

There has to be something else which is wrong. I just compiled them with 2.6.33-zen1.

```

rahul@googly ~ $ ls -lh /lib/modules/2.6.33-zen1/misc/vbox*

-rw-r--r-- 1 root root 129K Mar 11 18:03 /lib/modules/2.6.33-zen1/misc/vboxdrv.ko

-rw-r--r-- 1 root root 7.1K Mar 11 18:03 /lib/modules/2.6.33-zen1/misc/vboxnetadp.ko

-rw-r--r-- 1 root root  15K Mar 11 18:03 /lib/modules/2.6.33-zen1/misc/vboxnetflt.ko

```

----------

## NForce

You're right, now it fails with 2.6.32 zen too. But what else could be wrong?

----------

## NForce

Solved it. It failed because i made "make clean" after compiling kernel to save some disk space

----------

## katabami

You can generate necessary headers with:

cd /usr/src/linux && make modules_prepare

See also bugzilla: https://bugs.gentoo.org/344783

----------

