From LiberateOS Wiki
Revision as of 14:26, 23 April 2017 by Bnoffer (talk | contribs) (1st full version)
Jump to: navigation, search

This section of the LiberateOS documentation is dedicated to the foundation of our work: the XobotOS project originaly undertaken by Xamarin and released to the public as open source in early May 2012.

The guide presented here is based on the projects official guides posted as part of the various README files on GitHub, but the information has been updated in order to create a proper build environment. You can find a proper list of references at the end of the guide.

Initial Setup

This guide uses Ubuntu 14.04 LTS as a starting point, we recommend setting it up in a virtual machine like Oracle VirtualBox, VMWare Workstaion/Fusion or Parallels Desktop. In the future we will be providing ready made VMs for download.

VM requirements

Setup a VM with the following parameters:

  • At least 2 virtual CPUs/Cores
  • At least 6 GB RAM
  • At least 50 GB disk space

Install Ubuntu

Install Ubuntu 14.04 LTS in the i386 version. Using the 64Bit version can lead to library confusion that we want to avoid at this point.

You can download the Network Install ISO file from here .

We recommend installing the system in english, but with your proper keyboard layout. Follow the instructions and install the standard Desktop environment. After the initial setup make sure to install the Guest Toold for your virtual machine, so you can properly interact with the VM.

Install prerequisites

Open a Terminal and install the build environment dependencies.

First we need to install Java 6. In order to do so add a ppa and execute the following command:

sudo add-apt-repository ppa:webupd8team/java

Now you need to install the package.

sudo apt-get update && sudo apt-get install oracle-java6-installer

Check the Java version by executing

java -version

The output should look similar to this:

java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 32-Bit Server VM (build 20.45-b01, mixed mode)

Back to a fresh terminal prompt. Install the main build tools with this command:

sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng libglu1-mesa-dev libfreetype6-dev

Development environment

Git setup

First of all setup Git by executing the following commands:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Replace "Your Name" and "you@example.com" with your name and E-Mail address as setup on GitHub. Note: No sudo this time! These settings apply to your user account directly.

Install IDEs

Now we have to install Eclipse:

sudo apt-get install eclipse-cdt eclipse-jdt

And now comes the Mono side of things, install MonoDevelop:

sudo apt-get install monodevelop

Install libpng14

Now that all these components are installed we have to add one additional library. XobotOS requires libpng14, but Ubuntu 14.04 LTS provides either libpng12 or libpng16, so we have to install this one manually.

You can download the source tareball from SourceForge here . Download the .tar.gz file and plice it into your home directory on the VM. Afterwards execute the following commands:

sudo cp ~/libpng-1.4.20.tar.gz /usr/src
sudo tar zxf libpng-1.4.20.tar.gz
cd libpng-1.4.20
sudo ./configure
sudo make
sudo make install

If everything went well calling libpng-config --version should return:


Install fonts

Next we need to install proper font support, first we have to install some Microsoft fonts:

sudo apt-get install ttf-mscorefonts-installer

Accept the end user agreement and the installer will do the rest. Then we need to add the Java 6 fonts to the system fonts. In order to do so execute the following:

sudo mkdir -p /usr/share/fonts/truetype/ttf-lucida
sudo find /usr/lib*/jvm/java-*/jre/lib -iname *.ttf -print -exec ln -s {} /usr/share/fonts/truetype/ttf-lucida \;

Eclipse memory limits

The last important step is to increase the memory limits for Eclipse. Open the eclipse.ini with the following command:

sudo nano /etc/eclipse.ini

At the end replace the two lines starting with -Xms and -Xmx with the following:


Now we are ready to build XobotOS!

Building XobotOS

This section is based upon the README.build in the GitHub project.

Setting things up

You need to create to separate Eclipse workspaces for this and checkout the XobotOS module in each of these.

We are using ~/xobotos/sharpen and ~/xobotos/build as part of this guide. Now we will check out the project from GitHub:

mkdir ~/xobotos
git clone https://github.com/LiberateOS/XobotOS.git ~/xobotos/sharpen
git clone https://github.com/LiberateOS/XobotOS.git ~/xobotos/build

If you start Eclipse for the first time, then it'll ask you for the workspace directory, select ~/xobotos/sharpen. Once it created that, you will be presented with a blank workspace.

In Eclipse, do File / Import / General / Existing Projects into Workspace, select ~/xobotos/sharpen as root directory, then it should offer you to import 5 projects. Select sharpen.core and sharpen.xobotos (sharpen.feature and sharpen.site are not used at the moment, and you do not want 'android' in this workspace). Make sure not to copy them into the workspace, that checkbox must not be checked.

When imported, you should see the 'sharpen.core' and 'sharpen.xobotos' projects.

Select Project / Build automatically.

Open sharpen.xobotos/plugin.xml. At the top of the "Overview" tab, you should see four buttons, the leftmost of these is "Launch an Eclipse application". Click it, and another instance of Eclipse will start.

The first time this inferior instance of Eclipse starts up, it will automatically create a workspace. Once the workspace is loaded do the import as described above, but select the ~/xobotos/build/android module.

You are now ready :-)

You only need to follow the instructions in this section the first time that you're running this in Eclipse. Eclipse remembers which projects you had open and your last run configuration, so when you come back, you can simply start Eclipse, then do Run / Run (or Run / Debug to debug it).

Running the builder

Well, that's easy.

Simply do Project / Build, then get some coffee or take a walk .... (normally build automatically is active by default, so Eclipse will start building automatically)

Current time for a full build is about 10 minutes on my machine.

When done, all the generated sources are placed in the output/ directory and XobotOS-debug.csproj is automatically updated. (for some unknown reason this is not happening, so we'll be using the XobotOS.sln instead)

Building the C# sources

There is a XobotOS-debug.sln file in the top level directory (/work/test/XobotOS/XobotOS-debug.sln), simply open this in MonoDevelop or use xbuild.

It is highly recommended to close the solution in MonoDevelop before doing a full build.

Building the C# sources from GitHub

You can also directly compile the C# sources from github:

After checking out or updating, simply open XobotOS.sln in MonoDevelop.

Note that there are two solutions:

  • XobotOS.sln uses the sources from github.
  • XobotOS-debug.sln uses the freshly convereted files from the android/output



This is a little bit complicated and still unstable, but here's how it should work:

Before we can go ahead and build the sources we have to check the linker flag for libpng14 by calling libpng-config --libs. If the result is -libpng we are good to go, but most likely it will be -libpng14. In case it is -libpng14 execute the following commands:

cd ~/xobotos/build
find ./ -name '*.gyp' -exec sed -i 's/lpng/lpng14/gI' {} \;

This will update all .gyp files to include libpng14 instead of the default libpng12.

Create a directory called 'build' if it doesn't already exist, cd into that directory, then run

cd .. && python gyp_xobotos

This will generate a Makefile in the build/ directory, running 'make' will build all the native Skia and Android code.

The output gets placed in build/Debug/.

Open XobotOS.sln or XobotOS-debug.sln in MonoDevelop (depending on whether you want to use the sources from github or the newly converted ones, see above) and build the solution.