= Build instructions = This page describes how to build !VirtualBox OSE, once you have gotten its source code from our Subversion server, as described on the [wiki:"Downloads"] page). The sources are the same, no matter whether you build on Linux or Windows. But the build instructions differ. To build, use the `kmk` command after you have entered our development environment. This is the `make` command of [wiki:"kBuild"], our homegrown build system. (To avoid confusion with an already installed make program, our make has been renamed to `kmk`). With kBuild, the `BUILD_TYPE` environment variable determines what type is built and can be `release` (enable compiler optimizations, strip debug and profiling code), `debug` (for debugging) or `profile` (for profiling). The default is `release`. The default build target is `all`, which produces all executables in the `out/{platform}/{release|debug}/` directories. If you add the `packing` target, an installation package is built according to the requirements of your platform (see below). == Linux hosts == While we try to not favor any distribution, we only build with certain distributions. This includes Debian, Ubuntu, Gentoo and Red Hat Enterprise Linux. Things should not be much different for other distributions though. If you want to supply specific build instructions (especially package names) for other distributions, please contact InnoTek. === Prerequisites on Linux === You need: * GCC 3.2.3 or later (when using GCC 4.x, some precompiled objects will be used for the recompiler as they currently require GCC 3.x) * as86 (real mode assembler) * bcc (Bruce Evans C Compiler) * IASL (Intel ACPI compiler) * xsltproc (libxslt, XML style sheet processor) * libxerces (Xerces XML parser) * libxalan (Xalan XSL library, depends on Xerces) * Qt 3.3.x (with x >= 5 if possible) * libIDL * Relatively recent WINE (!VirtualBox uses some Win32 executables during the build process but this is optional) * libSDL (with sdl-ttf) * Optional: Doxygen 1.4+ On Debian, the following packets are required: {{{ apt-get install bcc iasl xsltproc xalan libxalan110-dev uuid-dev zlib1g-dev libsdl1.2-dev libxcursor-dev libqt3-headers }}} On Gentoo, run this: {{{ emerge -uav =qt-3* libIDL wine blackdown-jdk libsdl sdl-ttf DirectFB doxygen }}} === Building on Linux === 1. Change to the root directory of the sources and execute the configure script: `./configure`. If it finds everything it needs, it will create a file called 'Config.kmkconf' containing paths to the various tools on your system. Also, it will create an environment setup script called `configure.sh`. This step only has to be done once (if something changes in your build tool setup, you might have to repeat it but keep in mind that both output files will be overwritten). 2. Whenever you want to build !VirtualBox, you have to open a shell and source the generated environment setup script 'configure.sh', i.e. do {{{ . ./configure.sh }}} 3. To build a release package, type `kmk all packing`. This produces the installation package `out/linux/release/bin/VirtualBox.run`. (If you want to build a debug version, type `kmk BUILD_TYPE=debug all packing`.) 4. To install this package on your system, run it (as the superuser). So, for example, `cd out/linux/release/bin` and `sudo sh VirtualBox.run install`. === Running your installed build on Linux === The command sequence outlined above installs !VirtualBox in `/opt/VirtualBox-` and the Linux kernel module in `lib/modules`. A shell script wrapper called `VBox.sh` will be installed and symlinked to from `/usr/bin/VirtualBox` (and other symlinks), so you should be able to run `VirtualBox` from everywhere. You will need to load the Linux kernel module before running `VirtualBox`, so a `modprobe vboxdrv` will also be necessary. == Windows hosts == === Prerequisites on Windows === * Visual C++ version 7.1 or 8.0 and a matching Platform SDK. The express edition ''might'' do the job: http://msdn.microsoft.com/vstudio/express/visualc/ * Windows Server 2003 DDK (http://www.microsoft.com/whdc/devtools/ddk/default.mspx) * DirectX SDK (http://www.microsoft.com/downloads/details.aspx?familyid=C72D9F1E-53F3-4747-8490-6801D8E8B4EF&displaylang=en) * MingW GCC v3.3.x or v3.4.x with matching binutils, runtime, and w32api (http://www.mingw.org/download.shtml). To create the installation package: * .NET, version 2.0 recommended * Microsoft Windows Installer XML (WiX) toolkit: http://sourceforge.net/projects/wix/ * Microsoft Driver Installation Framework Tools (DIFx): http://www.microsoft.com/whdc/driver/install/DIFxtls.mspx === Building on Windows === 1. Change to the root directory of the sources and enter our build shell environment: `tools\env.cmd`. 2. To build a release package, type `kmk BUILD_TYPE=release all packing`. This produces the installation package `out\windows\release\bin\VirtualBox.msi`. 3. To install this package on your system, double-click on it to feed it into Windows Installer. If this fails for any reason, explicitly running `msiexec /i VirtualBox.msi /l* install.log` produces a log file which may hint at the cause. Some notes: During development it may be useful to register the necessary components by hand. Use the following commands with the windows host: {{{ regsvr32 VBoxC.DLL VBoxSVC /RegServer SUPUninstall SUPInstall }}} For uninstallation: {{{ regsvr32 /u VBoxC.DLL VBoxSVC /UnregServer SUPUninstall }}} When changing files be sure to have first a look in Windows Taskmanager if the `VBoxSVC` server is still running. This may happen if !VirtualBox didn't terminate correctly. A quicker alternative is to get `pskill` from http://www.sysinternals.com/Utilities/PsKill.html and simply kill `VBoxSVC` when uncertain whether it's running or not: {{{ pskill VBoxSVC }}}