VirtualBox

Version 25 (modified by Frank Mehnert, 15 years ago) ( diff )

--

Windows build instructions

As VirtualBox is a cross platform project, we use a cross platform build system meaning that there won't be any Visual C++ project files that you can open and just build. Instead, you have to follow these steps but they aren't overly difficult.

Prerequisites

  • Windows XP or Windows Server 2003.
  • Visual Studio .NET 2003 or Visual Studio 2005 with service pack 1.

Building VirtualBox

  1. Change to the root directory and execute our configure script to setup your build environment:
    cscript configure.vbs
    
    If The script finds all the tools necessary, it will output two files: AutoConfig.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.
  1. Change to the root directory of the sources and enter our build shell environment: env.bat.
  1. 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, enter kmk 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. See http://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

Qt

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:

  1. The code depends on ATL (again).
  2. 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:

  1. Download the package from http://sourceforge.net/project/showfiles.php?group_id=49109&package_id=42335
  2. Make sure you installed and correctly set up one of the supported compiler environments on your machine
  3. Extract the "qtwin" package to <VBoxRoot>\tools\win.x86\qt\v3.3.3\
  4. Alternatively to 3., tell "configure.vbs" later where to find the package by using the "--with-qt=<PATH>" parameter
  5. Read the instructions how to build "qtwin" and build it (configure.bat)
  6. Qt should now also be found from "configure.vbs". If not, check the log "configure.log" for errors

Running VirtualBox

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

comregister.cmd

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:

SUPUninstall
SUPInstall

Starting VirtualBox is accomplished by invoking one of its frontends, such as

VBoxSDL.exe

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.

Note: See TracWiki for help on using the wiki.

© 2023 Oracle
ContactPrivacy policyTerms of Use