Bug 183739 - emulators/virtualbox-ose-kmod fails to build on freebsd10/i386
Summary: emulators/virtualbox-ose-kmod fails to build on freebsd10/i386
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Virtualbox Team (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-07 06:30 UTC by Dmitry Afanasiev
Modified: 2014-03-13 17:50 UTC (History)
0 users

See Also:


Attachments
make.out (5.77 KB, text/plain; charset=UTF-8)
2013-11-15 15:36 UTC, Dmitry Afanasiev
no flags Details
patch-include-iprt-x86.h.gz (1.25 KB, application/x-gzip)
2014-03-12 16:12 UTC, Riccardo Torrini
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Afanasiev 2013-11-07 06:30:00 UTC
emulators/virtualbox-ose-kmod fails to build on freebsd10-beta1/i386:
root@meow:/usr/ports/emulators/virtualbox-ose-kmod# make
===>  Building for virtualbox-ose-kmod-4.2.18
cd /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18 && /bin/sh env.sh && cd /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/src/VBox/HostDrivers && VBOX_LIBPATH_X11=/usr/local VBOX_FREEBSD_SRC=/usr/src/sys /usr/local/bin/kmk HostDrivers-scripts vboxdrv-mod VBoxNetFlt-src VBoxNetAdp-src
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: overriding recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxdrv/include/iprt/crc.h'
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: ignoring old recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxdrv/include/iprt/crc.h'
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: overriding recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/dist/bin/src/vboxdrv/include/iprt/crc.h'
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: ignoring old recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/dist/bin/src/vboxdrv/include/iprt/crc.h'
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: overriding recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxdrv/include/iprt/net.h'
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: ignoring old recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxdrv/include/iprt/net.h'
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: overriding recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/dist/bin/src/vboxdrv/include/iprt/net.h'
/usr/local/share/kBuild/footer-pass2-installs.kmk:67: warning: ignoring old recipe for target `/var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/dist/bin/src/vboxdrv/include/iprt/net.h'
kmk: Nothing to be done for `HostDrivers-scripts'.
kBuild: Creating  - /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/obj/vboxdrv-mod/Makefile
kBuild: Installing /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxdrv/Makefile
kBuild: Installing /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxnetflt/Makefile
kBuild: Installing /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxnetadp/Makefile
cd /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src && make SYSDIR=/usr/src/sys
*** Building 'vboxdrv' module ***
Warning: Object directory not changed from original /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxdrv
cc -O2 -pipe -march=k8-sse3 -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VBOX -w -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_X86 -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -Iinclude -I. -Ir0drv -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common   -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-sse -msoft-float -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option   -c SUPDrv.c
In file included from SUPDrv.c:57:
include/iprt/x86.h:862:1: error: "MSR_IA32_PLATFORM_ID" redefined
In file included from ./machine/specialreg.h:6,
                 from ./machine/atomic.h:37,
                 from @/sys/systm.h:41,
                 from @/sys/libkern.h:39,
                 from include/iprt/string.h:67,
                 from SUPDrvInternal.h:43,
                 from SUPDrv.c:32:
./x86/specialreg.h:344:1: error: this is the location of the previous definition
In file included from SUPDrv.c:57:
include/iprt/x86.h:878:1: error: "MSR_IA32_FEATURE_CONTROL" redefined
In file included from ./machine/specialreg.h:6,
                 from ./machine/atomic.h:37,
                 from @/sys/systm.h:41,
                 from @/sys/libkern.h:39,
                 from include/iprt/string.h:67,
                 from SUPDrvInternal.h:43,
                 from SUPDrv.c:32:
./x86/specialreg.h:348:1: error: this is the location of the previous definition
In file included from SUPDrv.c:57:
include/iprt/x86.h:942:1: error: "MSR_IA32_MISC_ENABLE" redefined
In file included from ./machine/specialreg.h:6,
                 from ./machine/atomic.h:37,
                 from @/sys/systm.h:41,
                 from @/sys/libkern.h:39,
                 from include/iprt/string.h:67,
                 from SUPDrvInternal.h:43,
                 from SUPDrv.c:32:
./x86/specialreg.h:377:1: error: this is the location of the previous definition
*** Error code 1

Stop.
make[3]: stopped in /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src/vboxdrv
*** Error code 1

Stop.
make[2]: stopped in /var/ports/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.2.18/out/freebsd.x86/release/bin/src
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/emulators/virtualbox-ose-kmod
*** Error code 1

Stop.
make: stopped in /usr/ports/emulators/virtualbox-ose-kmod

I found another report for this problem:
http://www.mail-archive.com/freebsd-emulation@freebsd.org/msg03191.html

But! This port builds properly on FreeBSD 10.0-BETA1 r256449 on amd64

Fix: 

I think adding to include/iprt/x86.h workarounds like this must solve problem:
#ifndef MSR_IA32_PLATFORM_ID
#define MSR_IA32_PLATFORM_ID                0x17
#endif
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-11-07 06:30:09 UTC
Responsible Changed
From-To: freebsd-ports-bugs->vbox

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Bernhard Froehlich 2013-11-13 15:55:19 UTC
Could you please try to verify that this issue still exists on FreeBSD
10.0-BETA3
because I tried it and it worked fine. It might be that this was
header pollution was
fixed in the base system already.

--=20
Bernhard Fr=F6hlich
http://www.bluelife.at/
Comment 3 Dmitry Afanasiev 2013-11-15 15:36:22 UTC
On 13.11.2013 19:55, Bernhard Fröhlich wrote:
> Could you please try to verify that this issue still exists on FreeBSD
> 10.0-BETA3
> because I tried it and it worked fine. It might be that this was
> header pollution was
> fixed in the base system already.
Did you tried to build port on _i386_ platform?
I updated system to 10.0-BETA3 #0 r258159 and problem still exists.
make output attached.
Also I checked latest available source code for x86/specialreg.h at
http://svnweb.freebsd.org/base/stable/10/sys/x86/include/specialreg.h?view=markup
And, for example, I see MSR_IA32_PLATFORM_ID's declaration at line 350.
I think, root cause of errors is predefining in VirtualBox's 
include/iprt/x86.h of some new defines in x86/specialreg.h.
Comment 4 Bernhard Froehlich 2013-12-16 15:59:32 UTC
I have tried to reproduce that on FreeBSD 10.0-RC1/i386 and It seems to hav=
e
been fixed. Could someone please verify that?

https://redports.org/buildarchive/20131216141726-28728/

--=20
Bernhard Fr=F6hlich
http://www.bluelife.at/
Comment 5 Riccardo Torrini 2014-03-12 16:12:31 UTC
Same problem on 9.2-STABLE of yesterday, unable to build -kmod.
Created a patch inspired on this PR but I'm not able to apply
automatically simply adding to files/, maybe because the port
redirect some variables to ../virtualbox-ose, anyway using the
same patch syntax from CLI (I only removed --quiet):

# make clean extract
# patch -d /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.8 --forward -E -p0 -V simple --suffix .orig < files/patch-include-iprt-x86.h
-----8<-----
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- include/iprt/x86.h.orig    2014-02-25 17:59:50.000000000 +0100
|+++ include/iprt/x86.h 2014-03-12 14:14:44.000000000 +0100
--------------------------
Patching file include/iprt/x86.h using Plan A...
Hunk #1 succeeded at 923.
Hunk #2 succeeded at 1003.
Hunk #3 succeeded at 1051.
done
-----8<-----
# make patch build install

I can complete the port but now I have errors on main -ose :-(
Attached there is a working (for build/install) patch, not sure
if doesn't reboot when loaded, do not try on production machines ;)

# uname -a
FreeBSD tiger.fi.esaote.it 9.2-STABLE FreeBSD 9.2-STABLE #31 r262976: Mon Mar 10 19:29:01 CET 2014     root@tiger.fi.esaote.it:/usr/obj/usr/src/sys/TIGER  i386


-- 
Riccardo.
Comment 6 Riccardo Torrini 2014-03-13 10:29:07 UTC
On Wed, Mar 12, 2014 at 05:12:31PM +0100, Riccardo Torrini wrote:

> Same problem on 9.2-STABLE ... Created a patch ...

A really really better patch than mine is linked from PR 187444
(specific for version 9), now it compile but same panic/reboot...
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/187444
https://svn.redports.org/virtualbox/emulators/virtualbox-ose/files/patch-include-iprt-x86.h


-- 
Riccardo.
Comment 7 dfilter service freebsd_committer freebsd_triage 2014-03-13 17:41:59 UTC
Author: jkim
Date: Thu Mar 13 17:41:51 2014
New Revision: 348107
URL: http://svnweb.freebsd.org/changeset/ports/348107
QAT: https://qat.redports.org/buildarchive/r348107/

Log:
  Work around build problems on recent stable/9.
  
  PR:		ports/183739

Added:
  head/emulators/virtualbox-ose/files/patch-include-iprt-x86.h   (contents, props changed)

Added: head/emulators/virtualbox-ose/files/patch-include-iprt-x86.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/virtualbox-ose/files/patch-include-iprt-x86.h	Thu Mar 13 17:41:51 2014	(r348107)
@@ -0,0 +1,18 @@
+--- include/iprt/x86.h.orig	2014-02-25 11:59:50.000000000 -0500
++++ include/iprt/x86.h	2014-03-11 16:46:08.000000000 -0400
+@@ -35,6 +35,15 @@
+ # pragma D depends_on library vbox-types.d
+ #endif
+ 
++/* Workaround for FreeBSD machine/specialreg.h defining MSRs */
++#ifdef RT_OS_FREEBSD
++# undef MSR_P5_MC_ADDR
++# undef MSR_P5_MC_TYPE
++# undef MSR_IA32_PLATFORM_ID
++# undef MSR_BBL_CR_CTL3
++# undef MSR_IA32_MISC_ENABLE
++#endif
++
+ /* Workaround for Solaris sys/regset.h defining CS, DS */
+ #ifdef RT_OS_SOLARIS
+ # undef CS
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 8 Jung-uk Kim freebsd_committer freebsd_triage 2014-03-13 17:43:33 UTC
State Changed
From-To: open->closed

The fix was committed as r348107.  Thanks!