Bug 187444 - emulators/virtualbox-ose-kmod does not build (multiple definition of some macros)
Summary: emulators/virtualbox-ose-kmod does not build (multiple definition of some mac...
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: 2014-03-11 13:30 UTC by Arrigo Marchiori
Modified: 2014-03-13 17:47 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arrigo Marchiori 2014-03-11 13:30:00 UTC
The port does not build. Last lines of output:

*** Building 'vboxdrv' module ***
Warning: Object directory not changed from original /usr/ports/emulators/virtual
box-ose-kmod/work/VirtualBox-4.3.8/out/freebsd.x86/release/bin/src/vboxdrv
cc -O2 -fno-strict-aliasing -pipe -march=athlon-mp -DRT_OS_FREEBSD -DIN_RING0 -D
IN_RT_R0 -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VBOX -w -DVBO
X_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_X86 -Werror -D_KERNEL -DKL
D_MODULE -nostdinc  -Iinclude -I. -Ir0drv -I. -I@ -I@/contrib/altq -finline-limi
t=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-co
mmon   -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-sse -m
soft-float -ffreestanding -fstack-protector -std=iso9899:1999  -fstack-protector
 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototy
pes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-ext
ensions  -Wmissing-include-dirs -fdiagnostics-show-option   -c SUPDrv.c
In file included from SUPDrv.c:57:
include/iprt/x86.h:927:1: error: "MSR_P5_MC_ADDR" redefined
In file included 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:
./machine/specialreg.h:274:1: error: this is the location of the previous defini
tion
In file included from SUPDrv.c:57:
include/iprt/x86.h:929:1: error: "MSR_P5_MC_TYPE" redefined
In file included 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:
./machine/specialreg.h:275:1: error: this is the location of the previous defini
tion
In file included from SUPDrv.c:57:
include/iprt/x86.h:936:1: error: "MSR_IA32_PLATFORM_ID" redefined
In file included 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:
./machine/specialreg.h:280:1: error: this is the location of the previous definition
In file included from SUPDrv.c:57:
include/iprt/x86.h:996:1: error: "MSR_BBL_CR_CTL3" redefined
In file included 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:
./machine/specialreg.h:300:1: error: this is the location of the previous definition
In file included from SUPDrv.c:57:
include/iprt/x86.h:1037:1: error: "MSR_IA32_MISC_ENABLE" redefined
In file included 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:
./machine/specialreg.h:312:1: error: this is the location of the previous definition
*** [SUPDrv.o] Error code 1

Stop in /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.8/out/freebsd.x86/release/bin/src/vboxdrv.
*** [all] Error code 1

Stop in /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.8/out/freebsd.x86/release/bin/src.
*** [do-build] Error code 1

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

Stop in /usr/ports/emulators/virtualbox-ose-kmod.

How-To-Repeat: cd /usr/ports/emulators/virtualbox-ose-kmod && make install
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-03-11 13:30:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->vbox

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Arrigo Marchiori 2014-03-11 13:36:29 UTC
Hello,

I forgot to add the content of two more files:


# cat /var/db/ports/emulators_virtualbox-ose-kmod/options
# This file is auto-generated by 'make config'.
# Options for virtualbox-ose-kmod-4.3.8
_OPTIONS_READ=virtualbox-ose-kmod-4.3.8
_FILE_COMPLETE_OPTIONS_LIST=DEBUG VIMAGE
OPTIONS_FILE_UNSET+=DEBUG
OPTIONS_FILE_SET+=VIMAGE


# cat /etc/make.conf
CPUTYPE?=athlon64
CFLAGS= -O2 -fno-strict-aliasing -pipe
COPTFLAGS= -O -pipe
BOOTWAIT=2000
SVN_UPDATE=yes
DOC_LANG=       en_US.ISO8859-1
LOCALIZED_LANG=it
WITH_WIDE_CHARS=yes
QT4_OPTIONS= CUPS
WITH_NEW_XORG=yes
WITH_GALLIUM=yes
PORTS_MODULES=emulators/virtualbox-ose-kmod sysutils/fusefs-ntfs
-- 
rigo

http://rigo.altervista.org
Comment 3 Bernhard Froehlich 2014-03-11 19:13:02 UTC
I remember a similar bugreport for 10.0-BETA1 on i386 but apparently the
bug in the kernel headers that caused that pollution got fixed before
10.0-RELEASE. But since you are running a recent 9.2-stable it seems
someone has merged that stuff to 9 now and reintroduced the bug again.

I still think this is a FreeBSD bug in the kernel headers that pollute the
modules with MSR defines because it only happens on i386. Yes, a proper fix
would also be to add #ifndefs to the vbox defines.
Comment 4 Jung-uk Kim freebsd_committer freebsd_triage 2014-03-11 20:56:46 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Please download the following patch and try again.

https://svn.redports.org/virtualbox/emulators/virtualbox-ose/files/patch-include-iprt-x86.h

Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQEcBAEBAgAGBQJTH3iOAAoJEHyflib82/FGqKgIAKE0r7bbRtXvVn1h9p67XDB1
dQd0/NNA0v/Uci0YmvncpbyYtYTKzFOM7jqUapsoyLkUH4XYkyVRq+BmdqiI274A
UDfXyjHtlF1mEoOe1zFfVgaW+bWWAv9svsc5hE5khE7cZVMO+1kUMf0iAIna3tox
VWhf9KTYVliDK8qroMcmdi2DxMybpTfZ6AnaXXngulU/tFqGmmdIL4sfOwFQBi0Z
u9FvWuatay7SNWJ/Lc6RXbR77wFs/wns7+l338HTUcQy+FS3e48eoZaA6pJDi2Or
XE40Ow8ZdMgY7fAplCeRI0Skq1q1XFmXEu2RXhI9Iahva7qy4E8J0mK+g2/t73A=
=8jvm
-----END PGP SIGNATURE-----
Comment 5 Jung-uk Kim freebsd_committer freebsd_triage 2014-03-11 20:59:25 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2014-03-11 16:56:46 -0400, Jung-uk Kim wrote:
> Please download the following patch and try again.
> 
> https://svn.redports.org/virtualbox/emulators/virtualbox-ose/files/patch-include-iprt-x86.h

BTW,
> 
this patch must be placed under emulators/virtualbox-ose/files
directory, not emulators/virtualbox-ose-kmod/files directory.

Just in case...

Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQEcBAEBAgAGBQJTH3ktAAoJEHyflib82/FGbl0H/3Dqkz7Y5srl7nU5U49BlDwX
recYbV2Agz3CSII3AY3MKrZZlfca8tH4NNowROs2s9+AA8ZONak6yU14zpVA8xg1
jlAAO7KUq+5R1yk0nd+Y+/YMLaSsxMysKOz2YwuLbdlQBYkL7sX980Ws9G0HY8gL
yDVvnbPPmG07di8JE7osJN5Wt/O6psNulJYo/ZfdjbKZv6gUpqsO/yvKN0i0X8rF
gPE7S4AyOtnxz9DxrShem6TibXU8YiBoVaX0JDX7y/f64KhXP5d16SirKenxVo5g
ncDJDfJHtXjSNvbGbufScZZ41CN7sclFUZeXmg0f2KfKbvMNMORRtT+EOC54IFM=
=Amzw
-----END PGP SIGNATURE-----
Comment 6 Arrigo Marchiori 2014-03-12 08:29:07 UTC
Hello Jung-uk,

On Tue, Mar 11, 2014 at 04:59:25PM -0400, Jung-uk Kim wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 2014-03-11 16:56:46 -0400, Jung-uk Kim wrote:
> > Please download the following patch and try again.
> > 
> > https://svn.redports.org/virtualbox/emulators/virtualbox-ose/files/patch-include-iprt-x86.h

Thank you for the patch!

> BTW,
> this patch must be placed under emulators/virtualbox-ose/files
> directory, not emulators/virtualbox-ose-kmod/files directory.
> 
> Just in case...

Thank you for specifying this... :-) emulators/virtualbox-ose and
emulators/virtualbox-ose-kmod build successfully after adding it.

