Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 424816 - app-emulation/virtualbox-guest-additions-4.1.12 and x11-drivers/xf86-video-virtualbox-4.1.12 with a separate kernel build directory - .../work/VirtualBox-4.1.12/include/iprt/types.h:104:29: fatal error: linux/version.h: No such file or directory
Summary: app-emulation/virtualbox-guest-additions-4.1.12 and x11-drivers/xf86-video-vi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick Lauer
URL: http://www.gossamer-threads.com/lists...
Whiteboard:
Keywords: EBUILD, PATCH
: 426514 (view as bug list)
Depends on:
Blocks: 427852
  Show dependency tree
 
Reported: 2012-07-04 23:29 UTC by Maxim Kammerer
Modified: 2015-04-01 18:28 UTC (History)
7 users (show)

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


Attachments
app-emulation/virtualbox-guest-additions-4.1.12 build log (app-emulation:virtualbox-guest-additions-4.1.12:20120704-230259.log,54.54 KB, text/plain)
2012-07-04 23:31 UTC, Maxim Kammerer
Details
x11-drivers/xf86-video-virtualbox-4.1.12 build log (x11-drivers:xf86-video-virtualbox-4.1.12:20120704-225618.log,54.30 KB, text/plain)
2012-07-04 23:32 UTC, Maxim Kammerer
Details
fixes virtualbox-guest-additions-4.1.12.ebuild (virtualbox-guest-additions.patch,435 bytes, patch)
2012-07-05 04:11 UTC, Maxim Kammerer
Details | Diff
fixes xf86-video-virtualbox-4.1.12.ebuild (xf86-video-virtualbox.patch,428 bytes, patch)
2012-07-05 04:12 UTC, Maxim Kammerer
Details | Diff
fixes virtualbox-guest-additions-4.1.18.ebuild for kernel 3.4.2 (virtualbox-guest-additions.patch,647 bytes, patch)
2012-07-25 02:41 UTC, Maxim Kammerer
Details | Diff
fixes xf86-video-virtualbox-4.1.18.ebuild for kernel 3.4.2 (xf86-video-virtualbox.patch,667 bytes, patch)
2012-07-25 02:42 UTC, Maxim Kammerer
Details | Diff
fixes xf86-video-virtualbox-4.1.18.ebuild for kernel 3.4.2 (xf86-video-virtualbox.patch,661 bytes, patch)
2012-08-08 19:15 UTC, Maxim Kammerer
Details | Diff
build.log for xf86-video-virtualbox-4.1.20 (build.log,68.85 KB, text/plain)
2012-08-29 07:29 UTC, Tomoh K.
Details
patch for xf86-video-virtualbox-4.2.4.ebuild (xf86-video-virtualbox.patch,888 bytes, patch)
2012-11-21 21:21 UTC, Maxim Kammerer
Details | Diff
patch for virtualbox-guest-additions-4.2.4.ebuild (virtualbox-guest-additions.patch,913 bytes, patch)
2012-11-21 21:22 UTC, Maxim Kammerer
Details | Diff
xf86-video-virtualbox-4.2.14.patch (xf86-video-virtualbox-4.2.14.patch,873 bytes, patch)
2013-08-20 23:22 UTC, Maxim Kammerer
Details | Diff
virtualbox-guest-additions-4.2.14.patch (virtualbox-guest-additions-4.2.14.patch,906 bytes, patch)
2013-08-20 23:23 UTC, Maxim Kammerer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Kammerer 2012-07-04 23:29:06 UTC
This bug follows a recent discussion on @gentoo-dev wrt. building kernel as non-root.

/usr/src/linux is sys-kernel/hardened-sources-3.2.11, whereas /usr/src/linux-main (owned by non-root) is the result of "make -C /usr/src/linux O=/usr/src/linux-main modules_prepare". /etc/make.conf contains "KBUILD_OUTPUT=/usr/src/linux-main".

# grep 'declare.*/usr/src/linux' /var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/temp/environment 
declare -- BUILD_PARAMS="KERN_DIR=/usr/src/linux KERNOUT=/usr/src/linux-main"
declare -x KBUILD_OUTPUT="/usr/src/linux-main"
declare -- KERNEL_DIR="/usr/src/linux"
declare -- KERNEL_MAKEFILE="/usr/src/linux/Makefile"
declare -- KV_DIR="/usr/src/linux"
declare -- KV_OUT_DIR="/usr/src/linux-main"
declare -- OUTPUT_DIR="/usr/src/linux-main"


Failing command (note absence of reference to /usr/src/linux-main):

In file included from /var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/include
/iprt/mem.h:31:0,
                 from /var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/src/VBo
