Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603472 - >=app-emulation/virtualbox-guest-additions-5.1.12 fails to build with kernel 4.9.0 - error: uninitialized const member in 'union atomic_read(const atomic_t*)::<anonymous>'
Summary: >=app-emulation/virtualbox-guest-additions-5.1.12 fails to build with kernel ...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 6 votes (vote)
Assignee: Lars Wendler (Polynomial-C) (RETIRED)
URL:
Whiteboard:
Keywords:
: 607480 610342 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-22 15:11 UTC by Helmut Jarausch
Modified: 2018-10-26 09:48 UTC (History)
27 users (show)

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


Attachments
build log xz-compressed (virtualbox-guest-additions-5.1.12.build.xz,38.81 KB, application/x-xz)
2016-12-22 15:13 UTC, Helmut Jarausch
Details
archive of build.log, environment, emerge --info and emerge -pqv (vbox.tgz,95.74 KB, application/x-compressed-tar)
2017-02-05 05:29 UTC, BobbyK
Details
remove extern decl. (0001-Correct-function-definition-for-C.patch,1.03 KB, patch)
2017-02-21 15:12 UTC, Joakim Tjernlund
Details | Diff
Uninitialized C++ const issue (0002-compiler.h-fix-C-uninitialized-const-issue.patch,1.72 KB, patch)
2017-02-21 15:13 UTC, Joakim Tjernlund
Details | Diff
bitops typ fixes (0001-x86-Match-bitops-prototypes.patch,4.31 KB, patch)
2017-03-09 19:00 UTC, Joakim Tjernlund
Details | Diff
void * cast with uintptr_t (0003-x86-asm-bitops.h.patch,855 bytes, patch)
2017-03-09 19:02 UTC, Joakim Tjernlund
Details | Diff
Mock up a __builtin_types_compatible_p for C++ (0004-compiler.h-Mock-up-a-__builtin_types_compatible_p-fo.patch,1.16 KB, patch)
2017-03-09 19:02 UTC, Joakim Tjernlund
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Jarausch 2016-12-22 15:11:46 UTC
x86_64-pc-linux-gnu-g++ -c -O2 -fno-pie -nostdinc -iwithprefix include -include /lib/modules/4.9.0/build/include/linux/kconfig.h -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -Wno-trigraphs -fdiagnostics-show-option -Wno-unused-parameter -Wlogical-op -Wno-variadic-macros -Wno-sign-compare -fdiagnostics-show-option -fno-stack-protector -O2 -mtune=generic -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -include /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/include/VBox/VBoxGuestMangling.h -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time -Wno-sign-compare -fno-exceptions -fno-rtti -include /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/include/VBox/VBoxGuestMangling.h -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/src/VBox/Runtime/r0drv/linux -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/src/VBox/Runtime -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/src/VBox/Runtime/include -I/lib/modules/4.9.0/build/include -I/lib/modules/4.9.0/build/include/asm-i386/mach-default -I/lib/modules/4.9.0/build/include/asm-x86/mach-default -I/lib/modules/4.9.0/build/include/drm -I/lib/modules/4.9.0/build/arch/x86/include -I/lib/modules/4.9.0/build/arch/x86/include/asm/mach-default -I/lib/modules/4.9.0/build/arch/x86/include/uapi -I/lib/modules/4.9.0/build/arch/x86/include/generated -I/lib/modules/4.9.0/build/arch/x86/include/generated/uapi -I/lib/modules/4.9.0/build/include/uapi -I/lib/modules/4.9.0/build/include/generated/uapi -I/lib/modules/4.9.0/build/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/out/linux.amd64/release/obj/RuntimeGuestR0/dtrace -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/out/linux.amd64/release -DVBOX -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_REM -DVBOX_WITH_RAW_MODE -DRT_OS_LINUX -D_FILE_OFFSET_BITS=64 -DRT_ARCH_AMD64 -D__AMD64__ -DVBOX_WITH_DEBUGGER -DVBOX_WITH_HARDENING -DRTPATH_APP_PRIVATE=\"/opt/VirtualBox\" -DRTPATH_APP_PRIVATE_ARCH=\"/opt/VirtualBox\" -DRTPATH_SHARED_LIBS=\"/opt/VirtualBox\" -DRTPATH_APP_DOCS=\"/opt/VirtualBox\" -DIN_RING0 -DIN_RT_R0 -DHC_ARCH_BITS=64 -DGC_ARCH_BITS=64 -D__KERNEL__ -DMODULE -DIN_GUEST -DIN_GUEST_R0 -DIN_RT_R0 -DRT_WITH_VBOX -DRT_WITHOUT_NOCRT_WRAPPERS -DRT_NO_EXPORT_SYMBOL -DNOFILEID -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-5.1.12/work/VirtualBox-5.1.12/out/linux.amd64/release/obj/RuntimeGuestR0/common/checksum/alt-md5.o.dep -Wp,-MT,/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/out/linux.amd64/release/obj/RuntimeGuestR0/common/checksum/alt-md5.o -Wp,-MP -o /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/out/linux.amd64/release/obj/RuntimeGuestR0/common/checksum/alt-md5.o /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/src/VBox/Runtime/common/checksum/alt-md5.cpp
In file included from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/include/iprt/types.h:140:0,
                 from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/include/iprt/mem.h:31,
                 from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.12/work/VirtualBox-5.1.12/src/VBox/Runtime/common/alloc/alloc.cpp:34:
/lib/modules/4.9.0/build/arch/x86/include/asm/atomic.h: In function 'int atomic_read(const atomic_t*)':
/lib/modules/4.9.0/build/include/linux/compiler.h:305:42: error: uninitialized const member in 'union atomic_read(const atomic_t*)::<anonymous>'
  union { typeof(x) __val; char __c[1]; } __u;   \
                                          ^
