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

From Xen
(Comically out of date build instructions fixed (hopefully))
 
Line 1: Line 1:
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.
+
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:
 +
 
 +
<pre>
 +
apt-get install opam -y
 +
</pre>
 +
 
 +
Next the dependencies of xapi can be installed:
  
==Prerequisites==
 
Install the required packages:
 
 
<pre>
 
<pre>
apt-get install cowbuilder pbuilder debhelper dh-ocaml dh-autoreconf cdebootstrap
+
sudo apt-get install $(opam install xapi -e ubuntu)
  python-debian git git-buildpackage omake ocaml-findlib
 
 
</pre>
 
</pre>
  
==Building==
+
Finally xapi itself can be built:
First, clone the build scripts:
 
  
 
<pre>
 
<pre>
git clone https://github.com/jonludlam/xapi-autobuilder.git
+
opam install xapi
cd xapi-autobuilder
 
 
</pre>
 
</pre>
  
The build scripts can build for several different distributions and architectures. To select, run
+
== 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:
  
 
<pre>
 
<pre>
export DIST=oneiric # or sid or precise
+
yum install -y epel-release
export ARCH=amd64 # or i386
 
 
</pre>
 
</pre>
  
Then run:
+
After adding EPEL, install and set up mock:
 +
 
 
<pre>
 
<pre>
make
+
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>
 
</pre>
  
 +
You are now ready to clone the buildroot repository and build the packages:
  
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.
+
<pre>
 +
git clone git://github.com/xenserver/buildroot.git
 +
cd buildroot
 +
 
 +
./configure
 +
make
 +
</pre>
  
 
[[Category:XAPI Devel]]
 
[[Category:XAPI Devel]]
 
[[Category:Development Process]]
 
[[Category:Development Process]]

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