Sandbox Installs

When testing programs compiled from source it is not necessary to install them into system directories. It is also possible to install them into a user-definable directory, a 'sandbox'. You can then have Linux prefer the binaries and libraries from that directory in favour of the system installed files. This is a nice method to test new code without screwing up your base installation. It also doesn't require root access to the machine.

Automated Sandboxing

Pieter has created an experimental sandbox installer, which is part of the current 2.0 branch: /branches/libffado-2.0/support/tools/ffado-sandbox-install.py Testing and reports are welcome!

Manual Sandboxing

Step 1: Creating the Sandbox

Warning

Only for advanced users!

Note

As far as I know these instructions are Linux specific.

Create a directory that is going to act as the sandbox. For example:

 $ mkdir ~/sandbox 

That's all.

Step 2: Have the system use the sandbox

It is important that you tell the system to use the sandbox before you start compiling anything. That way you will always use the programs and libraries that you compiled.

Initially the sandbox is empty, but that is not a problem. If a program or library isn't found in the sandbox, Linux will use the system-wide installed version.

In order to tell Linux where to find your sandbox binaries, you have to set the LD_LIBRARY_PATH, PKG_CONFIG_PATH and PATH environment variables.

I use this script (set_sandbox_env.rc):

#!/bin/bash
#

SANDBOX=$HOME/sandbox

LD_LIBRARY_PATH="$SANDBOX/lib"
PKG_CONFIG_PATH="$SANDBOX/lib/pkgconfig:$PKG_CONFIG_PATH"
PATH="$SANDBOX/bin:$PATH"

export LD_LIBRARY_PATH
export PKG_CONFIG_PATH
export PATH
export SANDBOX

Note that you can't just execute it, you will have to 'source' it like this:

$ source set_sandbox_env.rc

or

$ . set_sandbox_env.rc

Also note that you have to source this in every terminal that you want to use the sandbox binaries in, as the environment variables are separate in different terminals.

Filling the sandbox

Compiling code to into the sandbox is easy: just pass the location of the sandbox as the PREFIX-parameter once when compiling/configuring. For example:

 $ scons -h PREFIX=$HOME/sandbox [other parameters]

or if you use my .rc file:

 $ scons -h PREFIX=$SANDBOX [other parameters]

then the usual 'scons' and 'scons install' steps follow. Note that you don't have to run the scons install step as root in this scenario.

Using the sandbox

Once you have the environment variables set up correctly, you are using the sandboxed files.