Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 627822 - =app-emulation/virtualbox-modules-5.0.40: Failed to build with Linux kernel >= 4.12
Summary: =app-emulation/virtualbox-modules-5.0.40: Failed to build with Linux kernel >...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Lars Wendler (Polynomial-C)
Keywords: PATCH
: 630076 (view as bug list)
Depends on: 628780
  Show dependency tree
Reported: 2017-08-14 10:55 UTC by ALeX
Modified: 2017-10-04 06:15 UTC (History)
21 users (show)

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

patch (virtualbox-modules-5.1.22-page-table.patch,2.12 KB, patch)
2017-08-16 08:35 UTC, Sergey Pushilin
Details | Diff
Failed build (app-emulation:virtualbox-modules-5.0.40:20170816-160640.log,36.56 KB, text/x-log)
2017-08-16 16:08 UTC, Bob Johnson
removed_cpp_hack_for_the_new.patch (removed_cpp_hack_for_the_new.patch,2.48 KB, patch)
2017-08-17 05:10 UTC, Sergey Pushilin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ALeX 2017-08-14 10:55:06 UTC
Linux kernel >= 4.12 have some changes in API.
gentoo-sources-4.12.5 is stable now, so virtualbox-modules-5.0.40 can't be build. 
Seems this is fixed in virtualbox-modules-5.1.26.

Reproducible: Always

Steps to Reproduce:
1. emerge =sys-kernel/gentoo-sources-4.12.5
2. Build new kernel with genkernel or manualy
3. emerge =app-emulation/virtualbox-modules-5.0.40
Actual Results:  
emerge should build package

Expected Results:  
emerge fails with vuild error

/var/tmp/portage/app-emulation/virtualbox-modules-5.0.40/work/vboxdrv/r0drv/linux/alloc-r0drv-linux.c: In function ‘VBoxHost_RTMemContAlloc’:
/var/tmp/portage/app-emulation/virtualbox-modules-5.0.40/work/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:444:13: error: implicit declaration of function ‘set_pages_x’ [-Werror=implicit-function-declaration]
             MY_SET_PAGES_EXEC(&paPages[iPage], 1);
/var/tmp/portage/app-emulation/virtualbox-modules-5.0.40/work/vboxdrv/r0drv/linux/alloc-r0drv-linux.c: In function ‘VBoxHost_RTMemContFree’:
/var/tmp/portage/app-emulation/virtualbox-modules-5.0.40/work/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:492:13: error: implicit declaration of function ‘set_pages_nx’ [-Werror=implicit-function-declaration]
             MY_SET_PAGES_NOEXEC(&paPages[iPage], 1);
cc1: some warnings being treated as errors
make[4]: *** [/usr/src/linux-4.12.5-gentoo/scripts/ /var/tmp/portage/app-emulation/virtualbox-modules-5.0.40/work/vboxdrv/r0drv/linux/alloc-r0drv-linux.o] Error 1
make[4]: *** Waiting for unfinished jobs....
/var/tmp/portage/app-emulation/virtualbox-modules-5.0.40/work/vboxdrv/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjLinuxVirtToPage’:
/var/tmp/portage/app-emulation/virtualbox-modules-5.0.40/work/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:921:27: error: passing argument 1 of ‘pud_offset’ from incompatible pointer type [-Werror=incompatible-pointer-types]
     u.Upper = *pud_offset(&u.Global, ulAddr);
Comment 1 ALeX 2017-08-14 10:58:44 UTC
Expected Results:
emerge should build package

Actual Results:
emerge fails with build error
Comment 2 XMs 2017-08-15 12:40:21 UTC
I can confirm it, have same problem, too
Comment 3 Niccolò Scatena 2017-08-15 16:04:44 UTC
Same issue. Fixed appling this patch:
Comment 4 Arnaud Launay 2017-08-16 08:30:53 UTC
The patch doesn't apply cleanly on 5.0.40... Does someone has a working version ?
Comment 5 Sergey Pushilin 2017-08-16 08:33:16 UTC
Remove fist 3 lines from patch
Comment 6 Sergey Pushilin 2017-08-16 08:35:21 UTC
Created attachment 489244 [details, diff]
Comment 7 Bob Johnson 2017-08-16 16:08:13 UTC
Created attachment 489282 [details]
Failed build
Comment 8 Sergey Pushilin 2017-08-17 05:10:23 UTC
Created attachment 489370 [details, diff]
Comment 9 Jeff 2017-08-18 22:26:59 UTC
I can confirm this problem exists. In my case I was building "app-emulation/libvirt-3.3.0" with the following flags: 

