Building VirtualBox OSS with VS 2008?

Discussions related to using the OSE version of VirtualBox.
rsilvergun
Posts: 22
Joined: 15. Mar 2009, 17:05

Building VirtualBox OSS with VS 2008?

Post by rsilvergun »

Hi all,
I have Visual Studio 2008, but not 2003 or 2005. I know building Virtual Box isn't supported with 2008, but will it work (and how much trouble is it to make it work)? Anyone know a guide? I searched around but haven't found anyone who's done it.

Ah well, pity there isn't a readily available OSS windows binary. I've found one, but it's a debug version so I get an ugly black debug box running it :lol:

Thanks all!
lekanteto
Posts: 11
Joined: 5. Feb 2009, 23:28

Re: Building VirtualBox OSS with VS 2008?

Post by lekanteto »

Here is what I did. It's rather ugly but it seems to work.

in Makefile.kmk change

Code: Select all

	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest=>Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC80.CRT/msvcr80.dll=>Microsoft.VC80.CRT/msvcr80.dll \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC80.CRT/msvcp80.dll=>Microsoft.VC80.CRT/msvcp80.dll \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest=>testcase/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC80.CRT/msvcr80.dll=>testcase/Microsoft.VC80.CRT/msvcr80.dll \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC80.CRT/msvcp80.dll=>testcase/Microsoft.VC80.CRT/msvcp80.dll
to

Code: Select all

	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest=>Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC90.CRT/msvcr90.dll=>Microsoft.VC90.CRT/msvcr90.dll \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC90.CRT/msvcp90.dll=>Microsoft.VC90.CRT/msvcp90.dll \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest=>testcase/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC90.CRT/msvcr90.dll=>testcase/Microsoft.VC90.CRT/msvcr90.dll \
	$(PATH_TOOL_VCC80X86)/redist/x86/Microsoft.VC90.CRT/msvcp90.dll=>testcase/Microsoft.VC90.CRT/msvcp90.dll
in Config.kmk

Code: Select all

TEMPLATE_VBOXGC_LDFLAGS             = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Lines -MapInfo:Exports -NoD
to

Code: Select all

TEMPLATE_VBOXGC_LDFLAGS             = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD
in configure.vbs

Code: Select all

"Version 14."
to

Code: Select all

"Version 15."
in src/libs/zlibxxx/zutil.h

Code: Select all

#  if defined(WIN32) || defined(WIN64)
     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
#      define vsnprintf _vsnprintf
#    endif
#  endif
to

Code: Select all

#  if defined(WIN32) || defined(WIN64)
     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
#    if !defined(vsnprintf) && !defined(NO_vsnprintf) && (_MSC_VER < 1500)
#      define vsnprintf _vsnprintf
#    endif
#  endif
And probably something else that I forgot. ;-)
rsilvergun
Posts: 22
Joined: 15. Mar 2009, 17:05

Re: Building VirtualBox OSS with VS 2008?

Post by rsilvergun »

Thanks! That got me much futher. I got this running kmk:

Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Main/webservice/Makefile.kmk:82: VBOX_PATH_GSOAP not found...
Z:/src/VirtualBox-2.1.4_OSE/kBuild/units/qt3.kmk:186: kBuild: Couldn't find the Qt3 headers and libaries...
Z:/src/VirtualBox-2.1.4_OSE/kBuild/footer.kmk:3118: Malformed target-specific variable definition
kmk: Interrupt/Exception caught (code = 0xc0000005, addr = 0x417f14)

I googled the QT error and found I could add this to Config.kmk:

PATH_SDK_QT3=C:/Program Files/qt-win-free-msvc.net2003-3.3.3

and I no longer get the QT errors, but I still get:

Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Main/webservice/Makefile.kmk:82: VBOX_PATH_GSOAP not found...
Z:/src/VirtualBox-2.1.4_OSE/kBuild/footer.kmk:3118: Malformed target-specific variable definition
kmk: Interrupt/Exception caught (code = 0xc0000005, addr = 0x417f14)

