How to build XVM VirtualBox under Linux
- GCC 3.2.3 or later (except for the GCC 4.0.x series)
- as86 (real mode assembler, usually part of the dev86 or bin86 package.)
- bcc (Bruce Evans C Compiler; often part of the dev86 package)
Note: The bcc compiler contained in openSUSE10.2 as part of dev86-0.16.0-218 is known to generated broken code. Unfortunately, bcc -v is not supported.
- IASL (Intel ACPI compiler)
- xsltproc (libxslt, XML style sheet processor)
- libxerces (only VBox version < 1.6, Xerces XML parser; the C++, not the Java version!)
- libxalan (only VBox version < 1.6, Xalan XSL library, depends on Xerces; again, the C++, not the Java version!)
- libxml2 (only VBox version >= 1.6, XML file handling)
- libxslt1 (only VBox version >= 1.6, XML file transformation)
- libXcursor (required to support color mouse pointers in guest)
- Qt 3.3.x (with x >= 5 if possible)
- ALSA (audio backend)
- PulseAudio (audio backend)
- libhal (detect host floppy/DVD)
- python2.5 (Python bindings)
On 64-bit systems you need the following packages as well:
- ia32-libs (various libraries needed for compiling the 32-bit guest additions)
- libc6-dev-i386 (libc6 i386 development headers)
- lib32gcc1 (gcc support for i386)
- gcc-multilib (gcc support for i386)
- lib32stdc++6 (libstdc++ for i386)
- g++-multilib (g++ support for i386)
On Debian-based systems, the following command should install the required packages:
- for VBox version < 1.6:
apt-get install gcc g++ bcc iasl xsltproc xalan libxalan110-dev uuid-dev \ zlib1g-dev libidl-dev libsdl1.2-dev libxcursor-dev \ libqt3-headers libqt3-mt-dev libasound2-dev libstdc++5 \ libhal-dev libpulse-dev
- for VBox version >= 1.6:
apt-get install gcc g++ bcc iasl xsltproc uuid-dev zlib1g-dev libidl-dev \ libsdl1.2-dev libxcursor-dev libqt3-headers libqt3-mt-dev \ libasound2-dev libstdc++5 libhal-dev libpulse-dev libxml2-dev \ libxslt1-dev python2.5-dev
On 64-bit Debian-based systems, the following command should install the required additional packages:
apt-get install ia32-libs libc6-dev-i386 lib32gcc1 gcc-multilib \ lib32stdc++6 g++-multilib
On Gentoo, the following should do:
emerge -av sys-devel/bin86 sys-devel/dev86 sys-power/iasl libxslt xerces-c \ xalan-c libXcursor =qt-3* libIDL libsdl hal alsa-lib pulseaudio
Note that VirtualBox makes use of YASM as its assembler which is part of the source repository as the currently available releases of YASM contain various bugs. As soon as a working release becomes officially available, we will add YASM to the list of prerequisites.
Building on a 64bit host still requires 32bit libraries and build tools as the Guest Additions which are part of the build process are 32bit. Note that on 64bit Ubuntu systems some links to shared libraries are missing. This can be fixed with
ln -s libX11.so.6 /usr/lib32/libX11.so ln -s libXTrap.so.6 /usr/lib32/libXTrap.so ln -s libXt.so.6 /usr/lib32/libXt.so ln -s libXtst.so.6 /usr/lib32/libXtst.so ln -s libXmu.so.6 /usr/lib32/libXmu.so ln -s libXext.so.6 /usr/lib32/libXext.so
On Linux distributions where gcc default to version 4.3 you need to specify a compatibility compiler for the recompiler directory. Known Linux releases are Debian/Lenny and openSUSE 11. Execute
on openSUSE 11 after you installed the packages cpp41 and gcc41 from the SUSE repository. Lenny ships packages for cpp-4.1/gcc-4.1 andcpp-4.2/gcc-4.2.
- Change to the root directory of the sources and execute the configure script:
If it finds everything it needs, it will create a file called ‘AutoConfig.kmk’ containing paths to the various tools on your system. Also, it will create an environment setup script called env.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).
- Whenever you want to build VirtualBox, you have to open a shell and source the generated environment setup script ‘env.sh’, i.e. do
- To build a release package, type
This produces the required binaries in out/linux.x86/release/bin/. If you want to build a debug version, type
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.
Running your build
You can run VirtualBox directly from the build target directory (out/linux.x86/release/bin/). But first of all, you must build and install the VirtualBox kernel module, whose sources will have been copied to the build target directory.
So, issue the following:
cd out/linux.x86/release/bin/src make sudo make install cd ..
Then it should have been installed to your modules directory and you can load it using modprobe vboxdrv. Make sure you give yourself read and write access to /dev/vboxdrv.
Finally, you can start one of the frontends, e.g.
Note that the LD_LIBRARY_PATH=. is required because we have to find our .so files and the output directory is not in the system’s library path.