x/Runtime/common/alloc/alloc.cpp:34:
/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/include/iprt/types.h:104:29: 
fatal error: linux/version.h: No such file or directory
compilation terminated.
kmk: *** [/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/out/linux.x86/release/obj/RuntimeGuestR0/common/alloc/alloc.o] Error 1
The failing command:
@g++ -c -O2 -nostdinc -iwithprefix include -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -Wno-trigraphs -fdiagnostics-show-option -Wno-sign-compare -fno-stack-protector -O2 -mtune=generic -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -include /var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/include/VBox/VBoxGuestMangling.h -mpreferred-stack-boundary=2 -msoft-float -fno-exceptions -fno-rtti -include /var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/include/VBox/VBoxGuestMangling.h -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/src/VBox/Runtime/r0drv/linux -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/src/VBox/Runtime -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/src/VBox/Runtime/include -I/usr/src/linux/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 -I/usr/src/linux/arch/x86/include/asm/mach-default -I/usr/src/linux/arch/x86/include/generated -I/usr/src/linux/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/out/linux.x86/release -DVBOX -DVBOX_WITH_DEBUGGER -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_HARDENING -DRTPATH_APP_PRIVATE=\"/opt/VirtualBox\" -DRT_OS_LINUX -D_FILE_OFFSET_BITS=64 -DRT_ARCH_X86 -D__X86__ -D__KERNEL__ -DMODULE -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_RT_R0 -DRT_WITH_VBOX -DRT_WITHOUT_NOCRT_WRAPPERS -DRT_NO_EXPORT_SYMBOL -DMODULE -DKBUILD_MODNAME=KBUILD_STR\(vboxdrv\) -DKBUILD_BASENAME=KBUILD_STR\(vboxdrv\) -DIN_SUP_R0 -Wp,-MD,/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/out/linux.x86/release/obj/RuntimeGuestR0/common/alloc/alloc.o.dep -Wp,-MT,/var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/out/linux.x86/release/obj/RuntimeGuestR0/common/alloc/alloc.o -Wp,-MP -o /var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/out/linux.x86/release/obj/RuntimeGuestR0/common/alloc/alloc.o /var/tmp/portage/app-emulation/virtualbox-guest-additions-4.1.12/work/VirtualBox-4.1.12/src/VBox/Runtime/common/alloc/alloc.cpp


Earlier in the log:

Checking for Linux kernel sources: 
  Linux kernel headers not found at /usr/src/linux
Comment 1 Maxim Kammerer 2012-07-04 23:31:52 UTC
Created attachment 317184 [details]
app-emulation/virtualbox-guest-additions-4.1.12 build log
Comment 2 Maxim Kammerer 2012-07-04 23:32:37 UTC
Created attachment 317186 [details]
x11-drivers/xf86-video-virtualbox-4.1.12 build log
Comment 3 Maxim Kammerer 2012-07-05 03:45:57 UTC
Found a fix (for both packages): add "--with-linux=${KV_OUT_DIR}" to src_configure().

For virtualbox-guest-additions, there is still something problematic in the build log:

     * Preparing vboxguest module
    grep: /usr/src/linux/include/linux/version.h: No such file or directory

but both packages produce exactly the same binaries (executables and modules) with regular and split kernel tree setup for me.
Comment 4 Maxim Kammerer 2012-07-05 04:11:25 UTC
Created attachment 317206 [details, diff]
fixes virtualbox-guest-additions-4.1.12.ebuild
Comment 5 Maxim Kammerer 2012-07-05 04:12:09 UTC
Created attachment 317208 [details, diff]
fixes xf86-video-virtualbox-4.1.12.ebuild
Comment 6 Maxim Kammerer 2012-07-25 02:41:36 UTC
Created attachment 319172 [details, diff]
fixes virtualbox-guest-additions-4.1.18.ebuild for kernel 3.4.2

Config.kmk has wrong path to generated includes.
Comment 7 Maxim Kammerer 2012-07-25 02:42:49 UTC
Created attachment 319174 [details, diff]
fixes xf86-video-virtualbox-4.1.18.ebuild for kernel 3.4.2

Config.kmk has wrong path to generated includes.
Comment 8 Maxim Kammerer 2012-08-08 19:15:14 UTC
Created attachment 320744 [details, diff]
fixes xf86-video-virtualbox-4.1.18.ebuild for kernel 3.4.2

Updated wrt. tabs in ebuild.
Comment 9 Maxim Kammerer 2012-08-24 04:23:54 UTC
Hi, any response? I don't see any reason not to use --with-linux=${KV_OUT_DIR}, at least -- it's a configure switch provided by upstream for this exact purpose, after all.
Comment 10 Tomoh K. 2012-08-29 07:29:06 UTC
Created attachment 322499 [details]
build.log for xf86-video-virtualbox-4.1.20

+1 for this bug.

I confirmed the issue is reproduceable when emerging virtualbox-guest-additions-4.1.20 and xf86-video-virtualbox-4.1.20.
build.log for xf86-video-virtualbox-4.1.20 is attached.

