Unable to compile VirtualBox with the source package? Get errors like the following?
$ ./configure --with-gcc=gcc422 --with-g++=g++422
Checking for environment: Determined build machine: linux.amd64, target machine: linux.amd64, OK.
Checking for kBuild: found, OK.
Checking for gcc: Checking for as86:
** as86 (variable AS86) not found!
Check if the following work helps. ;)
# Install necessary packages, including the following but not exhausive list. This requires root.
% yum install dev86 iasl pulseaudio-devel pulseaudio-libs-devel glibc-devel.i386 libX11-devel.i386 libXt-devel.i386 libXext-devel.i386 libXmu-devel.i386 compat-gcc-34 compat-gcc-34-c++ kernel-devel kernel-headers libxml2-devel libxslt-devel SDL-devel python-devel
# Obtain the source from http://www.virtualbox.org/wiki/Downloads
# Prepare and compile the source.
$ tar jxvf VirtualBox-2.0.2-OSE.tar.bz2
$ cd VirtualBox-2.0.2
$ ./configure --with-gcc=gcc34 --with-g++=g++34 # I was able to build with gcc424 and g++424 too.
$ source env.sh
$ kmk # This compiles the VirtualBox. You may do 'kmk -j 4' if you have a quad-core processor.
$ cd ./out/linux.ARCH/release/bin/src # ARCH depends on the architecture of your system.
$ make # This build the kernel module vboxdrv.
% make install # Requires root, to copy vboxdrv.ko to /lib/modules/`uname -r`/misc/vboxdrv.ko
# Load the VirtualBox kernel module.
% modprobe vboxdrv # Requires root.
# Create a group of users for accessing the VirtualBox.
% groupadd vboxusers # Requires root.
% chown root.vboxusers /dev/vboxdrv
% usermod -a -G vboxusers USERNAME # USERNAME is your account username who should have accesses to VirtualBox.
# Logout and login for the group information to get updated.
# Check if your user is in group vboxusers.
$ groups # This should show at least vboxusers
# Try running your newly built VirtualBox.
$ cd VirtualBox-2.0.2/out/linux.ARCH/release/bin
$ LD_LIBRARY_PATH=. ./VirtualBox
If you get the following error (happens in version 2.0.2),
VirtualBox: SUPR3HardenedMain: effective uid is not root (euid=500 egid=501 uid=500 gid=501)
try
% cd VirtualBox-2.0.2/out/linux.ARCH/release/bin
% chmod +s VirtualBox VBoxSDL VBoxHeadless
Save the script below to /etc/init.d/vbox and make sure it's executable. The script helps to load and unload the kernel module during system boot up and shutdown.
#!/bin/bash
### BEGIN INIT INFO
# Provides: vbox
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The Virtual Box kernel module
# Description: The Virtual Box kernel module
### END INIT INFO
start () {
echo -n $"Starting Virtual Box: "
modprobe vboxdrv
sleep 1
[ -c /dev/vboxdrv ] && chown root.vboxusers /dev/vboxdrv && echo " OK"
[ ! -c /dev/vboxdrv ] && echo "Failed"
return 0
}
stop () {
echo -n $"Stopping Virtual Box: "
[ -c /dev/vboxdrv ] && rmmod vboxdrv && echo " OK"
[ ! -c /dev/vboxdrv ] && echo
return 0
}
restart() {
stop
start
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
[ -c /dev/vboxdrv ] && echo "Virtual Box is loaded"
[ ! -c /dev/vboxdrv ] && echo "Virtual Box is not loaded"
;;
*)
echo $"Usage: vbox {start|stop|restart|status}"
exit 3
esac
exit 0
Then,
% chkconfig --add vbox # Add vbox as a service.
% service vbox status # Check if the Virtual Box module is loaded.
% service vbox start # Load the Virtual Box kernel module.
% service vbox stop # Unload the Virtual Box kernel module.
Though the script is rather ugly, it should work ok for our purpose.
Recent comments
2 weeks 2 days ago
10 weeks 3 days ago
13 weeks 17 hours ago
19 weeks 2 days ago
29 weeks 6 days ago
30 weeks 3 hours ago
31 weeks 1 day ago
42 weeks 1 day ago
42 weeks 1 day ago
1 year 17 weeks ago