[CentOS-devel] Status report: packaging VirtualBox Guest Additions

Tue Sep 13 14:03:35 UTC 2016
Laurentiu Pancescu <lpancescu at gmail.com>

Hi there,

I've started to work on packaging the VirtualBox Guest Additions. 
Unfortunately, the upstream build process doesn't work on CentOS Linux 
6.8 and 7.2.

On 7.2 gcc fails on <linux/compiler.h> from the kernel-devel package 
(log attached as vbox-ga-c7.txt).  I think this might be GCC bug #49718, 
fixed in January 2014 in the 4.9 branch. [1]  With RHEL 7.3 in beta, 
would a backport of the fix to Red Hat's gcc-4.8 still be possible in a 
reasonable timeframe?  Should I file a bug report against gcc on the 
CentOS tracker?

On 6.8 the compilation stops with an error later, while trying to build 
vboxvideo (log attached as vbox-ga-c6.txt).  On #vbox-dev I was told 
that this directory requires at least kernel 3.11 to build, and it 
shouldn't even try.  There seems to be no ./configure option for 
excluding vboxvideo from the build process.

Their advice is to install the Guest Additions in a VM using their 
installer on the .iso image they provide.  This should leave all the 
necessary sources and Makefiles for building the kernel modules in 
/usr/src, which I could use for the RPMs instead of the original source 
(the source that their installer creates is able to detect what the 
guest supports, and will only build what's possible).  As far as SRPMs 
go, this might be somewhat unusual... We'd need to do this for every new 
version, and we have to look into how package upgrades and removals 
could work.

Regards,
Laurențiu

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49718
-------------- next part --------------
kBuild: Compiling vboxvideo_drm - /home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c
In file included from /lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h:71,
                 from /home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.h:58,
                 from /home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c:48:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drm_mem_util.h: In function ‘drm_calloc_large’:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drm_mem_util.h:34: error: ‘SIZE_MAX’ undeclared (first use in this function)
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drm_mem_util.h:34: error: (Each undeclared identifier is reported only once
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drm_mem_util.h:34: error: for each function it appears in.)
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drm_mem_util.h: In function ‘drm_malloc_ab’:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drm_mem_util.h:47: error: ‘SIZE_MAX’ undeclared (first use in this function)
In file included from /home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.h:58,
                 from /home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c:48:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h: At top level:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h:319: error: expected specifier-qualifier-list before ‘kuid_t’
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h: In function ‘drm_is_render_client’:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h:888: error: ‘const struct drm_file’ has no member named ‘minor’
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h: In function ‘drm_is_control_client’:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h:893: error: ‘const struct drm_file’ has no member named ‘minor’
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h: In function ‘drm_is_primary_client’:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h:898: error: ‘const struct drm_file’ has no member named ‘minor’
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h: In function ‘drm_can_sleep’:
/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm/drmP.h:1119: error: implicit declaration of function ‘in_dbg_master’ [-Wimplicit-function-declaration]
In file included from /home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c:48:
/home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.h: At top level:
/home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.h:235: error: field ‘gem’ has incomplete type
/home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c: In function ‘vbox_drm_freeze’:
/home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c:97: error: implicit declaration of function ‘console_lock’ [-Wimplicit-function-declaration]
/home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c:99: error: implicit declaration of function ‘console_unlock’ [-Wimplicit-function-declaration]
/home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c: At top level:
/home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c:206: error: ‘drm_fasync’ undeclared here (not in a function)
kmk: *** [/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/vboxvideo_drm/vbox_drv.o] Error 1
The failing command:
@gcc -c -O2 -fno-pie -nostdinc -iwithprefix include -include /lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/linux/kconfig.h -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -Wno-trigraphs -fdiagnostics-show-option -Wstrict-prototypes -Wno-pointer-sign -Wno-sign-compare -fdiagnostics-show-option -fno-stack-protector -O2 -mtune=generic -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -include /home/vagrant/VirtualBox-5.0.26/include/VBox/VBoxGuestMangling.h -fshort-wchar -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time -Wno-sign-compare -I/home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime/include -I/home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime/r0drv/linux -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/asm-i386/mach-default -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/asm-x86/mach-default -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/drm -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/arch/x86/include -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/arch/x86/include/asm/mach-default -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/arch/x86/include/uapi -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/arch/x86/include/generated -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/arch/x86/include/generated/uapi -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/uapi -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include/generated/uapi -I/lib/modules/2.6.32-642.4.2.el6.x86_64/build/include -I/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/vboxvideo_drm/dtrace -I/home/vagrant/VirtualBox-5.0.26/include -I/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release -DVBOX -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 -DMODULE -DIN_RT_R0 -DVBOXGUEST -DVBOX_WITH_HGCM -DKBUILD_MODNAME=KBUILD_STR\(vboxvideo\) -DKBUILD_BASENAME=KBUILD_STR\(vboxvideo\) -DDEBUG_HASH=2 -DDEBUG_HASH2=3 -DRT_NO_EXPORT_SYMBOL -Wp,-MD,/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/vboxvideo_drm/vbox_drv.o.dep -Wp,-MT,/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/vboxvideo_drm/vbox_drv.o -Wp,-MP -o /home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/vboxvideo_drm/vbox_drv.o /home/vagrant/VirtualBox-5.0.26/src/VBox/Additions/linux/drm/vbox_drv.c
-------------- next part --------------
kBuild: Compiling RuntimeGuestR0 - /home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime/common/alloc/alloc.cpp
In file included from /home/vagrant/VirtualBox-5.0.26/include/iprt/types.h:116:0,
                 from /home/vagrant/VirtualBox-5.0.26/include/iprt/mem.h:31,
                 from /home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime/common/alloc/alloc.cpp:34:
/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include/linux/compiler.h:184:29: error: can’t set ‘no_instrument_function’ attribute after definition
 static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
                             ^
/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include/linux/compiler.h:198:29: error: can’t set ‘no_instrument_function’ attribute after definition
 static __always_inline void __write_once_size(volatile void *p, void *res, int size)
                             ^
kmk: *** [/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/alloc.o] Error 1
The failing command:
@g++ -c -O2 -fno-pie -nostdinc -iwithprefix include -include /lib/modules/3.10.0-327.28.3.el7.x86_64/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 /home/vagrant/VirtualBox-5.0.26/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 /home/vagrant/VirtualBox-5.0.26/include/VBox/VBoxGuestMangling.h -I/home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime/r0drv/linux -I/home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime -I/home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime/include -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include/asm-i386/mach-default -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include/asm-x86/mach-default -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include/drm -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/arch/x86/include -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/arch/x86/include/asm/mach-default -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/arch/x86/include/uapi -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/arch/x86/include/generated -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/arch/x86/include/generated/uapi -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include/uapi -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include/generated/uapi -I/lib/modules/3.10.0-327.28.3.el7.x86_64/build/include -I/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/RuntimeGuestR0/dtrace -I/home/vagrant/VirtualBox-5.0.26/include -I/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release -DVBOX -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,/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/alloc.o.dep -Wp,-MT,/home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/alloc.o -Wp,-MP -o /home/vagrant/VirtualBox-5.0.26/out/linux.amd64/release/obj/RuntimeGuestR0/common/alloc/alloc.o /home/vagrant/VirtualBox-5.0.26/src/VBox/Runtime/common/alloc/alloc.cpp