Now I have another problem: panic when I try to start a virtual
machine!

Shall I open another PR for this? Please see below.



# kgdb kernel.debug /var/crash/vmcore.0 
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...

Unread portion of the kernel message buffer:
panic: vm_page_insert: page already inserted
cpuid = 3
KDB: stack backtrace:
#0 0xc0adb9cf at kdb_backtrace+0x4f
#1 0xc0aa1dbf at panic+0x16f
#2 0xc0d38bea at vm_page_insert+0x2a
#3 0xc1668bf8 at rtR0MemObjFreeBSDContigPhysAllocHelper+0xe8
#4 0xc1668ccd at rtR0MemObjFreeBSDPhysAllocHelper+0x7d
#5 0xc166904a at rtR0MemObjFreeBSDAllocHelper+0xca
#6 0xc1669201 at rtR0MemObjNativeAllocLow+0x61
#7 0xcb68360d at _end+0x31431f5
#8 0xcb6839c4 at _end+0x31435ac
#9 0xcb69be3c at _end+0x315ba24
#10 0xcb69c3a7 at _end+0x315bf8f
#11 0xc1650eb4 at supdrvIOCtl+0x22e4
#12 0xc16565fe at VBoxDrvFreeBSDIOCtl+0x1fe
#13 0xc0978e0a at devfs_ioctl_f+0x10a
#14 0xc0aee5c0 at kern_ioctl+0x2a0
#15 0xc0aee71f at sys_ioctl+0x12f
#16 0xc0f66c03 at syscall+0x443
#17 0xc0f50691 at Xint0x80_syscall+0x21
Uptime: 13m10s
Physical memory: 3051 MB
Dumping 244 MB: 229 213 197 181 165 149 133 117 101 85 69 53 37 21 5

