Currently snapcraft doesn’t protect your host system from being polluted during the snapcraft build process. Your host can also potentially pollute your snap by providing libraries from the wrong OS image.

Snapcraft in fact (currently) requires that you only build on Ubuntu 16.04 (this will change in the future).

To overcome these problems you can use Docker (a container implementation) to do a build.

Note: lxd appears to be the preferred tool for doing cleanbuilds.
See Building with LXD

Using Docker, you’ll map the current directory into the container, then build a snap from that same directory.

First, install Docker using these abridged instructions. A more comprehensive guide can be found on the Docker website.

echo "deb ubuntu-trusty main" | 
sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-key adv \
       --keyserver hkp:// \
       --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt update
sudo apt install docker-engine

Next, make sure Docker is running:

sudo service docker status

You’re all set. Any time you want to build a snap, type the following commands to run snapcraft relative to the current directory:

sudo docker pull snapcore/snapcraft
sudo docker run -v "$PWD":/snapcraft_build -w /snapcraft_build snapcore/snapcraft 

Use existing Docker Image.

The snapcraft team have also published an pre-built docker image for snapcraft which you can find here: