How to build XVM VirtualBox in Windows
- Windows XP or Windows Server 2003.
- Visual Studio .NET 2003 or Visual Studio 2005 with service pack 1.
- Windows Platform SDK coming with Visual C++ or a more recent one from:
Please note, that the Windows Platform SDK 2008 is not officially supported yet!
- Windows Driver Development Kit (Win2k3 SP1 or later, but not the new Vista WDK):
- DirectX SDK:
GCC 3.3.1: http://prdownloads.sf.net/mingw/gcc-core-3.3.1-20030804-1.tar.gz?download
Note that neither GCC v3.4.2 nor v3.4.5 is currently able to build a working recompiler. So, make sure you are using the 3.3.x versions!
- SDL v1.2.7 or later development package (VC6):
- (VirtualBox < 1.6) Xerces and Xalan XML libraries. In case you don’t feel like building these monsters, grab the binaries from:
- (VirtualBox >= 1.6) libxml2 and libxslt1 libraries. Sources and 32bit binaries can be downloaded from:
- zlib library. Grab the sources from:
- Change to the root directory and execute our configure script to setup your build environment:
If The script finds all the tools necessary, it will output two files: LocalConfig.kmk containing information where to find the tools on your system and env.bat, a batch file to setup your environment for building VirtualBox. You only have to execute this step once, unless something about your tools changes in which case you have to repeat the above step. Keep in mind that the script always overwrites the two generated files so you should not manually edit them.
- Change to the root directory of the sources and enter our build shell environment: env.bat.
- To build a release package, type kmk. This produces the binaries in out\win.x86\release\bin. If you want to build a debug version, enterkmk BUILD_TYPE=debug. In case you have more than one CPU core, you could take advantage of our parallel build system by supplying -j3 (number of cores + 1) as an option to kmk.
Using Other Windows Versions
Building VirtualBox on Windows 2000 should work fine except for one or two missing runtime DLLs that are required by tools or libraries in the VirtualBox build. It is very likely that these DLLs are already installed on your computer by some other program, so you might not even notice.
Building VirtualBox on Windows Vista works fine with one exception, kBuild is making use of Almquist’s ash shell which is built using cygwin. As of writing in order to get cygwin to work properly on Windows Vista, you will need to use a cygwin1.dll dated 2006-11-02 or later. Seehttp://cygwin.com/ml/cygwin/2006-11/msg00059.html for details and http://cygwin.com/snapshots/ for the dll. Download the dll, unpack it, and copy it to kBuild/bin/x86.win/cygwin1.dll.
(You are free to try building VirtualBox on NT4 (or earlier) and Windows 95/98/ME, just don’t expect it to succeed nor to run.)
Using Visual C++ 2005 Express Edition
If you don’t have a Visual C++ edition but still wish to build VirtualBox, it is also possible to use the Visual C++ 2005 Express Edition. However, you will not be able to build everything. In fact the only front end that can be built with this toolset is VBoxBFE becase the VirtualBox COM API – which all the other front ends program against – requires the Active Template Library (ATL) to build, and unfortunately the express edition doesn’t include this (see http://msdn.microsoft.com/vstudio/express/support/faq/#vcpp).
When doing the first build step, you have to add –with-VC-Express-Edition to the argument list:
cscript configure.vbs --with-VC-Express-Edition
The Qt VirtualBox frontend (called VirtualBox.exe) is based on the Qt toolkit version 3.3.x. The Trolltech GPL version of Qt/Windows is based on Qt 4.x and to our knowledge it (officially) only supports the MinGW compiler. When compiling the Qt frontend using MinGW one has to overcome two road blocks:
- The code depends on ATL (again).
- The C++ object layout differs so one would have to look into how g++ can call our COM interfaces.
Now, both these roadblocks are solvable – (1) is just a lot of work and (2) is definitely possible (the VirtualBox team has even created binary wrappers between these compilers before) – but we have not yet looked too deeply into it.
All the code is there, feel free to try make it build and work.
Alternatively, you could use a package called “qtwin”, which is located here: http://qtwin.sourceforge.net/
This package is a port of the official Qt/x11 sources, which are GPL based, from Trolltech and uses the native Win32 API. It supports Cygwin, MinGW, MS Visual C++ and Borland host environments.
To use “qtwin” with VirtualBox, you have to do the following steps:
- Download the package from http://sourceforge.net/project/showfiles.php?group_id=49109&package_id=42335
- Make sure you installed and correctly set up one of the supported compiler environments on your machine
- Extract the “qtwin” package to <VBoxRoot>\tools\win.x86\qt\v3.3.3\
- Alternatively to 3., tell “configure.vbs” later where to find the package by using the “–with-qt=<PATH>” parameter
- Read the instructions how to build “qtwin” and build it (configure.bat)
- Qt should now also be found from “configure.vbs”. If not, check the log “configure.log” for errors
VirtualBox requires devices drivers and COM classes to operate. Whenever these change, you will have to reregister them. In order to reregister the COM classes, execute
which can be found in the output directory. Note that for this to work, VBoxSVC.exe must not be running, so use the Windows task manager to verify this. Usually VBoxSVC.exe terminates automatically after 5 seconds of inactivity (i.e. no client connection) but especially when developing, it might sometimes stay around. In case the COM classes change (this usually happens when the file VirtualBox.xidl is updated) and you forget to reregister the classes, weird problems may appear.
In order to install the VirtualBox kernel driver, issue the following:
Starting VirtualBox is accomplished by invoking one of its frontends, such as
Common Build Problems
Cygwin DLL Conflict
If you have cygwin installed on your computer, you might have problems building if your have active cygwin programs or you might have problems starting cygwin programs when the VirtualBox build is running. To fix this, copy the cygwin1.dll from your cygwin installation (usually c:/cygwin/bin/cygwin1.dll) to kBuild/bin/x86.bin/cygwin1.dll.
Latest posts by Editor (see all)
- How to Show files by size, biggest last- Linux Commands - January 21, 2011
- How to test for unreadable blocks on disk- Linux Commands - January 21, 2011
- How to Do a read speed test on disk sda – Linux Commands - January 21, 2011