Reading symbols from /boot/modules/vboxdrv.ko...done.
Loaded symbols for /boot/modules/vboxdrv.ko
Reading symbols from /boot/kernel/fdescfs.ko...Reading symbols from
/boot/kernel
/fdescfs.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/fdescfs.ko
Reading symbols from /boot/modules/vboxnetflt.ko...done.
Loaded symbols for /boot/modules/vboxnetflt.ko
Reading symbols from /boot/kernel/netgraph.ko...Reading symbols from
/boot/kerne
l/netgraph.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/netgraph.ko
Reading symbols from /boot/kernel/ng_ether.ko...Reading symbols from
/boot/kerne
l/ng_ether.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ng_ether.ko
Reading symbols from /boot/modules/vboxnetadp.ko...done.
Loaded symbols for /boot/modules/vboxnetadp.ko
Reading symbols from /boot/kernel/linux.ko...Reading symbols from
/boot/kernel/l
inux.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/linux.ko
Reading symbols from /usr/local/modules/fuse.ko...done.
Loaded symbols for /usr/local/modules/fuse.ko
Reading symbols from /boot/kernel/radeon.ko...Reading symbols from
/boot/kernel/
radeon.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/radeon.ko
Reading symbols from /boot/kernel/drm.ko...Reading symbols from
/boot/kernel/drm
.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/drm.ko
#0  doadump (textdump=1) at pcpu.h:249
249             __asm("movl %%fs:%1,%0" : "=r" (td)
(kgdb) bt
#0  doadump (textdump=1) at pcpu.h:249
#1  0xc0aa1b0e in kern_reboot (howto=260)
    at /usr/src/sys/kern/kern_shutdown.c:454
#2  0xc0aa1e05 in panic (fmt=<value optimized out>)
    at /usr/src/sys/kern/kern_shutdown.c:642
#3  0xc0d38bea in vm_page_insert (m=0xc3614688, object=0xcb67ccb8, pindex=Unhandled dwarf expression opcode 0x93
)
    at /usr/src/sys/vm/vm_page.c:915
#4  0xc1668bf8 in rtR0MemObjFreeBSDContigPhysAllocHelper ()
   from /boot/modules/vboxdrv.ko
#5  0xc1668ccd in rtR0MemObjFreeBSDPhysAllocHelper ()
   from /boot/modules/vboxdrv.ko
#6  0xc166904a in rtR0MemObjFreeBSDAllocHelper () from
/boot/modules/vboxdrv.ko
#7  0xc1669201 in rtR0MemObjNativeAllocLow () from
/boot/modules/vboxdrv.ko
#8  0xcb68360d in ?? ()
#9  0xc7bbd424 in ?? ()
#10 0x00020000 in ?? ()
#11 0x00000000 in ?? ()

-- 
rigo

http://rigo.altervista.org
Comment 7 Jung-uk Kim freebsd_committer freebsd_triage 2014-03-13 17:45:07 UTC
State Changed
From-To: open->closed

The build problem should be fixed in r348107. 
Please file a separate PR for the panic.  Thanks!