VirtualBox Compilation

From SlackWiki
Revision as of 03:16, 9 February 2011 by Merge-delete (talk | contribs) (add missing step + few minor changes)
Jump to navigation Jump to 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, ...)

Disclaimer

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

Prerequisites

See this list

Below lies additional, not obvious or not mentioned prerequisites.

Source packages

Slackware packages

  • jdk
  • gcc-java

SlackBuilds

  • iasl - contained in SlackBuild acpica

Compilation

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 env.sh scripts

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

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

--disable-hardening - set some environment variable; use when you don't want to build package

--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 ./env.sh

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

Troubleshooting & Pitfalls

PAM

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

if1of ($(KBUILD_TARGET), linux solaris)
 # VBOX_WITH_PAM = 1
 VBOX_WITH_PAM = 
endif

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)
  endif
 endif

Build

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

$ kmk