VirtualBox Compilation

From SlackWiki
Jump to: navigation, search

VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use. It comes in two editions

  • Open Source Edition (OSE) - open-source licensed under GPLv2
  • Personal Use and Evaluation License (PUEL) - closed-source with additional features (USB support, Remote desktop support, ...)



This tutorial applies to slackware-current (-current after stable versions 13.1) and VirtualBox 4.0.x OSE


See this list

Below lies additional, not obvious or not mentioned prerequisites.

Source packages

Slackware packages

  • jdk
  • gcc-java


  • iasl - contained in SlackBuild acpica


Unpack sources somewhere

tar xjvf VirtualBox-x.y.z.tar.bz2 -C build/
cd build/VirtualBox-x.y.z_OSE/

Run configure script which will generate Makefile.kmk and scripts

$ ./configure --nofatal --disable-hardening --disable-docs

--nofatal configure won't stop on non-fatal errors; it usually fails on makeself variable

--disable-hardening - automatically set few symbolic links so you can run VirtualBox binaries from bin/ directory of your build environment; don't use this switch if you're building package for redistribution

--disable-docs - for some reason, build fails when building documentation. If you don't mind using online documentation it's safe to disable building it

Update build environment variables with auto-generated script

$ source ./

Now it's time to compile sources, but there are few pitfalls

Troubleshooting & Pitfalls


Slackware doesn't ship PAM, so you have to change one line in Config.kmk to disable it

if1of ($(KBUILD_TARGET), linux solaris)

Note: It's really blank space, 0 doesn't work as logical False

Java path

Inside Config.kmk there is block with few possible locations of JDK binaries. Unfortunately, JDK in Slackware has different path, so you have to add right path.

ifeq ($(KBUILD_TARGET),linux)
  ifeq ($(origin VBOX_JAVA_HOME),undefined)
   # Add correct detection for you distro after the /usr/../java-6-sun line.
   # Slackware JDK resides in /usr/lib/jdk1.6.0_23 (JDK 1.6 update 23; type what version suits you) 
   VBOX_JAVA_HOME := $(firstword $(wildcard \
	$(PATH_DEVTOOLS)/linux.x86/jdk1.6.0_21 \
	/usr/lib/jvm/java-6-sun  \
	/usr/lib/jvm/java-6-openjdk \
	/usr/lib/jdk1.6.0_23 \
	/usr/lib/jvm/sun-jdk-1.6 \
	) /usr/lib/jvm/java-6-sun)


Everything should be prepared by now. Type following command to build VirtualBox

$ kmk

Build VirtualBox kernel module

$ cd out/linux.x86/release/bin/src
$ make
$ su
$ make install
$ cd ..

Load kernel module (as root)

$ modprobe vboxdrv

Now you can start VirtualBox front-end from local bin/ directory

$ ./VirtualBox
Personal tools