I'm running the build from the Visual Studio Command Prompt. Here's my configure.vbs line:

cscript configure.vbs --with-MinGW=z:\src\ --with-libSDL=z:\src\SDL-1.2.13 --with-qt="c:\Program Files\qt-win-free-msvc.net2003-3.3.3" --with-libxml2=z:\src\libxml2-2.6.30.win32\ --with-libxslt=Z:\src\libxslt-1.1.24.win32\

The output was fine:

Shell inheritance test: OK
Source path: OK
Checking for kBuild...
Found kBuild: Z:/src/VirtualBox-2.1.4_OSE/kBuild
Found kBuild binaries: Z:/src/VirtualBox-2.1.4_OSE/kBuild/bin/win.x86
Checking for Visual C++...
Found Visual C++ v8 (or later): C:/PROGRA~1/MICROS~1.0/VC
Checking for Windows Platform SDK (recent)...
Found Windows Platform SDK: C:/PROGRA~1/MICROS~3/Windows/v6.0A
Checking for Windows 2003 DDK, build 3790 or later...
Found Windows 2003 DDK: C:/WINDDK/3790~1.183
Checking for Midl.exe...
Found Midl.exe: C:/PROGRA~1/MICROS~3/Windows/v6.0A/bin/Midl.exe
Checking for Direct X SDK...
Found Direct X SDK: C:/PROGRA~1/MI22C6~1
Checking for MinGW GCC v3.3.x + Binutils + Runtime + W32API...
Found MinGW (GCC v3.3.1): Z:/src
Found W32API: z:\src\
Checking for libSDL...
Found libSDL: Z:/src/SDL-1.2.13
Checking for libxml2...
Found libxml2: Z:/src/libxml2-2.6.30.win32
Checking for libxslt...
Found libxslt: Z:/src/libxslt-1.1.24.win32
Checking for Qt...
Found Qt (v3, QtWin/Free): c:/Program Files/qt-win-free-msvc.net2003-3.3.3

I ran env.bat & kmk & then get the error from kmk. I can't figure out if I did something dumb or if it's because I'm trying to use VS 2008 though.
lekanteto
Posts: 11
Joined: 5. Feb 2009, 23:28

Re: Building VirtualBox OSS with VS 2008?

Post by lekanteto »

