[vbox-dev] building 2.1.0 on win32 - fixes, and CallNtPowerInformation

Klaus Espenlaub Klaus.Espenlaub at Sun.COM
Thu Jan 29 08:30:05 PST 2009

S. Brandt wrote:
> Klaus Espenlaub wrote:
>> Which SDK do you use exactly? I'm no expert there, but the version field 
>> in the SDK directory we use everywhere is "200504", which looks like 
>> we're using some MSDN version. So maybe that one is a bit less strict 
>> when it comes to linking.
>> Will ask the Windows experts here to investigate.
> Hi!
> My SDK:
> cscript configure.vbs  --with-MinGW=c:\Programme\MingGW5  --with-sdk="C:\Programme\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK" --with-ddk="c:\Programme\WINDDK\3790.1830" --with-libSDL=C:\Programme\MingGW5\SDL --with-qt="C:\Programme\qt\3.3.3"  --with-DXSDK="c:\Programme\Microsoft DirectX SDK 2008-08" --with-libxml2="c:\programme\MingGW5\libxml2" --with-libxslt=c:\programme\MingGW5\libxslt
> PATH_SDK_QT4=C:/Programme/Qt/4.4.3
> PATH_SDK_QT3=C:/Programme/Qt/3.3.3
> libxml2-2.7.2+.win32 (libxml2-2.7.2.win32 had the same problem)
> libxslt-1.1.24.win32
> SDL-1.2.13-win32 + SDL-devel-1.2.13-VC6
> iconv-1.9.2.win32
> MinGW5 is currently MinGW 5.1.4 "current", with gcc-core-3.3.3-20040217-1.tar.gz and gcc-g++-3.3.3-20040217-1.tar.gz unpacked over it b/c the configure-script wants 3.3.x, though 3.4.x seems to work as well.
> I'm quite sure the PUEL version does not use the configure.vbs script ... b/c that one does neither work correctly, nor does it provide all information.  See my first post about the various problems ... I also attached a "new" version of the configure.vbs diff which includes some more stuff, e.g., the libxml2/xslt_a.lib fix. Though, in reality, you probably want the dll version of the two, yet the _STATIC flag is defined ...

That is certainly true. We use the env.cmd/env.sh script in the tools
directory. Last time we verified that OSE builds on windows has been a
"few days" ago (pretty clearly in the 1.6.x days, as can be seen from 
the xml2/qt4 issues). Lack of time mixed with the fact that we don't 
depend on it...

Just let us know if any issues persist. We do want to get those issues 

> One of the other problems is surely related to the PUEL/OSE differences (missing  VBox\Additions\WINNT\Installer\Makefile.kmk), and the iconv and the _a problem may be version related (MinGW or libxml2/libxslt).
> CallNtPowerInformation may be PSDK version related.
> Everything else looks like ... configure.vbs not working correctly
> - "typos"
>   if LogFindFile(strPathXml2, "lib/libxml2.lib") then 'that one does not even run
>   str = LogFindFile(strPathXslt, "lib/libxslt.dll")
> - QT3 not passed correctly to AutoConfig.kmk
> - QT4 not checked at all nor passed to AutoConfig.kmk

Do you have a patch which addresses those issues you might want to 
contribute? Might save time for both of us. See 

For small changes like this using the MIT license option is probably 

> BTW - the crash of the QT4 version on my machine was related to old versions of QtCore4/QtGUI4.dll in the path.
>>> For fixing CallNtPowerInformation:
>>> 2. the missing function is
>>> ?CallNtPowerInformation@@YGJW4POWER_INFORMATION_LEVEL@@PAXK1K at Z (C++ name
>>> mangled!), while the method provided by the dll/lib is
>>> [_imp]_CallNtPowerInformation at 20.
>>> So, obviously, there is an 'extern "C"' missing in HostPowerWin.cpp
>>> src\VBox\Main\HostPowerWin.cpp:
>>> extern "C" {
>>> #include <PowrProf.h>
>>> }

Double-checked this, and indeed MS forgot about this in some versions of 
this header file. Will make sure that the workaround is there, so that 
this is fixed for good, regardless which SDK versions people use. Will 
show up soon in the public svn repository.

> I've got no idea where this problem acomes from - win32api usually does not need such a construct ... maybe MS did some mistake there? 
> The full error message is attached at the first post in this thread, and here again.
> Short version:
> Build: Linking VBoxSVC
> kBuild: Compiling tstVMStructSize -
> C:/home/Projekte/VirtualBox/VirtualBox-2.1.0/src/VBox/VMM/testcase/tstVMStructSize.cpp
> tstVMStructSize.cpp
> HostPowerWin.obj : error LNK2019: Nicht aufgelöstes externes Symbol '"long
> __stdcall CallNtPowerInformation(enum POWER_INFORMATION_LEVEL,void
> *,unsigned long,void *,unsigned long)"
> (?CallNtPowerInformation@@YGJW4POWER_INFORMATION_LEVEL@@PAXK1K at Z)',
> verwiesen in Funktion '"private: static long __stdcall
> HostPowerServiceWin::WndProc(struct HWND__ *,unsigned int,unsigned
> int,long)" (?WndProc at HostPowerServiceWin@@CGJPAUHWND__@@IIJ at Z)'
> C:/home/Projekte/VirtualBox/VirtualBox-2.1.0/out/win.x86/release/obj/VBoxSVC/VBoxSVC.exe
> : fatal error LNK1120: 1 unaufgelöste externe Verweise
> kmk[2]: ***
> [C:/home/Projekte/VirtualBox/VirtualBox-2.1.0/out/win.x86/release/obj/VBoxSVC/VBoxSVC.exe]
> Error 1120
> The failing command:
> @ C:/PROGRA~2/MICROS~1.NET/Vc7/bin/link.exe -nologo
> /DISALLOWLIB:libc.lib /DISALLOWLIB:libcd.lib /DISALLOWLIB:msvcrt.lib
> /DISALLOWLIB:msvcrtd.lib /DISALLOWLIB:libcmtd.lib /DISALLOWLIB:libcmt.lib
> psapi.lib powrprof.lib
> /OUT:C:/home/Projekte/VirtualBox/VirtualBox-2.1.0/out/win.x86/release/obj/VBoxSVC/VBoxSVC.exe
> /MAP:C:/home/Projekte/VirtualBox/VirtualBox-2.1.0/out/win.x86/release/obj/VBoxSVC/VBoxSVC.map
> /LIBPATH:C:/Programme/WINDDK/3790.1830/lib/wnet/i386
> [remainder see attachment}]
> Hope this helps,

It surely did. One bug down, 100 to go ;)

We really appreciate feedback from people whose system is completely 
"untainted" - we have things set up in a standardized way, which might 
be far away from what people would normally use.


More information about the vbox-dev mailing list