Difference between revisions of "Compile the XAPI toolstack from source"

From Xen
(Comically out of date build instructions fixed (hopefully))
 
Line 1: Line 1:
  +
There are 2 reasonably simple ways to build XAPI and related components:
The easiest way to compile the XAPI toolstack from source is to use the xapi-autobuilder. We usually run on a debian unstable or ubuntu 11.10 amd64 machine.
 
  +
  +
== via opam ==
  +
  +
Opam is a source-based package manager which has a developer-friendly workflow. The following commands assume an Ubuntu host, update to match your distro of choice:
   
==Prerequisites==
 
Install the required packages:
 
 
<pre>
 
<pre>
apt-get install cowbuilder pbuilder debhelper dh-ocaml dh-autoreconf cdebootstrap
+
apt-get install opam -y
python-debian git git-buildpackage omake ocaml-findlib
 
 
</pre>
 
</pre>
   
  +
Next the dependencies of xapi can be installed:
==Building==
 
First, clone the build scripts:
 
   
 
<pre>
 
<pre>
  +
sudo apt-get install $(opam install xapi -e ubuntu)
git clone https://github.com/jonludlam/xapi-autobuilder.git
 
cd xapi-autobuilder
 
 
</pre>
 
</pre>
   
  +
Finally xapi itself can be built:
The build scripts can build for several different distributions and architectures. To select, run
 
   
 
<pre>
 
<pre>
  +
opam install xapi
export DIST=oneiric # or sid or precise
 
export ARCH=amd64 # or i386
 
 
</pre>
 
</pre>
   
  +
== via RPM ==
Then run:
 
  +
  +
The open-source XenServer "buildroot" has a convenient Makefile to build Xapi via RPM (and experimentally via .debs also):
  +
  +
On a CentOS 6 machine:
  +
 
<pre>
 
<pre>
  +
yum install -y epel-release
make
 
 
</pre>
 
</pre>
   
  +
After adding EPEL, install and set up mock:
   
  +
<pre>
This will build all of the required packages for Xapi on Debian. Take a look at 'git-repos' to see which repositories are involved, and modify that to point to your own repositories if you plan on compiling your own code.
 
  +
yum install -y mock redhat-lsb-core
  +
</pre>
  +
  +
Mock will refuse to run as root. You must choose a non-privileged user to run mock as. Type the following as root:
  +
  +
(Note select a <user> which isn't "mock" when typing the commands below)
  +
  +
<pre>
  +
useradd <user> -G mock
  +
passwd <user>
  +
su - <user>
  +
</pre>
  +
  +
You are now ready to clone the buildroot repository and build the packages:
  +
  +
<pre>
  +
git clone git://github.com/xenserver/buildroot.git
  +
cd buildroot
  +
  +
./configure
  +
make
  +
</pre>
   
 
[[Category:XAPI Devel]]
 
[[Category:XAPI Devel]]

Latest revision as of 17:23, 20 January 2015

There are 2 reasonably simple ways to build XAPI and related components:

via opam

Opam is a source-based package manager which has a developer-friendly workflow. The following commands assume an Ubuntu host, update to match your distro of choice:

apt-get install opam -y

Next the dependencies of xapi can be installed:

sudo apt-get install $(opam install xapi -e ubuntu)

Finally xapi itself can be built:

opam install xapi

via RPM

The open-source XenServer "buildroot" has a convenient Makefile to build Xapi via RPM (and experimentally via .debs also):

On a CentOS 6 machine:

yum install -y epel-release

After adding EPEL, install and set up mock:

yum install -y mock redhat-lsb-core

Mock will refuse to run as root. You must choose a non-privileged user to run mock as. Type the following as root:

(Note select a <user> which isn't "mock" when typing the commands below)

useradd <user> -G mock
passwd <user>
su - <user>

You are now ready to clone the buildroot repository and build the packages:

git clone git://github.com/xenserver/buildroot.git
cd buildroot

./configure
make