[vbox-dev] "'RTAssertMsg2Weak' was not declared in this scope" in critsectrw-generic.cpp

Simon South simon at simonsouth.net
Wed Jul 17 13:41:15 GMT 2019


I'm trying to build the Guest Additions for Haiku (x86_64, GCC 8.3.0) 
from the VirtualBox 6.0.8 source tree and am stuck on this error when 
compiling RuntimeGuestR0:

In file included from 
/boot/home/Source/VirtualBox-6.0.8/include/iprt/critsect.h:34,
                  from 
/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime/generic/critsectrw-generic.cpp:33:
/boot/home/Source/VirtualBox-6.0.8/include/iprt/asm.h: In function 'void 
VBoxGuest_ASMAtomicBitSet(volatile void*, int32_t)':
/boot/home/Source/VirtualBox-6.0.8/include/iprt/assert.h:278:48: error: 
'RTAssertMsg2Weak' was not declared in this scope
  # define RTAssertMsg2Weak       if (1) {} else RTAssertMsg2Weak
                                                 ^~~~~~~~~~~~~~~~

I've pasted more of kmk's (r3296) output below. (The error repeats for a 
number of other functions in critsectrw-generic.cpp.)

It seems to me this error is inevitable any time critsectrw-generic.cpp 
is compiled together with VBoxMangling.h, which it would be by default 
for most operating systems (Config.kmk:7316). But a Google search for 
the error message turns up nothing.

My guess is that's because the set of source files for RuntimeGuestR0 is 
overridden for operating systems that would otherwise be affected: 
RuntimeGuestR0 extends RuntimeR0Drv 
(src/VBox/Runtime/Makefile.kmk:3358), for which e.g. 
RuntimeR0Drv_SOURCES.linux is defined (line 2790), omitting 
critsectrw-generic.cpp.

But this is actually true for Haiku as well (RuntimeR0Drv_SOURCES.haiku 
on line 3309). So I don't understand why critsectrw-generic.cpp is being 
compiled in the first place. Shouldn't RuntimeGuestR0_SOURCES.haiku be 
inherited automatically from RuntimeR0Drv_SOURCES.haiku? If not, why 
doesn't the build fail on Linux with the same error?

I've even tried adding this line to src/VBox/Runtime/Makefile.kmk to no 
avail:

   RuntimeGuestR0_Sources.haiku := $(RuntimeR0Drv_SOURCES.haiku)

Can you think of what I'm missing, or why this is happening?

-----

The failing command:
@g++ -c -g -fno-PIC -Wpointer-arith -Wshadow -Wuninitialized 
-Wunused-function -Wunused-label -Wunused-value -Wunused-variable 
-Wformat -O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing 
-fno-common -fno-exceptions -fno-rtti -include 
/boot/home/Source/VirtualBox-6.0.8/include/VBox/VBoxGuestMangling.h -m64 
-mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-reorder-blocks 
-ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time 
-Wno-sign-compare -fno-exceptions -fno-rtti 
-I/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime 
-I/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime/include 
-I/boot/develop/headers/os/kernel -I/boot/develop/headers/os/drivers 
-I/boot/home/Source/VirtualBox-6.0.8/out/haiku.amd64/debug/obj/RuntimeGuestR0/dtrace 
-I/boot/home/Source/VirtualBox-6.0.8/include 
-I/boot/home/Source/VirtualBox-6.0.8/out/haiku.amd64/debug -DVBOX 
-DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_REM 
-DVBOX_WITH_RAW_MODE -DDEBUG -DDEBUG_user -DDEBUG_USERNAME=user 
-DRT_OS_HAIKU -DRT_ARCH_AMD64 -D__AMD64__ -DVBOX_WITH_DEBUGGER 
-DRT_LOCK_STRICT -DRT_LOCK_STRICT_ORDER 
-DRTPATH_APP_PRIVATE=\"/boot/system/apps/VirtualBox\" 
-DRTPATH_APP_PRIVATE_ARCH=\"/boot/system/apps/VirtualBox\" 
-DRTPATH_SHARED_LIBS=\"/boot/system/apps/VirtualBox\" 
-DRTPATH_APP_DOCS=\"/boot/system/apps/VirtualBox\" -D_KERNEL_MODE=1 
-D_STRICT_STDC -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_RT_R0 
-DRT_WITH_VBOX -DRT_WITHOUT_NOCRT_WRAPPERS -DRT_NO_EXPORT_SYMBOL 
-DNOFILEID 
-Wp,-MD,/boot/home/Source/VirtualBox-6.0.8/out/haiku.amd64/debug/obj/RuntimeGuestR0/generic/critsectrw-generic.o.dep 
-Wp,-MT,/boot/home/Source/VirtualBox-6.0.8/out/haiku.amd64/debug/obj/RuntimeGuestR0/generic/critsectrw-generic.o 
-Wp,-MP -o 
/boot/home/Source/VirtualBox-6.0.8/out/haiku.amd64/debug/obj/RuntimeGuestR0/generic/critsectrw-generic.o 
 
