VirtualBox on Solaris 10

[Image]
Windows XP running under VirtualBox

Getting VirtualBox 2.1.2 for Solaris

The instructions below help you compile and install 32-bit version of VirtualBox 2.1.2 for Sun Solaris 10.

Prerequisites

You will need the following tools to compile VirtualBox

Make sure that the tools are present and found in PATH. If necessary, add /usr/sfw/bin:/opt/sfw/bin to PATH and /usr/sfw/lib:/opt/sfw/lib to LD_LIBRARY_PATH so that the Freeware tools work.

Tip: you can use the check buttons at the end of each step to mark your progress. Reset all ticks

Prerequisites OK

GNU C/C++

VirtualBox does not work correctly when compiled with gcc 3.4.3 from Sun Freeware. Instead, gcc 3.4.6 must be installed temporarily. (Note that gcc 3.4.3 shared libraries are still required at run-time.)

Get gcc and configure

wget ftp://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2
bunzip2 -c gcc-3.4.6.tar.bz2 | gtar xf -
cd gcc-3.4.6/
mkdir obj
cd obj
../configure --prefix=/tmp/build  \
    --with-as=`which gas` --enable-languages=c,c++

Compile (~15 min)

time gmake

Install

gmake install
PATH=/tmp/build/bin:$PATH
cd ../..

Note that the compiler is installed to directory /tmp/build which is removed automatically at boot.

Done

SDL

VirtualBox requires SDL version 1.2.7 or higher. Compile and install SDL as

wget http://www.libsdl.org/release/SDL-1.2.13.tar.gz
gunzip -c SDL-1.2.13.tar.gz | tar xf -
cd SDL-1.2.13/
./configure --disable-static --prefix=/tmp/build --libdir=/opt/virtualbox-2.1.2
umask 022
gmake install
mv /opt/virtualbox-2.1.2/pkgconfig /tmp/build/lib
PKG_CONFIG_PATH=/tmp/build/lib/pkgconfig
export PKG_CONFIG_PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/virtualbox-2.1.2
export LD_LIBRARY_PATH
cd ..

Done

Qt

Get Qt and configure it as

wget ftp://ftp.trolltech.no/qt/source/qt-x11-opensource-src-4.4.3.tar.gz
gunzip -c qt-x11-opensource-src-4.4.3.tar.gz | gtar xf -
cd qt-x11-opensource-src-4.4.3
./configure -v -platform solaris-g++ --prefix=/tmp/build -shared \
    -libdir /opt/virtualbox-2.1.2 -L /opt/virtualbox-2.1.2 \
    -stl -largefile -tablet -sm -no-fontconfig \
    -nomake examples -nomake demos -nomake docs \
    -system-libjpeg -system-libpng -qt-libmng -system-zlib \
    -L /tmp/build/lib -L /usr/X11R6/lib -L /usr/openwin/sfw/lib \
    -I /tmp/build/include -I /usr/sfw/include -I /usr/openwin/share/include \
    -I /usr/X11/include

Accept license terms by typing yes.

Compile and install Qt separately (~1 hour)

time gmake
umask 022
gmake install
mv /opt/virtualbox-2.1.2/pkgconfig/* /tmp/build/lib/pkgconfig/
cd ..

Done

VirtualBox

Compile

Download VirtualBox 2.1.2 source code from virtualbox.org and unpack the distribution

umask 022
bunzip2 -c VirtualBox-2.1.2-OSE.tar.bz2 | gtar xf -
cd VirtualBox-2.1.2_OSE

Apply my patch for Solaris 10

wget http://softagalleria.net/download/virtualbox/virtualbox-2.1.2.diff
gpatch -p 1 -i virtualbox-2.1.2.diff

Configure

bash ./configure --build-libxml2 --build-libxslt --disable-hardening
source env.sh
SDK_LIBSDL_LIBS="SDL Xext Xrender X11"
PATH_SDK_LIBSDL=/tmp/build/lib
VBOX_XCURSOR_INCS=/tmp/build/include
export SDK_LIBSDL_LIBS PATH_SDK_LIBSDL VBOX_XCURSOR_INCS

Configure for Qt and dependent libraries

QTDIR=/tmp/build
LIB_QT="qt-mt Xrandr Xrender Xinerama Xft fontconfig freetype \
    png jpeg z ICE SM Xi X11"
export QTDIR LIB_QT

Compile VirtualBox (~30 min)

time kmk all

Check the output once again and do not continue if you see any errors. VirtualBox installs a kernel module, and your system may crash or fail to boot if the kernel module does not work.

Done

Install

Download guest additions

wget -O out/solaris.x86/release/bin/VBoxGuestAdditions.iso \
  http://download.virtualbox.org/virtualbox/2.1.2/VBoxGuestAdditions_2.1.2.iso

Login as root, cd to the package directory and install the VirtualBox kernel module

umask 022
cp out/solaris.x86/release/bin/vboxdrv /platform/i86pc/kernel/drv/
cp src/VBox/HostDrivers/Support/solaris/vboxdrv.conf /platform/i86pc/kernel/drv
add_drv vboxdrv
chmod 0666 /devices/pseudo/vboxdrv*
ln -s /devices/pseudo/vboxdrv\@0:vboxdrv /dev/vboxdrv

Install the run-time files as root

ver=2.1.2
cd out/solaris.x86/release/bin
mkdir -p /opt/virtualbox-$ver
cp -r * /opt/virtualbox-$ver/
rm -fr /opt/virtualbox-$ver/tst* /opt/virtualbox-$ver/testcase
chown -R root:root /opt/virtualbox-$ver

You should now be able to run VirtualBox as

/opt/virtualbox-$ver/VirtualBox

If VirtualBox works, you can remove the /tmp/build directory and sources as those are no longer needed.

Complete

Uninstalling VirtualBox

Use the instructions below to remove VirtualBox from your computer. If you are removing VirtualBox for the purpose of upgrading to a later version, be sure to shut down all virtual machines before uninstalling VirtualBox. You cannot pick up the guest operating system from a saved state once you install an newer version of VirtualBox. Instead, you will need to discard the saved state and this may have adverse effects to the guest operating system.

If you do want to remove VirtualBox, then first remove the kernel module as root

rem_drv vboxdrv
rm /platform/i86pc/kernel/drv/vboxdrv* 
rm /dev/vboxdrv

Remove program files as root

ver=2.1.2
rm -fr /opt/virtualbox-$ver

Version History

Feb 15, 2009: Updated the instructions for VirtualBox 2.1.2. The instructions for VirtualBox 1.6.2 are also available.

Jun 26, 2008: Updated the instructions and the patch file for VirtualBox 1.6.2. The installation instructions for VirtualBox 1.6.0 are also available.

May 13, 2008: Updated these instructions and the patch file for VirtualBox 1.6.0.

Apr 12, 2008: Updated the patch file. The latest version of VirtualBox now supports audio.

Mar 31, 2008: Checked that the patch file still compiles. Minor clarifications to this document.

Mar 21, 2008: Updated the patch file.

Mar 2, 2008: Added some tips on using VirtualBox on Solaris.

Feb 29, 2008: Updated the patch file. The patch disables some Solaris specific additions to cope with missing source files.

Feb 27, 2008: Innotek provides installation package for 32-bit OpenSolaris. The very same package might work for Solaris 10 too.

Feb 24, 2008: Compiled succesfully on Solaris u4.

Feb 20, 2008: Compiled succesfully on Solaris u1.