My settings are:
1) Linux kernel source is on /usr/src/linux-3.5.0-gentoo
2) /usr/src/linux symlink points to /usr/src/linux-3.5.0-gentoo
3) KBUILD_OUTPUT=/home/tomo/work/kernel-build/current is set as a system-wide environment variable.

Maxim's fix works fine for {xf86-video-virtualbox, virtualbox-guest-additions}-4.1.20. Thanks.
Comment 11 Tomoh K. 2012-08-29 07:37:02 UTC
(In reply to comment #3)
> For virtualbox-guest-additions, there is still something problematic in the
> build log:
> 
>      * Preparing vboxguest module
>     grep: /usr/src/linux/include/linux/version.h: No such file or directory
> 

You can also see the same error when emerging xf86-video-virtualbox[+dri].
This error can be avoided by this patch (same fix is valid for virtualbox-guest-additions).

--- xf86-video-virtualbox-4.1.20.ebuild.orig
+++ xf86-video-virtualbox-4.1.20.ebuild
@@ -48,7 +48,7 @@ QA_TEXTRELS_x86="usr/lib/VBoxOGL.so"
 
 pkg_setup() {
 	linux-mod_pkg_setup
-	BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}"
+	BUILD_PARAMS="KERN_DIR=${KV_OUT_DIR} KERNOUT=${KV_OUT_DIR}"
 
 	python_set_active_version 2
 	python_pkg_setup

> but both packages produce exactly the same binaries (executables and
> modules) with regular and split kernel tree setup for me.

Indeed. This check does nothing when building with >=linux-2.6.0.
But IMO, KERN_DIR=${KV_OUT_DIR} is still reasonable, because VBox's Makefile assumes KERN_DIR as follows.

 KERN_DIR := /lib/modules/$(shell uname -r)/build
(src/VBox/Installer/linux/Makefile.include.header, line 93) 

And I couldn't figure it out why there is "KERNOUT=${KV_OUT_DIR}"...
Comment 12 Maxim Kammerer 2012-11-21 21:21:53 UTC
Created attachment 330168 [details, diff]
patch for xf86-video-virtualbox-4.2.4.ebuild
Comment 13 Maxim Kammerer 2012-11-21 21:22:50 UTC
Created attachment 330172 [details, diff]
patch for virtualbox-guest-additions-4.2.4.ebuild
Comment 14 Maxim Kammerer 2012-11-21 21:25:55 UTC
Patches for 4.2.4 are attached above. Is it possible to reassign this bug to an active developer? No Gentoo developer commented in 4.5 months since this bug was opened. The fixes are quite simple, and there is clearly interest in being able to use VirtualBox packages with split kernels.

(In reply to comment #11)
> This error can be avoided by this patch (same fix is valid for
> virtualbox-guest-additions).

Thanks, I included your fix in patches for 4.2.4 above. I verified that version.h warning does not occur anymore.
Comment 15 Maxim Kammerer 2013-08-20 23:22:54 UTC
Created attachment 356544 [details, diff]
xf86-video-virtualbox-4.2.14.patch
Comment 16 Maxim Kammerer 2013-08-20 23:23:27 UTC
Created attachment 356546 [details, diff]
virtualbox-guest-additions-4.2.14.patch
Comment 17 Maxim Kammerer 2013-08-20 23:25:24 UTC
Is it possible to at least apply KERN_DIR=${KV_OUT_DIR} and --with-linux=${KV_OUT_DIR} to ebuilds in the tree?
Comment 18 Ben Kohler gentoo-dev 2013-10-03 20:20:48 UTC
*** Bug 426514 has been marked as a duplicate of this bug. ***
Comment 19 Maxim Kammerer 2014-07-15 20:56:09 UTC
This bug has been fixed in VirtualBox 4.3.

app-emulation/virtualbox-guest-additions-4.3.10 and x11-drivers/xf86-video-virtualbox-4.3.10 build fine after adding "--with-linux=${KV_OUT_DIR} \" to both ebuilds:

 	--disable-alsa \
+	--with-linux=${KV_OUT_DIR} \
 	--build-headless || die "configure failed"

So if anyone still cares about VirtualBox (this bug has been open for two years with zero feedback from maintainers), please add the --with-linux switch to the 4.3 ebuilds, thanks!
Comment 20 aabarkley3 2014-12-16 16:15:27 UTC
Time to close this (RESOLVED WON'T FIX). The oldest version in the tree is 4.2.24.
Comment 21 SpanKY gentoo-dev 2015-04-01 18:23:34 UTC
should be all set now in the tree; thanks for the report!

Commit message: Pass in the right kernel build dir that the user set up
http://sources.gentoo.org/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-4.3.26.ebuild?r1=1.2&r2=1.3
Comment 22 SpanKY gentoo-dev 2015-04-01 18:28:35 UTC
should be all set now in the tree; thanks for the report!

Commit message: Pass in the right kernel build dir that the user set up
http://sources.gentoo.org/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-4.3.26.ebuild?r1=1.2&r2=1.3