ZeroVM gcc toolchain
How to build the full toolchain from scratch
Install Prerequisites
On Debian and Ubuntu, you will want to install these packages:
sudo apt-get install libc6-dev-i386 libglib2.0-dev pkg-config git \
build-essential automake autoconf libtool g++-multilib texinfo \
flex bison groff gperf texinfo subversion
Install ZeroMQ version 3.2.4 or greater. You can either install it through these packages:
http://zvm.rackspace.com/v1/repo/ubuntu/pool/main/z/zeromq3/libzmq3_4.0.1-ubuntu1_amd64.deb
http://zvm.rackspace.com/v1/repo/ubuntu/pool/main/z/zeromq3/libzmq3-dev_4.0.1-ubuntu1_amd64.deb
or you can install it manually (don't forget to sudo ldconfig
after install) by following the
ZeroMQ installation guide.
Setup Environment Variables
You need to set them up prior to building anything. We'll use the following variables:
ZEROVM_ROOT
: should point to git clone ofzerovm
repositoryZVM_PREFIX
: should point to an empty writable directory all files will be installed here aftermake install
ZRT_ROOT
: should point to git clone ofzrt
repository
We will use these values for this guide:
export ZEROVM_ROOT=$HOME/zerovm
export ZVM_PREFIX=$HOME/zvm-root
export ZRT_ROOT=$HOME/zrt
Clone Things
git clone https://github.com/zerovm/zerovm.git $ZEROVM_ROOT
git clone https://github.com/zerovm/validator.git $ZEROVM_ROOT/valz
git clone https://github.com/zerovm/zrt.git $ZRT_ROOT
git clone https://github.com/zerovm/toolchain.git $HOME/zvm-toolchain
cd $HOME/zvm-toolchain/SRC
git clone https://github.com/zerovm/linux-headers-for-nacl.git
git clone https://github.com/zerovm/gcc.git
git clone https://github.com/zerovm/glibc.git
git clone https://github.com/zerovm/newlib.git
git clone https://github.com/zerovm/binutils.git
Build ZeroVM
cd $ZEROVM_ROOT/valz
make validator
sudo make install
cd $ZEROVM_ROOT
make all install PREFIX=$ZVM_PREFIX
Build Toolchain
cd $HOME/zvm-toolchain
make -j8
If something goes wrong you will need to delete everything
(apart from zerovm and validator) in the $ZVM_PREFIX directory and
only then do make clean
and make
(this is how the gcc
toolchain works, sadly).
Example of cleanup procedures:
cd $HOME/zvm-toolchain
make clean
cd $ZVM_PREFIX
rm -fr *
cd $ZEROVM_ROOT
make install PREFIX=$ZVM_PREFIX
Now you can run zerovm tests
export PATH=$ZVM_PREFIX/bin:$PATH
cd $ZEROVM_ROOT
./ftests.sh
Install Debugger
Debugger prerequisites:
sudo apt-get install flex bison groff libncurses5-dev libexpat1-dev
cd $HOME/zvm-toolchain/SRC
git clone https://github.com/zerovm/gdb.git
cd gdb
mkdir BUILD
cd BUILD
../configure --program-prefix=x86_64-nacl- --prefix=$ZVM_PREFIX
make -j4
make install