Version 31 (modified by 12 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 7, Windows Vista, Windows Server 2003 or Windows XP SP3.
- Visual Studio 2010 with service pack 1.
- Windows Platform SDK v7.1
http://www.microsoft.com/en-us/download/details.aspx?id=8279
- Windows Driver Development Kit (WDK) v7.1.
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11800
- MingW (32-bit Windows only):
GCC 3.3.1: http://prdownloads.sf.net/mingw/gcc-core-3.3.1-20030804-1.tar.gz?download
and http://prdownloads.sf.net/mingw/gcc-g++-3.3.1-20030804-1.tar.gz?download
Runtime: http://prdownloads.sf.net/mingw/mingw-runtime-3.8.tar.gz?download
W32API: http://prdownloads.sf.net/mingw/w32api-3.5.tar.gz?download
Binutils: http://prdownloads.sf.net/mingw/binutils-2.13.90-20021006-2.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!
- GCC cross compiler targeting 64-bit linux (64-bit Windows only).
Not aware of any binaries available for download, so you have to build your own, unfortunately. (We're slowly working on removing this hurdle.)
- SDL v1.2.7 or later development package (VC6):
http://www.libsdl.org/download-1.2.php
- libxml2 and libxslt1 libraries. Sources and 32bit binaries can be downloaded from:
http://xmlsoft.org/downloads.html
http://xmlsoft.org/XSLT/downloads.html
- the zlib library. Grab the sources from:
http://www.zlib.net/
- the cURL library. Grab the binaries from:
http://curl.haxx.se/download.html
(use the devel version without SSL support)
- OpenSSL 0.9.8k. Grab the binaries from:
http://www.openssl.org/related/binaries.html
Building VirtualBox
- 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 andenv.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 inout\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. 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:
- 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
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
If you have installed the host interface and/or host-only VirtualBox kernel drivers, then you must uninstall them first (net*uninstall.exe), before uninstalling the VirtualBox kernel driver.
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.