/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime/generic/critsectrw-generic.cpp
kBuild: Compiling RuntimeGuestR0 - 
/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime/generic/critsectrw-generic.cpp
In file included from 
/boot/home/Source/VirtualBox-6.0.8/include/iprt/critsect.h:34,
                  from 
/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime/generic/critsectrw-generic.cpp:33:
/boot/home/Source/VirtualBox-6.0.8/include/iprt/assert.h:276: warning: 
"RTAssertMsg1Weak" redefined
  # define RTAssertMsg1Weak(pszExpr, uLine, pszfile, pszFunction) \

In file included from 
/boot/home/Source/VirtualBox-6.0.8/include/VBox/VBoxGuestMangling.h:36,
                  from <command-line>:
/boot/home/Source/VirtualBox-6.0.8/include/iprt/mangling.h:370: note: 
this is the location of the previous definition
  # define RTAssertMsg1Weak 
RT_MANGLER(RTAssertMsg1Weak)

In file included from 
/boot/home/Source/VirtualBox-6.0.8/include/iprt/critsect.h:34,
                  from 
/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime/generic/critsectrw-generic.cpp:33:
/boot/home/Source/VirtualBox-6.0.8/include/iprt/assert.h:278: warning: 
"RTAssertMsg2Weak" redefined
  # define RTAssertMsg2Weak       if (1) {} else RTAssertMsg2Weak

In file included from 
/boot/home/Source/VirtualBox-6.0.8/include/VBox/VBoxGuestMangling.h:36,
                  from <command-line>:
/boot/home/Source/VirtualBox-6.0.8/include/iprt/mangling.h:377: note: 
this is the location of the previous definition
  # define RTAssertMsg2Weak 
RT_MANGLER(RTAssertMsg2Weak)

In file included from 
/boot/home/Source/VirtualBox-6.0.8/include/iprt/critsect.h:34,
                  from 
/boot/home/Source/VirtualBox-6.0.8/src/VBox/Runtime/generic/critsectrw-generic.cpp:33:
/boot/home/Source/VirtualBox-6.0.8/include/iprt/asm.h: In function 'void 
VBoxGuest_ASMAtomicBitSet(volatile void*, int32_t)':
/boot/home/Source/VirtualBox-6.0.8/include/iprt/assert.h:278:48: error: 
'RTAssertMsg2Weak' was not declared in this scope
  # define RTAssertMsg2Weak       if (1) {} else RTAssertMsg2Weak
                                                 ^~~~~~~~~~~~~~~~
/boot/home/Source/VirtualBox-6.0.8/include/iprt/assert.h:586:13: note: 
in expansion of macro 'RTAssertMsg2Weak'
              RTAssertMsg2Weak a; \
              ^~~~~~~~~~~~~~~~
/boot/home/Source/VirtualBox-6.0.8/include/iprt/asm.h:4272:5: note: in 
expansion of macro 'AssertMsg'
      AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit 
aligned", pvBitmap));
      ^~~~~~~~~

-- 
Simon South
simon at simonsouth.net



More information about the vbox-dev mailing list