/lib/modules/4.9.0/build/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
Comment 1 Helmut Jarausch 2016-12-22 15:13:16 UTC
Created attachment 457128 [details]
build log xz-compressed
Comment 2 Helmut Jarausch 2017-01-18 19:30:24 UTC
Unfortunately, the same is true for version 5.1.14
Comment 3 Zac Medico gentoo-dev 2017-01-27 02:55:36 UTC
Builds with 4.4 kernel, but not with 4.9.
Comment 4 Vasco Steinmetz 2017-02-04 03:48:29 UTC
The compilation fails only on 64 bit (x86-64) guests.
On 32 bit (x86) guests it compiles without errors.
Comment 5 BobbyK 2017-02-05 05:29:12 UTC
Created attachment 462468 [details]
archive of build.log, environment, emerge --info and emerge -pqv

Not sure whether it's the same issue, stable app-emulation/virtualbox-guest-additions-5.0.32 fails to build with stable sys-kernel/gentoo-sources-4.9.6-r1, though as the error is the same, figured it would be better to add info here than to open a new bug.

x86_64-pc-linux-gnu-g++ -c -O2 -fno-pie -nostdinc -iwithprefix include -include /lib/modules/4.9.6-gentoo-r1/build/include/linux/kconfig.h -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -Wno-trigraphs -fdiagnostics-show-option -Wno-unused-parameter -Wlogical-op -Wno-sign-compare -fdiagnostics-show-option -fno-stack-protector -O2 -mtune=generic -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -include /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/include/VBox/VBoxGuestMangling.h -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time -Wno-sign-compare -fno-exceptions -fno-rtti -include /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/include/VBox/VBoxGuestMangling.h -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/src/VBox/Runtime/r0drv/linux -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/src/VBox/Runtime -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/src/VBox/Runtime/include -I/lib/modules/4.9.6-gentoo-r1/build/include -I/lib/modules/4.9.6-gentoo-r1/build/include/asm-i386/mach-default -I/lib/modules/4.9.6-gentoo-r1/build/include/asm-x86/mach-default -I/lib/modules/4.9.6-gentoo-r1/build/include/drm -I/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include -I/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/asm/mach-default -I/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/uapi -I/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/generated -I/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/generated/uapi -I/lib/modules/4.9.6-gentoo-r1/build/include/uapi -I/lib/modules/4.9.6-gentoo-r1/build/include/generated/uapi -I/lib/modules/4.9.6-gentoo-r1/build/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/out/linux.amd64/release/obj/RuntimeGuestR0/dtrace -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/out/linux.amd64/release -DVBOX -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_DEBUGGER -DRT_OS_LINUX -D_FILE_OFFSET_BITS=64 -DRT_ARCH_AMD64 -D__AMD64__ -DVBOX_WITH_HARDENING -DRTPATH_APP_PRIVATE=\"/opt/VirtualBox\" -DRTPATH_APP_PRIVATE_ARCH=\"/opt/VirtualBox\" -DRTPATH_SHARED_LIBS=\"/opt/VirtualBox\" -DRTPATH_APP_DOCS=\"/opt/VirtualBox\" -DIN_RING0 -DIN_RT_R0 -DHC_ARCH_BITS=64 -DGC_ARCH_BITS=64 -D__KERNEL__ -DMODULE -DIN_GUEST -DIN_GUEST_R0 -DIN_RT_R0 -DRT_WITH_VBOX -DRT_WITHOUT_NOCRT_WRAPPERS -DRT_NO_EXPORT_SYMBOL -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-5.0.32/work/VirtualBox-5.0.32/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/heapoffset.o.dep -Wp,-MT,/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/heapoffset.o -Wp,-MP -o /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/heapoffset.o /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/src/VBox/Runtime/common/alloc/heapoffset.cpp
In file included from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/include/iprt/types.h:116:0,
                 from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/include/iprt/heap.h:30,
                 from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.0.32/work/VirtualBox-5.0.32/src/VBox/Runtime/common/alloc/heapsimple.cpp:32:
/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/asm/atomic.h: In function ‘int atomic_read(const atomic_t*)’:
/lib/modules/4.9.6-gentoo-r1/build/include/linux/compiler.h:305:42: error: uninitialized const member in ‘union atomic_read(const atomic_t*)::<anonymous>’
  union { typeof(x) __val; char __c[1]; } __u;   \
                                          ^

Note, app-emulation/virtualbox-guest-additions-5.0.32 builds with sys-kernel/gentoo-sources-4.4.39, and VBoxLinuxAdditions.run (from the guest additions iso) successfully builds guest modules for sys-kernel/gentoo-sources-4.9.6-r1.
Comment 6 Mattia Rossi 2017-02-08 12:56:02 UTC
Can confirm: Error happens with kernel 4.9.x on x86-64
Did not happen with kernel 4.8.x

gcc and glibc were the same for both kernels
gcc: 5.4.0-r3
glibc: 2.23-r3
Comment 7 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2017-02-08 15:44:54 UTC
This is an issue that - according to upstream - will not be fixed anytime soon.