rsilvergun wrote:Thanks! That got me much futher. I got this running kmk:

Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Main/webservice/Makefile.kmk:82: VBOX_PATH_GSOAP not found...
You need to install gsoap. The latest version did not work for me (and others, see this post http://vbox.innotek.de/pipermail/vbox-d ... 01116.html)
rsilvergun
Posts: 22
Joined: 15. Mar 2009, 17:05

Re: Building VirtualBox OSS with VS 2008?

Post by rsilvergun »

On ward and Upward!

Thanks for the tip, I got past the gsoap error (I had to hardcode the path to my install in the Make file though). The core dump was caused by SDL. As far as I can tell SDL is only needed for one of the front ends so I'm just leaving it off for now.

I then ran into this:

C:\WINDDK\3790~1.183\inc\ddk\wnet\ntddk.h(230) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed
C:\WINDDK\3790~1.183\inc\ddk\wnet\ntddk.h(227) : see declaration of '_interlockedbittestandset'

But a forum post here: http://forums.virtualbox.org/viewtopic. ... ion#p63681 had the answer.

Right now I'm stuck here:

Z:\src\gsoap-win32-2.7 /bin/wsdl2h.exe -tZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/typemap.dat -nvbox -o Z:/src/VirtualBox-2.1.4_OSE/out/w
in.x86/release/obj/webservice/gsoapH_from_gsoap.h Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/bin/sdk/bindings/webservice/vboxweb.wsdl
process_begin: CreateProcess(NULL, Z:\src\gsoap-win32-2.7 /bin/wsdl2h.exe -tZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/typemap.dat -nvbox -o
Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/gsoapH_from_gsoap.h Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/bin/sdk/bindings/webservice/
vboxweb.wsdl, ...) failed.
Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK /nologo \
/out Z:\\src\\VirtualBox-2.1.4_OSE\\out\\win.x86\\release\\obj\\VBoxCOM \
/cpp_cmd C:\\PROGRA~1\\MICROS~1.0\\VC\\bin\\cl.exe \
/I C:\\PROGRA~1\\MICROS~3\\Windows\\v6.0A\\Include \
/I idl \
Z:\\src\\VirtualBox-2.1.4_OSE\\out\\win.x86\\release\\bin\\sdk\\bindings\\mscom\\idl\\VirtualBox.idl
process_begin: CreateProcess(NULL, Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK /nologo /out Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\VBoxCOM /cpp
_cmd C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe /I C:\PROGRA~1\MICROS~3\Windows\v6.0A\Include /I idl Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\bin\sdk\bindings\
mscom\idl\VirtualBox.idl, ...) failed.
make (e=5): Access is denied.
kmk.exe[2]: *** [Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/gsoapH_from_gsoap.h] Error 5

I've tried setting

PATH_SDK_WINPSDK_BIN := C:/PROGRA~1/MICROS~3/Windows/v6.0A/bin

in Autoconfig.kmk & putting it in my PATH, but still no luck. I've got midl.exe in a couple places ( I have the 2003 platform sdk installed alongside VS 2008). This post http://forums.virtualbox.org/viewtopic.php?f=10&t=14555 has different pathing for the location of the files though (D:/PROGRA~1/MICROS~1/Common7/Tools/Bin, I've got the common7/bin folder but there's no Bin folder in Tools). I'm still trying to figure out if it's just that I'm trying to use the wrong SDK version or what.
lekanteto
Posts: 11
Joined: 5. Feb 2009, 23:28

Re: Building VirtualBox OSS with VS 2008?

Post by lekanteto »

rsilvergun wrote:On ward and Upward!

Right now I'm stuck here:

Z:\src\gsoap-win32-2.7 /bin/wsdl2h.exe -tZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/typemap.dat -nvbox -o Z:/src/VirtualBox-2.1.4_OSE/out/w
in.x86/release/obj/webservice/gsoapH_from_gsoap.h Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/bin/sdk/bindings/webservice/vboxweb.wsdl
process_begin: CreateProcess(NULL, Z:\src\gsoap-win32-2.7 /bin/wsdl2h.exe -tZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/typemap.dat -nvbox -o
Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/gsoapH_from_gsoap.h Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/bin/sdk/bindings/webservice/
vboxweb.wsdl, ...) failed.
Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK /nologo \
/out Z:\\src\\VirtualBox-2.1.4_OSE\\out\\win.x86\\release\\obj\\VBoxCOM \
/cpp_cmd C:\\PROGRA~1\\MICROS~1.0\\VC\\bin\\cl.exe \
/I C:\\PROGRA~1\\MICROS~3\\Windows\\v6.0A\\Include \
/I idl \
Z:\\src\\VirtualBox-2.1.4_OSE\\out\\win.x86\\release\\bin\\sdk\\bindings\\mscom\\idl\\VirtualBox.idl
process_begin: CreateProcess(NULL, Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK /nologo /out Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\VBoxCOM /cpp
_cmd C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe /I C:\PROGRA~1\MICROS~3\Windows\v6.0A\Include /I idl Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\bin\sdk\bindings\
mscom\idl\VirtualBox.idl, ...) failed.
make (e=5): Access is denied.
kmk.exe[2]: *** [Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/webservice/gsoapH_from_gsoap.h] Error 5

I've tried setting

PATH_SDK_WINPSDK_BIN := C:/PROGRA~1/MICROS~3/Windows/v6.0A/bin

in Autoconfig.kmk & putting it in my PATH, but still no luck. I've got midl.exe in a couple places ( I have the 2003 platform sdk installed alongside VS 2008). This post http://forums.virtualbox.org/viewtopic.php?f=10&t=14555 has different pathing for the location of the files though (D:/PROGRA~1/MICROS~1/Common7/Tools/Bin, I've got the common7/bin folder but there's no Bin folder in Tools). I'm still trying to figure out if it's just that I'm trying to use the wrong SDK version or what.
I think for VBox the 2003 PSDK should be used. In my Autoconfig.kmk is a line

Code: Select all

MAIN_IDL = E:/VBox/trunk/tools/win.x86/sdk/2003R2/bin/Midl.exe
. So I assume that midl.exe is used from 2003 PSDK in my configuration
rsilvergun
Posts: 22
Joined: 15. Mar 2009, 17:05

Re: Building VirtualBox OSS with VS 2008?

Post by rsilvergun »

I found the trouble, it was just a path issue in Autoconfig.kmk, I was pointing to the wrong SDK after all. I can't find a workable QT binary though and I'll be darned if I can get QT compiled. I have qt-win-free-msvc.net2003-3.3.3, and configure.vbs recognizes it but then kmk blows up:

Z:\src\VirtualBox-2.1.4_OSE>kmk
Config.kmk:1564: Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/GCCConfig.kmk: No such file or directory
Config.kmk:3809: Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/revision.kmk: No such file or directory
Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Additions/WINNT/Makefile.kmk:40: Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Additions/WINNT/Installer/Makefile.kmk: No such file or directory
Z:/src/VirtualBox-2.1.4_OSE/kBuild/sdks/LIBSDL.kmk:95: kBuild: PATH_SDK_LIBSDL couldn't be determined!
Z:/src/VirtualBox-2.1.4_OSE/kBuild/units/qt3.kmk:186: kBuild: Couldn't find the Qt3 headers and libaries...
Z:/src/VirtualBox-2.1.4_OSE/kBuild/units/qt4.kmk:170: kBuild: Couldn't find the Qt4 headers and libaries...
Z:/src/VirtualBox-2.1.4_OSE/kBuild/footer.kmk:3118: kBuild: Install target 'bin' has a bad source specifier: Files/qt-win-free-msvc.net2003-3.3.3/bin/qt-mt3.dll=>
kmk: *** No rule to make target `Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Additions/WINNT/Installer/Makefile.kmk'. Stop.

Building qt's a pain, so I'm trying to track down a binary package that makes VirtualBox happy.
lekanteto
Posts: 11
Joined: 5. Feb 2009, 23:28

Re: Building VirtualBox OSS with VS 2008?

Post by lekanteto »

rsilvergun wrote: I can't find a workable QT binary though and I'll be darned if I can get QT compiled. I have qt-win-free-msvc.net2003-3.3.3, and configure.vbs recognizes it but then kmk blows up:

Z:\src\VirtualBox-2.1.4_OSE>kmk
Config.kmk:1564: Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/GCCConfig.kmk: No such file or directory
Config.kmk:3809: Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/revision.kmk: No such file or directory
Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Additions/WINNT/Makefile.kmk:40: Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Additions/WINNT/Installer/Makefile.kmk: No such file or directory
Z:/src/VirtualBox-2.1.4_OSE/kBuild/sdks/LIBSDL.kmk:95: kBuild: PATH_SDK_LIBSDL couldn't be determined!
Z:/src/VirtualBox-2.1.4_OSE/kBuild/units/qt3.kmk:186: kBuild: Couldn't find the Qt3 headers and libaries...
Z:/src/VirtualBox-2.1.4_OSE/kBuild/units/qt4.kmk:170: kBuild: Couldn't find the Qt4 headers and libaries...
Z:/src/VirtualBox-2.1.4_OSE/kBuild/footer.kmk:3118: kBuild: Install target 'bin' has a bad source specifier: Files/qt-win-free-msvc.net2003-3.3.3/bin/qt-mt3.dll=>
kmk: *** No rule to make target `Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Additions/WINNT/Installer/Makefile.kmk'. Stop.

Building qt's a pain, so I'm trying to track down a binary package that makes VirtualBox happy.
I built a SVN version of VBox. Only Qt4 was required. Building Qt4 took a long time but worked w/o problems.
You can create an empty file `Z:/src/VirtualBox-2.1.4_OSE/src/VBox/Additions/WINNT/Installer/Makefile.kmk'. The installer is not part of OSE.
I do not think the PATH_SDK_LIBSDL problem is VS2008 specific. My AutoConfig.kmk contains

Code: Select all

PATH_SDK_LIBSDL       := E:/VBox/trunk/tools/win.x86/libsdl/v1.2.13

E:/VBox/trunk/tools/win.x86/libsdl/v1.2.13 contains \include and \lib
rsilvergun
Posts: 22
Joined: 15. Mar 2009, 17:05

Re: Building VirtualBox OSS with VS 2008?

Post by rsilvergun »

I found out a bug in Visual Studio 2008 was holding up my compile. Parenthesis in your PATH statement break the VS2008 command line, and the Directx SDK had parenthesis. I removed them and got qt 4.4.3 to compile. I used some hacks from here:

http://forums.virtualbox.org/viewtopic.php?f=10&t=14202 to get configure.vbs to find qt and got further still.

I'm stuck now on two files:

c:\Program Files\Microsoft Visual Studio 9.0\VC\include\intrin.h
z:\src\VirtualBox-2.1.4_OSE\include\iprt\asm.h

intrin.h causes this error:

Code: Select all

C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1040) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed
        C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1040) : see declaration of '_interlockedbittestandset'
C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1041) : error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed
        C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1041) : see declaration of '_interlockedbittestandreset'
kmk.exe[2]: *** [Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/VBoxCOM/glue/initterm.obj] Error 2
From what I've read the problem is the Microsoft DDK includes the two declairations as well. The solution is to comment out these two lines:

Code: Select all

1040: __MACHINEI(unsigned char _interlockedbittestandset(long volatile *a, long volatile b))
1041: __MACHINEI(unsigned char _interlockedbittestandreset(long volatile *a, long volatile b
But doing so causes this error in asm.h:

Code: Select all

Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(81) : warning C4164: '_interlockedbittestandset' : intrinsic function not declared
Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(82) : warning C4164: '_interlockedbittestandreset' : intrinsic function not declared
Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(5085) : error C3861: '_interlockedbittestandset': identifier not found
Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(5318) : error C3861: '_interlockedbittestandset': identifier not found
Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(5412) : error C3861: '_interlockedbittestandreset': identifier not found
because asm.h is looking for the functions.

I tried adding the lines to asm.h but got

Code: Select all

Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(42) : error C3646: '__MACHINEI' : unknown override specifier
Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(42) : error C2014: preprocessor command must start as first nonwhite space
C:\PROGRA~1\MICROS~1.0\VC\include\setjmp.h(44) : error C2091: function returns function
C:\PROGRA~1\MICROS~1.0\VC\include\setjmp.h(44) : error C2144: syntax error : 'int' should be preceded by ';'
C:\PROGRA~1\MICROS~1.0\VC\include\setjmp.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Z:\src\VirtualBox-2.1.4_OSE\include\iprt/asm.h(6159) : fatal error C1020: unexpected #endif
kmk.exe[2]: *** [Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/VBoxCOM/glue/initterm.obj] Error 2
and I don't know enough C/C++ to sort out why. I now understand why this guy

http://forums.virtualbox.org/viewtopic. ... ion#p63681

was going back and forth from intrin.h and ntddk.h, but I don't know how to sort things our so VirtualBox can find what it needs.
lekanteto
Posts: 11
Joined: 5. Feb 2009, 23:28

Re: Building VirtualBox OSS with VS 2008?

Post by lekanteto »

rsilvergun wrote: I'm stuck now on two files:

c:\Program Files\Microsoft Visual Studio 9.0\VC\include\intrin.h
z:\src\VirtualBox-2.1.4_OSE\include\iprt\asm.h

intrin.h causes this error:

Code: Select all

C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1040) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed
        C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1040) : see declaration of '_interlockedbittestandset'
C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1041) : error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed
        C:\PROGRA~1\MICROS~1.0\VC\include\intrin.h(1041) : see declaration of '_interlockedbittestandreset'
kmk.exe[2]: *** [Z:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/VBoxCOM/glue/initterm.obj] Error 2
From what I've read the problem is the Microsoft DDK includes the two declairations as well.
I "solved" this by removing "volatile" from the declarations in intrin.h
rsilvergun
Posts: 22
Joined: 15. Mar 2009, 17:05

Re: Building VirtualBox OSS with VS 2008?

Post by rsilvergun »

Thank you! I am an idiot. I had tried that, but it didn't seem to work. What I didn't realize is it did work, I just ran into yet another error, a pretty spectacular one at that:

Code: Select all

Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\Runtime\errmsgcomdata.h(170) : error C2065: 'ERROR_FILE_CHECKED_OUT' : undeclared identifier
Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\Runtime\errmsgcomdata.h(171) : error C2065: 'ERROR_CHECKOUT_REQUIRED' : undeclared identifier
Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\Runtime\errmsgcomdata.h(172) : error C2065: 'ERROR_BAD_FILE_TYPE' : undeclared identifier
Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\Runtime\errmsgcomdata.h(173) : error C2065: 'ERROR_FILE_TOO_LARGE' : undeclared identifier
...
...
Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\Runtime\errmsgcomdata.h(300) : error C2065: 'ERROR_QUOTA_LIST_INCONSISTENT' : undeclared identifier
Z:\src\VirtualBox-2.1.4_OSE\out\win.x86\release\obj\Runtime\errmsgcomdata.h(300) : fatal error C1003: error count exceeds 100; stopping compilation
The failing command:

Code: Select all

@ C:/PROGRA~1/MICROS~1.0/VC/bin/cl.exe -c -TP -c -nologo -O2 -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- -O2 -GS- -Oy- -IZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/Runtime -IZ:/src/VirtualBox-2.1.4_OSE/src/VBox/Runtime/include -IZ:/src/VirtualBox-2.1.4_OSE/src/libs/liblzf-1.51 -IC:/PROGRA~1/MI9547~1/Include -IC:/PROGRA~1/MI9547~1/Include -IC:/WINDDK/3790~1.183/inc/ddk -IC:/WINDDK/3790~1.183/inc/ddk/wnet -IC:/WINDDK/3790~1.183/inc/wnet -IC:/WINDDK/3790~1.183/inc/ddk/wdm/wnet -IZ:/src/VirtualBox-2.1.4_OSE/include -IZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release -IC:/PROGRA~1/MICROS~1.0/VC/include -IC:/PROGRA~1/MICROS~1.0/VC/atlmfc/include -DVBOX -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DRT_OS_WINDOWS -D__WIN__ -DRT_ARCH_X86 -D__X86__ -D__WIN32__ -D_X86_ -DIN_RING3 -DHC_ARCH_BITS=32 -DGC_ARCH_BITS=64 -DIN_RT_R3 -DIN_SUP_R3 -DLDR_WITH_NATIVE -DLDR_WITH_ELF32 -DLDR_WITH_PE -DRT_WITH_VBOX -FdZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/RuntimeR3/win/errmsgwin-obj.pdb -FD -FoZ:/src/VirtualBox-2.1.4_OSE/out/win.x86/release/obj/RuntimeR3/win/errmsgwin.obj Z:\\src\\VirtualBox-2.1.4_OSE\\src\\VBox\\Runtime\\win\\errmsgwin.cpp
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Building VirtualBox OSS with VS 2008?

Post by mpack »

Did anyone ever succeed in getting the current VBox OSE to compile under Visual Studio 2008? I'm doing it inside a VBox VM btw, it means I can have a dedicated setup for building VBox, once I get it to work.

Following the recommendations given here I've managed to get pretty far, for example I fixed the "_interlockedbittestandset" problem by finding all occurrences of that function everywhere inside the guest and making sure they are all consistent.

I've hit what sounds like a similar problem with _vsnprintf. Error message is "error C3163: '_vsnprintf': attributes inconsistent with previous declaration", error in "\MSVS9\VC\Include\stdio.h" - this stops the build. Trouble is that if I search for this one I get an awful lot of hits (lots of places I think do define vsnprintf _vsnprintf), so I haven't been able to find the previous conflicting declaration.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Building VirtualBox OSS with VS 2008?

Post by mpack »

mpack wrote:I've hit what sounds like a similar problem with _vsnprintf. Error message is "error C3163: '_vsnprintf': attributes inconsistent with previous declaration", error in "\MSVS9\VC\Include\stdio.h" - this stops the build.
Never mind, I found a workaround: contrary to the advice given above I found it easier - for now - to leave all the package header files untouched (don't comment out any defines of vsnprintf they might have) - instead just comment out the declaration of vsnprintf on line 350 of stdio.h.

I'm on to a new problem now: "Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK", even though I think the platform folder is correct and the "midl.exe" file is right there. I've tried searching the kmk files to find out where this error is generated, but no luck so far. As far as I can tell this used to be in makefile.kmk, but doesn't seem to be there any more, or in any other kmk file I've checked.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Building VirtualBox OSS with VS 2008?

Post by mpack »

mpack wrote:I'm on to a new problem now: "Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK".
Ok, I made some progress on this.

First off I can tell you that XP's file search is a piece of s**t. I told it to search all files in the VBox folder tree for occurrences of "Sorry_Cannot" - and the stupid cute dog found no matches. I tried again with the full string - no matches. I then tried an old 16bit search utility that I wrote myself about twenty years ago and still have tucked away in an old utils folder - it found a quick match in a kmk file in the root folder but crashed when the path lengths got too long. Unfortunately source code for this util was lost a long time ago, so today I rewrote it from scratch as a Windows console app, ran it and success! Three matches found for "Sorry_Cannot".

The first wasn't relevant (it was about Cannot_Find_Mc).

The second was the one that was causing the error, this was in "<root>\src\VBox\HostDrivers\VBoxNetFlt\Makefile.kmk",which contains the lines :-

Code: Select all

VBOXNETFLT_NOTIFY_IDL      ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(firstword $(wildcard \
	$(PATH_SDK_WINPSDK_BIN)/Midl.Exe\
	$(PATH_SDK_WINPSDK)/Bin/Midl.Exe\
	$(PATH_DEVTOOLS)/win.x86/bin/midl.exe\
	) Sorry_Cannot_Find_The_MIDL_Compiler_In_The_PSDK))
Which I commented out and replaced with :-

Code: Select all

VBOXNETFLT_NOTIFY_IDL      ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(VBOX_MAIN_IDL))
Which allows the build to make some progress.

The third occurrence of "Sorry_Cannot" was in "<root>\src\VBox\Main\Makefile.kmk" and also relates to the midl compiler. This wasn't the immediate cause of the error message, but I don't know if the build had gotten to this bit yet - so I may eventually have to make the same change here as well. Btw I don't understand kmk syntax so couldn't see what was wrong with the existing lines.


The build now fails with a whole slew of errors attempting to compile "src\VBox\Main\win\NetIf-win.cpp". I've not had a close look yet, but the error messages seem to indicate that the code is dereferencing fields of a structure pointer - but the compiler is complaining that it isn't a structure pointer.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Building VirtualBox OSS with VS 2008?

Post by mpack »

And that last error is because the platform SDK that ships with VS2008 needs a macro defined - NTDDI_VERSION. Some structures in "iptypes.h" are wrapped in conditional compiles with no default! The macro must be defined.
Post Reply