"app-emulation/libvirt-3.3.0 +caps +dbus +elibc_glibc +libssh +libvirtd +lvm +lxc +nls +parted +pcap +qemu +udev +virt-network -apparmor -audit -firewalld -fuse -glusterfs -iscsi -macvtap -nfs -numa -openvz -phyp -policykit -rbd -sasl -selinux -uml -vepa -virtualbox -wireshark-plugins -xen -zeroconf -zfs"

The "crash" does occur in the "virtualbox-modules-5.1.26" package due to a fault in the "ebuild" for this package. The "ebuild" is looking for "autoconf.h". In the source for 4.12.5, that file is located at:


The "ebuild" is using the following search logic:
less -N /usr/portage/app-emulation/virtualbox-modules/virtualbox-modules-5.0.40.ebuild  [and reformatted here to improve readability]

 40 src_prepare() {
 41   if kernel_is -ge 2 6 33 ; then
 42     # evil patch for new kernels - header moved
 43     grep -lR linux/autoconf.h *  | xargs sed -i -e 's:<linux/autoconf.h>:<generated/autoconf.h>:'
 44   fi
 46   if use pax_kernel && kernel_is -ge 3 0 0 ; then
 47     epatch "${FILESDIR}"/${PN}-4.1.4-pax-const.patch
 48   fi
 50   default
 51 }

I changed line 43 to say this:

 43  grep -lR linux/include/generated/autoconf.h *  | xargs sed -i -e 's:<linux/autoconf.h>:<generated/autoconf.h>:'

Now the original "emerge" request I am making for "app-emulation/libvirt-3.3.0" actually compiles the "virtualbox-modules" package without error and "emerge" announces the new modules in it's "spill" at the end of the compile. I have yet to test the actual "virtualbox" code, but now I am seeing an error in the "app-emulation/virtualbox-5.1.26" package that needs investigation.

Yes, I had to use the "emerge --digest" option to turn off digest checking of the "ebuild" file so that I could test my change. That is not a recommended workaround, but it makes things work for testing purposes on a non-production machine.
Comment 10 Herb Miller Jr. 2017-08-19 03:42:15 UTC
(In reply to Arnaud Launay from comment #4)
> The patch doesn't apply cleanly on 5.0.40... Does someone has a working
> version ?

My page table patch doesn't work on 5.0.40 because it's for 5.1.22.
Comment 11 Arnaud Launay 2017-08-19 09:28:10 UTC

I applied the two patches enclosed in the bug, I have the pleasure to report that 5.0.40 compiles fine again.
Comment 12 Alex 2017-08-19 18:30:46 UTC
Same here.

Virtualbox-modules-5.0.40 fails with 4.12.5

The above two patches fixed the issue for me (i.e. it builds now).


Comment 13 crocket 2017-08-20 04:30:10 UTC
What do you mean by two patches?

Do you mean and
Comment 14 Arnaud Launay 2017-08-20 12:54:43 UTC
Yes, those two exactly:

From Sergey (thanks !)
Comment 15 Fanjio 2017-08-25 06:03:15 UTC
I confirm that those two patches fix the issue, and boxes run fine. Thanks a lot.
Comment 16 Maciej Mrozowski gentoo-dev 2017-09-21 01:14:52 UTC
In my case, those patches cause host hard-lock with linux-4.12.12 when VM OS (Win 10 x64 in my case) is started.
Comment 17 Petr Vokac 2017-09-22 12:59:13 UTC
After implementation of these two patches I am getting for all virtual machines:

Failed to open a session for the virtual machine xp.

The VM session was aborted.

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: SessionMachine
Interface: ISession {7844aa05-b02e-4cdd-a04f-ade4a762e6b7}
Comment 18 Lars Wendler (Polynomial-C) gentoo-dev 2017-10-02 09:17:14 UTC
Should be fixed with stabilization fo virtualbox-5.1.26
Comment 19 Lars Wendler (Polynomial-C) gentoo-dev 2017-10-03 09:27:27 UTC
*** Bug 630076 has been marked as a duplicate of this bug. ***