Page 1 of 1

Problems Compiling guest additions

Posted: 2. Mar 2017, 13:39
by Goeran
Hello there,

I lately updated the kernel in a gentoo-linux vm from 3.10 to 4.9 since then guest-additions fail to compile. I checked any information I did find for possible settings in kernel config that might break but everything seems fine.
System is gentoo kernel 4.9.13, gcc-4.9.4, guest-addtions-5.1.14.
The first error that occurs is:

Code: Select all

x86_64-pc-linux-gnu-g++ -c -O2 -fno-pie -nostdinc -iwithprefix include -include /usr/src/linux-4.9.13-gentoo/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.14/work/VirtualBox-5.1.14/include/VBox/VBoxGuestMangling.h -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-reorder-blocks -fno-asynchronous-unwind-ables -funit-at-a-time -Wno-sign-compare -fno-exceptions -fno-rtti -include /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/include/VBox/VBoxGuestMangling.h -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/src/VBox/Runtime/r0drv/linux -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/src/VBox/Runtime -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/src/VBox/Runtime/include -I/usr/src/linux/include -I/usr/src/linux/include2 -I/usr/src/linux-4.9.13-gentoo/include -I/usr/src/linux-4.9.13-gentoo/include/asm-i386/mach-default -I/usr/src/linux-4.9.13-gentoo/include/asm-x86/mach-default -I/usr/src/linux-4.9.13-gentoo/include/drm -I/usr/src/linux-4.9.13-gentoo/arch/x86/include -I/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/mach-default -I/usr/src/linux-4.9.13-gentoo/arch/x86/include/uapi -I/usr/src/linux/arch/x86/include/generated -I/usr/src/linux/arch/x86/include/generated/uapi -I/usr/src/linux-4.9.13-gentoo/include/uapi -I/usr/src/linux/include/generated/uapi -I/usr/src/linux-4.9.13-gentoo/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/out/linux.amd64/release/obj/RuntimeGuestR0/dtrace -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/include -I/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/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.14/work/VirtualBox-5.1.14/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/heapsimple.o.dep -Wp,-MT,/var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/heapsimple.o -Wp,-MP -o /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/heapsimple.o /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/src/VBox/Runtime/common/alloc/heapsimple.cpp
In file included from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/include/iprt/types.h:140:0,
                 from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/include/iprt/mem.h:31,
                 from /var/tmp/portage/app-emulation/virtualbox-guest-additions-5.1.14/work/VirtualBox-5.1.14/src/VBox/Runtime/common/alloc/alloc.cpp:34:
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic.h: In function 'int atomic_read(const atomic_t*)':
/usr/src/linux-4.9.13-gentoo/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;   \
                                          ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic.h:26:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:305:20: note: 'const int atomic_read(const atomic_t*)::<anonymous union>::__val' should be initialized
  union { typeof(x) __val; char __c[1]; } __u;   \
                    ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic.h:26:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic64_64.h: In function 'long int atomic64_read(const atomic64_t*)':
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:305:42: error: uninitialized const member in 'union atomic64_read(const atomic64_t*)::<anonymous>'
  union { typeof(x) __val; char __c[1]; } __u;   \
                                          ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:305:20: note: 'const long int atomic64_read(const atomic64_t*)::<anonymous union>::__val' should be initialized
  union { typeof(x) __val; char __c[1]; } __u;   \
                    ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
I attached the complete build.log and the kernel-config

I hope some else had this problem and found a solution.

Re: Problems Compiling guest additions

Posted: 2. Mar 2017, 15:07
by Perryg
You are using the portage ( gentoo fork ) version of the guest additions and will need to ask their maintainer what can be done. Gentoo uses specific patches and edits to get the additions to work in their OS and we do not know what they are.

Re: Problems Compiling guest additions

Posted: 2. Mar 2017, 19:19
by Goeran
Ok, I extracted sources manually didn't apply any patch or made any changes to the sources.
Used the same configure options as portage and same kmk options ... error remains.

Code: Select all

./configure --nofatal --disable-xpcom --disable-sdl-ttf --disable-pulse --disable-alsa --build-headless
...
kmk -j2 VBOX_ONLY_ADDITIONS=1
...

kBuild: Compiling RuntimeGuestR0 - /root/VirtualBox-5.1.14/src/VBox/Runtime/common/alloc/heapsimple.cpp
In file included from /root/VirtualBox-5.1.14/include/iprt/types.h:140:0,
                 from /root/VirtualBox-5.1.14/include/iprt/mem.h:31,
                 from /root/VirtualBox-5.1.14/src/VBox/Runtime/common/alloc/alloc.cpp:34:
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic.h: In function 'int atomic_read(const atomic_t*)':
/usr/src/linux-4.9.13-gentoo/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;   \
                                          ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic.h:26:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:305:20: note: 'const int atomic_read(const atomic_t*)::<anonymous union>::__val' should be initialized
  union { typeof(x) __val; char __c[1]; } __u;   \
                    ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic.h:26:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic64_64.h: In function 'long int atomic64_read(const atomic64_t*)':
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:305:42: error: uninitialized const member in 'union atomic64_read(const atomic64_t*)::<anonymous>'
  union { typeof(x) __val; char __c[1]; } __u;   \
                                          ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:305:20: note: 'const long int atomic64_read(const atomic64_t*)::<anonymous union>::__val' should be initialized
  union { typeof(x) __val; char __c[1]; } __u;   \
                    ^
/usr/src/linux-4.9.13-gentoo/include/linux/compiler.h:312:22: note: in expansion of macro '__READ_ONCE'
 #define READ_ONCE(x) __READ_ONCE(x, 1)
                      ^
/usr/src/linux-4.9.13-gentoo/arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
If I remove --nofatal from configure configure doesn't run through. I got a pure 64bit system no multilib, no 32bit support in kernel ... could this be an issue ... but I had this before too ...

Re: Problems Compiling guest additions

Posted: 2. Mar 2017, 19:27
by Perryg
Exactly where did you get the source?
And it may be the kernel and probably why gentoo requires patches. Not sure you can make this work without them. Why are you reluctant to ask them?

Re: Problems Compiling guest additions

Posted: 3. Mar 2017, 08:25
by Goeran
Sources are downloaded from virtualbox.org. http://download.virtualbox.org/virtualb ... 14.tar.bz2
Kernel patches are applied they might be an issue but I found this bug report https://bugs.gentoo.org/show_bug.cgi?id=603472.
When you assume gentoo-kernel might be the cause. Are you sure that compiling Virtualbox 5.1.14 against a vanilla-4.9 64bit kernel works ?