So I suggest to use 4.4 LTS kernel for Gentoo guests VMs for the time being.
Comment 8 Johan Ymerson 2017-02-15 08:58:36 UTC
Is there a bug report upstream for this? I can't find any. From what I can find, guest additions >=5.1.12 is supposed to work with kernel 4.9.
(https://www.virtualbox.org/ticket/16155)
Comment 9 Vivek Shah 2017-02-15 13:08:58 UTC
(In reply to BobbyK from comment #5)

Have the same problem building virtualbox-guest-additions-5.0.32 with kernel 4.9.6-r1 and gcc-4.9.4 as reported by BobbyK.
Comment 10 Joakim Tjernlund 2017-02-19 21:22:25 UTC
Posted a potential fix in the wrong bug:
  https://bugs.gentoo.org/show_bug.cgi?id=607480
Head over if you are interested.
Comment 11 Nathan Torchia 2017-02-20 01:01:26 UTC
(In reply to Joakim Tjernlund from comment #10)
> Posted a potential fix in the wrong bug:
>   https://bugs.gentoo.org/show_bug.cgi?id=607480
> Head over if you are interested.

I tried the 3 patches, but I still get the (In reply to Joakim Tjernlund from comment #10)
> Posted a potential fix in the wrong bug:
>   https://bugs.gentoo.org/show_bug.cgi?id=607480
> Head over if you are interested.

I tried the 3 patches out, but build still fails with same atomic_read error.
Comment 12 Joakim Tjernlund 2017-02-20 06:16:55 UTC
(In reply to Nathan Torchia from comment #11)
> (In reply to Joakim Tjernlund from comment #10)
> > Posted a potential fix in the wrong bug:
> >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > Head over if you are interested.
> 
> I tried the 3 patches, but I still get the (In reply to Joakim Tjernlund
> from comment #10)
> > Posted a potential fix in the wrong bug:
> >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > Head over if you are interested.
> 
> I tried the 3 patches out, but build still fails with same atomic_read error.

hmm, what are you bulding with ?
Make sure you have the patches propely applied everywhere, throw
the patches into /etc/portage/patches/sys-kernel/vanilla-sources/
(or gentoo-sources) and remerge the kernel.
Comment 13 Joakim Tjernlund 2017-02-20 09:50:01 UTC
seems like xf85-virtualbox-video need the same ebuild fixes
Comment 14 Sergey Ilinykh 2017-02-20 09:59:12 UTC
@Joakim, Thanks, it works!

My WM booted with kernel-4.9.6. VB additions work properly.
Comment 15 Joakim Tjernlund 2017-02-20 11:30:46 UTC
(In reply to Rion from comment #14)
> @Joakim, Thanks, it works!
> 
> My WM booted with kernel-4.9.6. VB additions work properly.

Good :)

The kernel patches I could try to upstream, I hope they are acceptable
for main stream linux too but it will take time I guess before they will
find its way back to 4.9

The ebuild stuff just used trial and error, maybe there is a better way
to add that?
Comment 16 Paolo Pedroni 2017-02-20 16:12:54 UTC
Nope. Patched kernel, rebooted, run modified ebuilds. Now I get a bunch of warnings like:

In file included from /var/tmp/portage/x11-drivers/xf86-video-virtualbox-5.1.14/work/VirtualBox-5.1.14/include/iprt/types.h:140:0,
                 from /var/tmp/portage/x11-drivers/xf86-video-virtualbox-5.1.14/work/VirtualBox-5.1.14/include/iprt/mem.h:31,
                 from /var/tmp/portage/x11-drivers/xf86-video-virtualbox-5.1.14/work/VirtualBox-5.1.14/src/VBox/Runtime/common/alloc/alloc.cpp:34:
/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/asm/atomic.h: In function ‘int atomic_read(const atomic_t*)’:
/lib/modules/4.9.6-gentoo-r1/build/include/linux/compiler.h:316:41: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
  union { typeof(x) __val; char __c[1]={0}; } __u;  \
                                         ^
/lib/modules/4.9.6-gentoo-r1/build/include/linux/compiler.h:324:22: note: in expansion of macro ‘__READ_ONCE’
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/asm/atomic.h:26:9: note: in expansion of macro ‘READ_ONCE’
  return READ_ONCE((v)->counter);

and then:

/lib/modules/4.9.6-gentoo-r1/build/include/asm-generic/bitops/le.h: In function ‘long unsigned int find_next_zero_bit_le(const void
*, long unsigned int, long unsigned int)’:
/lib/modules/4.9.6-gentoo-r1/build/include/asm-generic/bitops/le.h:14:46: error: invalid conversion from ‘const void*’ to ‘const long unsigned int*’ [-fpermissive]
  return find_next_zero_bit(addr, size, offset);

:-(
Comment 17 Paolo Pedroni 2017-02-20 16:14:43 UTC
(In reply to Paolo Pedroni from comment #16)
> Nope. Patched kernel, rebooted, run modified ebuilds. Now I get a bunch of
> warnings like:
> 
> In file included from
> /var/tmp/portage/x11-drivers/xf86-video-virtualbox-5.1.14/work/VirtualBox-5.
> 1.14/include/iprt/types.h:140:0,
>                  from
> /var/tmp/portage/x11-drivers/xf86-video-virtualbox-5.1.14/work/VirtualBox-5.
> 1.14/include/iprt/mem.h:31,
>                  from
> /var/tmp/portage/x11-drivers/xf86-video-virtualbox-5.1.14/work/VirtualBox-5.
> 1.14/src/VBox/Runtime/common/alloc/alloc.cpp:34:
> /lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/asm/atomic.h: In
> function ‘int atomic_read(const atomic_t*)’:
> /lib/modules/4.9.6-gentoo-r1/build/include/linux/compiler.h:316:41: warning:
> non-static data member initializers only available with -std=c++11 or
> -std=gnu++11
>   union { typeof(x) __val; char __c[1]={0}; } __u;  \
>                                          ^
> /lib/modules/4.9.6-gentoo-r1/build/include/linux/compiler.h:324:22: note: in
> expansion of macro ‘__READ_ONCE’
>  #define READ_ONCE(x) __READ_ONCE(x, 1)
>                       ^
> /lib/modules/4.9.6-gentoo-r1/build/arch/x86/include/asm/atomic.h:26:9: note:
> in expansion of macro ‘READ_ONCE’
>   return READ_ONCE((v)->counter);
> 
> and then:
> 
> /lib/modules/4.9.6-gentoo-r1/build/include/asm-generic/bitops/le.h: In
> function ‘long unsigned int find_next_zero_bit_le(const void
> *, long unsigned int, long unsigned int)’:
> /lib/modules/4.9.6-gentoo-r1/build/include/asm-generic/bitops/le.h:14:46:
> error: invalid conversion from ‘const void*’ to ‘const long unsigned int*’
> [-fpermissive]
>   return find_next_zero_bit(addr, size, offset);
> 
> :-(

Scratch that. I forgot to modify the xf86-video-virtualbox ebuild. Stupid me!
Comment 18 Paolo Pedroni 2017-02-20 16:32:52 UTC
@Joakim, Thanks, it now works!
Comment 19 Nathan Torchia 2017-02-21 02:31:15 UTC
(In reply to Joakim Tjernlund from comment #12)
> (In reply to Nathan Torchia from comment #11)
> > (In reply to Joakim Tjernlund from comment #10)
> > > Posted a potential fix in the wrong bug:
> > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > Head over if you are interested.
> > 
> > I tried the 3 patches, but I still get the (In reply to Joakim Tjernlund
> > from comment #10)
> > > Posted a potential fix in the wrong bug:
> > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > Head over if you are interested.
> > 
> > I tried the 3 patches out, but build still fails with same atomic_read error.
> 
> hmm, what are you bulding with ?
> Make sure you have the patches propely applied everywhere, throw
> the patches into /etc/portage/patches/sys-kernel/vanilla-sources/
> (or gentoo-sources) and remerge the kernel.


Whew, okay, I figured it out. I'm using GCC 6.3.0 which has some new C++ stuff enabled by default. I was getting an error like: "error: use of deleted function". So I changed the patch to:

union _u { _u(){}; typeof(x) __val; char __c[1]={0}; } __u; 

It just includes a default ctor. And it all compiles fine now.
Comment 20 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2017-02-21 08:01:07 UTC
*** Bug 607480 has been marked as a duplicate of this bug. ***
Comment 21 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2017-02-21 08:01:19 UTC
*** Bug 610342 has been marked as a duplicate of this bug. ***
Comment 22 Joakim Tjernlund 2017-02-21 13:11:08 UTC
(In reply to Nathan Torchia from comment #19)
> (In reply to Joakim Tjernlund from comment #12)
> > (In reply to Nathan Torchia from comment #11)
> > > (In reply to Joakim Tjernlund from comment #10)
> > > > Posted a potential fix in the wrong bug:
> > > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > > Head over if you are interested.
> > > 
> > > I tried the 3 patches, but I still get the (In reply to Joakim Tjernlund
> > > from comment #10)
> > > > Posted a potential fix in the wrong bug:
> > > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > > Head over if you are interested.
> > > 
> > > I tried the 3 patches out, but build still fails with same atomic_read error.
> > 
> > hmm, what are you bulding with ?
> > Make sure you have the patches propely applied everywhere, throw
> > the patches into /etc/portage/patches/sys-kernel/vanilla-sources/
> > (or gentoo-sources) and remerge the kernel.
> 
> 
> Whew, okay, I figured it out. I'm using GCC 6.3.0 which has some new C++
> stuff enabled by default. I was getting an error like: "error: use of
> deleted function". So I changed the patch to:
> 
> union _u { _u(){}; typeof(x) __val; char __c[1]={0}; } __u; 
> 
> It just includes a default ctor. And it all compiles fine now.

I get with gcc 4.9.4:
/lib/modules/4.9.11/build/include/linux/compiler.h:316:13: warning: ISO C++ forbids declaration of ‘_u’ with no type [-fpermissive]
  union { _u(){}; typeof(x) __val; char __c[1]={0}; } __u;

Could we do better(I don't know C++)?
Comment 23 Joakim Tjernlund 2017-02-21 13:16:58 UTC
(In reply to Joakim Tjernlund from comment #22)
> (In reply to Nathan Torchia from comment #19)
> > (In reply to Joakim Tjernlund from comment #12)
> > > (In reply to Nathan Torchia from comment #11)
> > > > (In reply to Joakim Tjernlund from comment #10)
> > > > > Posted a potential fix in the wrong bug:
> > > > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > > > Head over if you are interested.
> > > > 
> > > > I tried the 3 patches, but I still get the (In reply to Joakim Tjernlund
> > > > from comment #10)
> > > > > Posted a potential fix in the wrong bug:
> > > > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > > > Head over if you are interested.
> > > > 
> > > > I tried the 3 patches out, but build still fails with same atomic_read error.
> > > 
> > > hmm, what are you bulding with ?
> > > Make sure you have the patches propely applied everywhere, throw
> > > the patches into /etc/portage/patches/sys-kernel/vanilla-sources/
> > > (or gentoo-sources) and remerge the kernel.
> > 
> > 
> > Whew, okay, I figured it out. I'm using GCC 6.3.0 which has some new C++
> > stuff enabled by default. I was getting an error like: "error: use of
> > deleted function". So I changed the patch to:
> > 
> > union _u { _u(){}; typeof(x) __val; char __c[1]={0}; } __u; 
> > 
> > It just includes a default ctor. And it all compiles fine now.
> 
> I get with gcc 4.9.4:
> /lib/modules/4.9.11/build/include/linux/compiler.h:316:13: warning: ISO C++
> forbids declaration of ‘_u’ with no type [-fpermissive]
>   union { _u(){}; typeof(x) __val; char __c[1]={0}; } __u;
> 
> Could we do better(I don't know C++)?

Or this:
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
  union { void _u(){}; typeof(x) __val; char __c[1]={0}; } __u;
Comment 24 Joakim Tjernlund 2017-02-21 13:24:28 UTC
(In reply to Joakim Tjernlund from comment #23)
> (In reply to Joakim Tjernlund from comment #22)
> > (In reply to Nathan Torchia from comment #19)
> > > (In reply to Joakim Tjernlund from comment #12)
> > > > (In reply to Nathan Torchia from comment #11)
> > > > > (In reply to Joakim Tjernlund from comment #10)
> > > > > > Posted a potential fix in the wrong bug:
> > > > > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > > > > Head over if you are interested.
> > > > > 
> > > > > I tried the 3 patches, but I still get the (In reply to Joakim Tjernlund
> > > > > from comment #10)
> > > > > > Posted a potential fix in the wrong bug:
> > > > > >   https://bugs.gentoo.org/show_bug.cgi?id=607480
> > > > > > Head over if you are interested.
> > > > > 
> > > > > I tried the 3 patches out, but build still fails with same atomic_read error.
> > > > 
> > > > hmm, what are you bulding with ?
> > > > Make sure you have the patches propely applied everywhere, throw
> > > > the patches into /etc/portage/patches/sys-kernel/vanilla-sources/
> > > > (or gentoo-sources) and remerge the kernel.
> > > 
> > > 
> > > Whew, okay, I figured it out. I'm using GCC 6.3.0 which has some new C++
> > > stuff enabled by default. I was getting an error like: "error: use of
> > > deleted function". So I changed the patch to:
> > > 
> > > union _u { _u(){}; typeof(x) __val; char __c[1]={0}; } __u; 
> > > 
> > > It just includes a default ctor. And it all compiles fine now.
> > 
> > I get with gcc 4.9.4:
> > /lib/modules/4.9.11/build/include/linux/compiler.h:316:13: warning: ISO C++
> > forbids declaration of ‘_u’ with no type [-fpermissive]
> >   union { _u(){}; typeof(x) __val; char __c[1]={0}; } __u;
> > 
> > Could we do better(I don't know C++)?
> 
> Or this:
> warning: non-static data member initializers only available with -std=c++11
> or -std=gnu++11
>   union { void _u(){}; typeof(x) __val; char __c[1]={0}; } __u;

How about:
  union { void _u(void){}; typeof(x) __val; char __c[1]; } __u={0};

Just guessing though.
Comment 25 Joakim Tjernlund 2017-02-21 15:12:02 UTC
Created attachment 464534 [details, diff]
remove extern decl.
Comment 26 Joakim Tjernlund 2017-02-21 15:13:08 UTC
Created attachment 464536 [details, diff]
Uninitialized C++ const issue
Comment 27 Joakim Tjernlund 2017-02-21 15:17:00 UTC
I just sent these two patches upstream, lets see what they think.

Meanwhile perhaps this diff could be included in the two ebuilds:
--- /usr/portage/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-5.1.14.ebuild	2017-01-18 02:39:05.000000000 +0100
+++ /var/lib/layman/transmode/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-5.1.14-r1.ebuild	2017-02-21 15:42:58.723210789 +0100
@@ -122,7 +122,8 @@
 	MAKE="kmk" \
 	emake TOOL_YASM_AS=yasm \
 	VBOX_ONLY_ADDITIONS=1 \
-	KBUILD_VERBOSE=2
+	KBUILD_VERBOSE=2 \
+	CXXFLAGS="${CXXFLAGS} -fpermissive -D__builtin_types_compatible_p\(x,y\)=1"
Comment 28 Helmut Jarausch 2017-02-21 17:56:42 UTC
With gcc-6.3.0, glibc-2.25 und linux-4.10.0

I use

union { void _u(){}; typeof(x) __val; char __c[1]={0}; } __u={0};

in the (patched) kernel headers

and 
	KBUILD_VERBOSE=2 \
	CXXFLAGS="${CXXFLAGS} -fpermissive -D__builtin_types_compatible_p (x,y\)=1"


In addition, due to
https://github.com/torvalds/linux/commit/dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5

I had to add the sed-command in src_prepare (see below)

src_prepare() {
	# PaX fixes (see bug #298988)
	pushd "${WORKDIR}" &>/dev/null || die
	eapply "${FILESDIR}"/vboxguest-4.1.0-log-use-c99.patch
	epatch "${FILESDIR}"/${P}-glibc-2.24.patch
	sed -i -e'/    .readlink       = generic_readlink,/d' vboxsf/lnkops.c VirtualBox-5.1.14/src/VBox/Additions/linux/sharedfolders/lnkops.c
	popd &>/dev/null || die

With all of these modifications, virtualbox-guest-additions-5.1.14 finally emerged successfully.
Comment 29 Joakim Tjernlund 2017-02-21 19:29:39 UTC
(In reply to Helmut Jarausch from comment #28)
> With gcc-6.3.0, glibc-2.25 und linux-4.10.0
> 
> I use
> 
> union { void _u(){}; typeof(x) __val; char __c[1]={0}; } __u={0};

Very close to my last patch, but the __c[1]={0} differs, why have that
when the whole union __u={0} ?

gcc 4.9.4 gives a warning when assigning _c[1] like above.
Comment 30 Helmut Jarausch 2017-02-23 14:37:13 UTC
(In reply to Joakim Tjernlund from comment #29)
> (In reply to Helmut Jarausch from comment #28)
> > With gcc-6.3.0, glibc-2.25 und linux-4.10.0
> > 
> > I use
> > 
> > union { void _u(){}; typeof(x) __val; char __c[1]={0}; } __u={0};
> 
> Very close to my last patch, but the __c[1]={0} differs, why have that
> when the whole union __u={0} ?
> 
> gcc 4.9.4 gives a warning when assigning _c[1] like above.

That's a copy'n paste error.
union { void _u(){}; typeof(x) __val; char __c[1]; } __u={0};
is fine.
Comment 31 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2017-02-23 14:44:20 UTC
Wow, I'm really impressed you guys found a working solution. 

Unfortunately patching the kernel cannot be added to the virtualbox-guest-additions ebuilds. So we either need to wait till upstream found a sloution, or you guys find a solution that does not involve patching non-virtualbox software.
Comment 32 Joakim Tjernlund 2017-02-23 14:54:20 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #31)
> Wow, I'm really impressed you guys found a working solution. 

Thanks :)

> 
> Unfortunately patching the kernel cannot be added to the
> virtualbox-guest-additions ebuilds. So we either need to wait till upstream
> found a sloution, or you guys find a solution that does not involve patching
> non-virtualbox software.

Kernel folks are so far reluctant to include C++ fixes in private kernel
headers. I think gentoo-sources could carry these until a official fix
is available but not something I am going push forward.

You could add the vbox ebuild part now, it wont hurt anything.

Anyone know what Vbox. people are doing? I haven't found anything.
Comment 33 Loic Rosset 2017-02-25 12:42:40 UTC
Thanks for making thoses patches !
However... I just began to use gentoo, and I have no idea how to apply them, would it be possible for you to explain how to do that ?

Thanks in advance !
Comment 34 Joakim Tjernlund 2017-03-02 17:18:46 UTC
(In reply to Joakim Tjernlund from comment #32)
> (In reply to Lars Wendler (Polynomial-C) from comment #31)
> > Wow, I'm really impressed you guys found a working solution. 
> 
> Thanks :)
> 
> > 
> > Unfortunately patching the kernel cannot be added to the
> > virtualbox-guest-additions ebuilds. So we either need to wait till upstream
> > found a sloution, or you guys find a solution that does not involve patching
> > non-virtualbox software.
> 
> Kernel folks are so far reluctant to include C++ fixes in private kernel
> headers. I think gentoo-sources could carry these until a official fix
> is available but not something I am going push forward.

Looks like akpm has accepted both patches in his tree, lets see if them make it
all the way into the kernel.
Time to fix the ebuild's soon :)

> 
> You could add the vbox ebuild part now, it wont hurt anything.
> 
> Anyone know what Vbox. people are doing? I haven't found anything.
Comment 35 David Gasaway 2017-03-03 01:20:09 UTC
If it's good enough for akpm, surely it's good enough for a gentoo-sources patch, right?  Any chance that could happen?
Comment 36 Joakim Tjernlund 2017-03-09 19:00:05 UTC
Created attachment 466462 [details, diff]
bitops typ fixes
Comment 37 Joakim Tjernlund 2017-03-09 19:02:02 UTC
Created attachment 466464 [details, diff]
void * cast with uintptr_t
Comment 38 Joakim Tjernlund 2017-03-09 19:02:47 UTC
Created attachment 466466 [details, diff]
Mock up a __builtin_types_compatible_p for C++
Comment 39 Joakim Tjernlund 2017-03-09 19:04:22 UTC
With the last 3 patches, all Vbox builds without fixes to the ebuilds.
Unsure if all these fixes are correct though, please comment on them.
Comment 40 Joakim Tjernlund 2017-03-09 20:44:47 UTC
One thing more I have noted, Vbox modules builds against the RUNNING kernels
headers, not the one you have eselected This causes mysterious bugs etc.
This problem has been there for a long time though.
Comment 41 Paolo Pedroni 2017-03-10 12:23:23 UTC
(In reply to Joakim Tjernlund from comment #39)
> With the last 3 patches, all Vbox builds without fixes to the ebuilds.
> Unsure if all these fixes are correct though, please comment on them.

With your patches I get:

fs/ext4/balloc.c: In function ‘ext4_init_block_bitmap’:
fs/ext4/balloc.c:215:21: error: passing argument 2 of ‘__set_bit_le’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   ext4_set_bit(bit, bh->b_data);
                     ^
In file included from ./arch/x86/include/asm/bitops.h:504:0,
                 from ./include/linux/bitops.h:36,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:8,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/linux/time.h:5,
                 from fs/ext4/balloc.c:14:
./include/asm-generic/bitops/le.h:71:60: note: expected ‘long unsigned int *’ but argument is of type ‘char *’
 static inline void __set_bit_le(int nr, unsigned long *addr)
                                                            ^
fs/ext4/balloc.c:225:58: error: passing argument 2 of ‘__set_bit_le’ from incompatible pointer type [-Werror=incompatible-pointer-types]
In file included from ./arch/x86/include/asm/bitops.h:504:0,
                 from ./include/linux/bitops.h:36,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:8,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/linux/time.h:5,
                 from fs/ext4/balloc.c:14:
./include/asm-generic/bitops/le.h:71:60: note: expected ‘long unsigned int *’ but argument is of type ‘char *’
 static inline void __set_bit_le(int nr, unsigned long *addr)
                                                            ^
fs/ext4/balloc.c:229:58: error: passing argument 2 of ‘__set_bit_le’ from incompatible pointer type [-Werror=incompatible-pointer-types]
In file included from ./arch/x86/include/asm/bitops.h:504:0,
                 from ./include/linux/bitops.h:36,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:8,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/linux/time.h:5,
                 from fs/ext4/balloc.c:14:
./include/asm-generic/bitops/le.h:71:60: note: expected ‘long unsigned int *’ but argument is of type ‘char *’
 static inline void __set_bit_le(int nr, unsigned long *addr)
                                                            ^
fs/ext4/balloc.c:235:59: error: passing argument 2 of ‘__set_bit_le’ from incompatible pointer type [-Werror=incompatible-pointer-types]
In file included from ./arch/x86/include/asm/bitops.h:504:0,
                 from ./include/linux/bitops.h:36,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:8,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/linux/time.h:5,
                 from fs/ext4/balloc.c:14:
./include/asm-generic/bitops/le.h:71:60: note: expected ‘long unsigned int *’ but argument is of type ‘char *’
 static inline void __set_bit_le(int nr, unsigned long *addr)
                                                            ^
fs/ext4/balloc.c: In function ‘ext4_valid_block_bitmap’:
fs/ext4/balloc.c:342:56: error: passing argument 2 of ‘test_bit_le’ from incompatible pointer type [-Werror=incompatible-pointer-types]
In file included from ./arch/x86/include/asm/bitops.h:504:0,
                 from ./include/linux/bitops.h:36,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:8,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/linux/time.h:5,
                 from fs/ext4/balloc.c:14:
./include/asm-generic/bitops/le.h:56:59: note: expected ‘const long unsigned int *’ but argument is of type ‘char *’
 static inline int test_bit_le(int nr, const unsigned long *addr)
                                                           ^
fs/ext4/balloc.c:349:56: error: passing argument 2 of ‘test_bit_le’ from incompatible pointer type [-Werror=incompatible-pointer-types]
In file included from ./arch/x86/include/asm/bitops.h:504:0,
                 from ./include/linux/bitops.h:36,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:8,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/linux/time.h:5,
                 from fs/ext4/balloc.c:14:
./include/asm-generic/bitops/le.h:56:59: note: expected ‘const long unsigned int *’ but argument is of type ‘char *’
 static inline int test_bit_le(int nr, const unsigned long *addr)
                                                           ^
fs/ext4/balloc.c:356:40: error: passing argument 1 of ‘find_next_zero_bit_le’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  next_zero_bit = ext4_find_next_zero_bit(bh->b_data,
                                        ^
In file included from ./arch/x86/include/asm/bitops.h:504:0,
                 from ./include/linux/bitops.h:36,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:8,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/linux/time.h:5,
                 from fs/ext4/balloc.c:14:
./include/asm-generic/bitops/le.h:11:69: note: expected ‘const long unsigned int *’ but argument is of type ‘char *’
 static inline unsigned long find_next_zero_bit_le(const unsigned long *addr,
                                                                     ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:292: fs/ext4/balloc.o] Error 1
make[1]: *** [scripts/Makefile.build:543: fs/ext4] Error 2
make: *** [Makefile:988: fs] Error 2
Comment 42 Joakim Tjernlund 2017-03-10 13:22:09 UTC
(In reply to Paolo Pedroni from comment #41)
> (In reply to Joakim Tjernlund from comment #39)
> > With the last 3 patches, all Vbox builds without fixes to the ebuilds.
> > Unsure if all these fixes are correct though, please comment on them.
> 
> With your patches I get:
> 
> fs/ext4/balloc.c: In function ‘ext4_init_block_bitmap’:
> fs/ext4/balloc.c:215:21: error: passing argument 2 of ‘__set_bit_le’ from
> incompatible pointer type [-Werror=incompatible-pointer-types]
>    ext4_set_bit(bit, bh->b_data);
>                      ^
> In file included from ./arch/x86/include/asm/bitops.h:504:0,
>                  from ./include/linux/bitops.h:36,
>                  from ./include/linux/kernel.h:10,
>                  from ./include/linux/list.h:8,
>                  from ./include/linux/preempt.h:10,
>                  from ./include/linux/spinlock.h:50,
>                  from ./include/linux/seqlock.h:35,
>                  from ./include/linux/time.h:5,
>                  from fs/ext4/balloc.c:14:
> ./include/asm-generic/bitops/le.h:71:60: note: expected ‘long unsigned int
> *’ but argument is of type ‘char *’
>  static inline void __set_bit_le(int nr, unsigned long *addr)
>                                                             ^

Yes, now that these functions actually have a type, parst of kernel code will
complain. I guessing these should be fixed to user the proper type but for now you will have to live with these warnings.
Comment 43 Paolo Pedroni 2017-03-10 13:41:50 UTC
(In reply to Joakim Tjernlund from comment #42)
> (In reply to Paolo Pedroni from comment #41)
> > (In reply to Joakim Tjernlund from comment #39)
> > fs/ext4/balloc.c: In function ‘ext4_init_block_bitmap’:
> > fs/ext4/balloc.c:215:21: error: passing argument 2 of ‘__set_bit_le’ from
> > incompatible pointer type [-Werror=incompatible-pointer-types]
> >    ext4_set_bit(bit, bh->b_data);


They are not warnings: it's an error. Kernel compilation is halted.
Comment 44 Joakim Tjernlund 2017-03-10 14:28:45 UTC
(In reply to Paolo Pedroni from comment #43)
> (In reply to Joakim Tjernlund from comment #42)
> > (In reply to Paolo Pedroni from comment #41)
> > > (In reply to Joakim Tjernlund from comment #39)
> > > fs/ext4/balloc.c: In function ‘ext4_init_block_bitmap’:
> > > fs/ext4/balloc.c:215:21: error: passing argument 2 of ‘__set_bit_le’ from
> > > incompatible pointer type [-Werror=incompatible-pointer-types]
> > >    ext4_set_bit(bit, bh->b_data);
> 
> 
> They are not warnings: it's an error. Kernel compilation is halted.

No, they are warnings turned into errors by passing Werror to gcc.
I guess you have a kernel config that does not allow warnings, you can
turn that strictness off.
Comment 45 Stéphane BARBARAY 2017-03-10 15:26:31 UTC
virtualbox-guest-additions-5.1.16 compiled fine with kernel 4.9 and virtualbox-guest-additions-5.1.12 was removed
Comment 46 Paolo Pedroni 2017-03-10 17:18:01 UTC
(In reply to Joakim Tjernlund from comment #44)
> No, they are warnings turned into errors by passing Werror to gcc.
> I guess you have a kernel config that does not allow warnings, you can
> turn that strictness off.

Where? I've checked my kernel configuration and nothing stands out. Do you have any idea?
Comment 47 Randy Tupas 2017-03-12 00:12:42 UTC
(In reply to Stéphane BARBARAY from comment #45)
> virtualbox-guest-additions-5.1.16 compiled fine with kernel 4.9 and
> virtualbox-guest-additions-5.1.12 was removed

Was this after you applied the patches to the kernel?

Thanks
Comment 48 Stéphane BARBARAY 2017-03-12 06:54:13 UTC
(In reply to Randy Tupas from comment #47)
> (In reply to Stéphane BARBARAY from comment #45)
> > virtualbox-guest-additions-5.1.16 compiled fine with kernel 4.9 and
> > virtualbox-guest-additions-5.1.12 was removed
> 
> Was this after you applied the patches to the kernel?
> 
> Thanks

No patches applied
Comment 49 Stéphane BARBARAY 2017-03-12 07:33:59 UTC
(In reply to Stéphane BARBARAY from comment #48)
> (In reply to Randy Tupas from comment #47)
> > (In reply to Stéphane BARBARAY from comment #45)
> > > virtualbox-guest-additions-5.1.16 compiled fine with kernel 4.9 and
> > > virtualbox-guest-additions-5.1.12 was removed
> > 
> > Was this after you applied the patches to the kernel?
> > 
> > Thanks
> 
> No patches applied

...but xf86-video-virtualbox-5.1.16 still does not compile

Btw, as Joakim suggested, it would be really useful to build against the eselected kernel instead of the running one (that's forcing us to boot with a non working guest-additions first before being able to compile)...
Comment 50 Randy Tupas 2017-03-12 22:18:05 UTC
(In reply to Stéphane BARBARAY from comment #49)
> (In reply to Stéphane BARBARAY from comment #48)
> > (In reply to Randy Tupas from comment #47)
> > > (In reply to Stéphane BARBARAY from comment #45)
> > > > virtualbox-guest-additions-5.1.16 compiled fine with kernel 4.9 and
> > > > virtualbox-guest-additions-5.1.12 was removed
> > > 
> > > Was this after you applied the patches to the kernel?
> > > 
> > > Thanks
> > 
> > No patches applied
> 
> ...but xf86-video-virtualbox-5.1.16 still does not compile
> 
> Btw, as Joakim suggested, it would be really useful to build against the
> eselected kernel instead of the running one (that's forcing us to boot with
> a non working guest-additions first before being able to compile)...

Thanks for the info. I can't build either package :-(
Comment 51 Paolo Pedroni 2017-03-14 11:50:02 UTC
(In reply to Stéphane BARBARAY from comment #48)
> > Was this after you applied the patches to the kernel?
> > 
> > Thanks
> 
> No patches applied

I can confirm this...
Comment 52 Paolo Pedroni 2017-03-14 11:52:19 UTC
(In reply to Stéphane BARBARAY from comment #49)
> ...but xf86-video-virtualbox-5.1.16 still does not compile

...and this :((
Comment 53 Joakim Tjernlund 2017-03-16 16:24:55 UTC
(In reply to Stéphane BARBARAY from comment #49)
> (In reply to Stéphane BARBARAY from comment #48)
> > (In reply to Randy Tupas from comment #47)
> > > (In reply to Stéphane BARBARAY from comment #45)
> > > > virtualbox-guest-additions-5.1.16 compiled fine with kernel 4.9 and
> > > > virtualbox-guest-additions-5.1.12 was removed
> > > 
> > > Was this after you applied the patches to the kernel?
> > > 
> > > Thanks
> > 
> > No patches applied
> 
> ...but xf86-video-virtualbox-5.1.16 still does not compile
> 
> Btw, as Joakim suggested, it would be really useful to build against the
> eselected kernel instead of the running one (that's forcing us to boot with
> a non working guest-additions first before being able to compile)...

I noted that xf86-video-virtualbox uses --with-linux="${KV_OUT_DIR}" and I wonder
if KV_OUT_DIR is defined unless "linux-info" is inherited?

Any care to test that theory?
Comment 54 Joakim Tjernlund 2017-03-28 17:10:59 UTC
(In reply to Joakim Tjernlund from comment #53)
> (In reply to Stéphane BARBARAY from comment #49)
> > (In reply to Stéphane BARBARAY from comment #48)
> > > (In reply to Randy Tupas from comment #47)
> > > > (In reply to Stéphane BARBARAY from comment #45)
> > > > > virtualbox-guest-additions-5.1.16 compiled fine with kernel 4.9 and
> > > > > virtualbox-guest-additions-5.1.12 was removed
> > > > 
> > > > Was this after you applied the patches to the kernel?
> > > > 
> > > > Thanks
> > > 
> > > No patches applied
> > 
> > ...but xf86-video-virtualbox-5.1.16 still does not compile
> > 
> > Btw, as Joakim suggested, it would be really useful to build against the
> > eselected kernel instead of the running one (that's forcing us to boot with
> > a non working guest-additions first before being able to compile)...
> 
> I noted that xf86-video-virtualbox uses --with-linux="${KV_OUT_DIR}" and I
> wonder
> if KV_OUT_DIR is defined unless "linux-info" is inherited?
> 
> Any care to test that theory?

Did a quick test and KV_OUT_DIR is undefined. Turns out that you have not
only to inherit linux-info, one must also call linux-info_pkg_setup as
can be seen in linx-info.eclass:

# Before using any of the config-handling functions in this eclass, you must
# ensure that one of the following functions has been called (in order of
# preference), otherwise you will get bugs like #364041):
# linux-info_pkg_setup
# linux-info_get_any_version
# get_version
# get_running_version

I suspect this is a problem in the the other Vbox ebuilds too. To lazy to
wip up a patches though, anyone feel free :)
Comment 55 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-10-26 09:48:02 UTC
Should no longer be an issue.