Rate this page del.icio.us  Digg slashdot StumbleUpon

Building the XO: Introducing Sugar

by Greg DeKoenigsberg

One Laptop Per Child comes closer to being a reality every day — and every day, more people are looking for ways to get involved with the OLPC project. It will still be quite a while before the XO systems are available for broad distribution, but people can see for themselves what the XO is all about by downloading Sugar, the core of the OLPC Human Interface.

Sugar, for those who aren’t familiar with it, is very different from the desktop environment to which Linux users have become accustomed. The XO was conceived as a tool to allow kids to learn interactively, and Sugar has been designed for that purpose. The first thing that a child sees, therefore, is not a hard disk or a trash can — it’s the other kids in the “neighborhood”. Sugar developers are encouraged to write activities with collaborative elements that are enabled by default. The Human Interface Guidelines discuss the Sugar philosophy in some detail, but really, there’s no substitute for experiencing Sugar directly.

There are a few ways to take Sugar for a test drive. There are Live CD versions of Sugar, and there are also binary images that can be run in emulation mode with an emulation environment like qemu.

The best way to experience Sugar, though, is to build it from scratch — especially if you want to take the next step and develop activities for use with Sugar. Fortunately, building Sugar is getting easier with each milestone. Here are some pointers to get you started.

Sugar Basics

The first thing to understand about Sugar is that it’s based on the future Fedora 7 — which means that unless you’re one of the hardy souls who runs Fedora rawhide, you’re not going to be able to build Sugar on top of whatever Linux distribution you’re running currently without making a few tweaks. That’s part of being a developer: dealing with ever-changing environments.

Good tools help, though. The problem of managing lots of differently built components is a problem that GNOME developers face every day — which is why the Sugar developers have borrowed James Henstridge’s excellent jhbuild from the GNOME project and customized it for use with Sugar. Whether you’re running Fedora, Ubuntu, Debian or Mandriva, you can easily run sugar-jhbuild.

Really, sugar-jhbuild isn’t that complicated; it’s essentially a set of glue scripts that download source code from various repository types, build all that code, and put the resulting binaries into a local directory. The downside of the jhbuild approach is that you’re essentially building a miniature distribution from scratch — kind of like a mini-Gentoo — and that requires both disk space and time. The upside, though, is that the maintainers of the project do all the work of configuring sugar-jhbuild up front. All you have to do is run the scripts, maybe do a little troubleshooting, and be patient. Oh, and make sure that you have git, CVS and subversion installed.

Downloading the Sugar Builder

git-clone git://dev.laptop.org/sugar-jhbuild `date +%F`-SUGAR
cd `date +%F`-SUGAR

This is the first step: go get sugar-jhbuild by cloning its git repository. The sugar directory thus created (in the case of the above command, tagged with creation date) will be the home of your new Sugar environment. Source and binaries both will end up in this directory, so make sure you’ve got plenty of disk space allocated for it. The last version I built took 3 Gigabytes to download and build, so be prepared.

Bootstrapping the Sugar Builder

yum -y update
yum groupinstall "Development Tools"
yum groupinstall "X Software Development"

For Fedora Core 6 users, the preceding section is for you. Run the preceding yum commands as root; these will ensure that you’ve got all of the Fedora development packages required to bootstrap sugar-jhbuild. If you use another distro, your mileage will vary; run ./sugar-jhbuild sanitycheck to figure out what you need to install to run sugar-jhbuild for your particular distribution.

Downloading the Sugar Source

./sugar-jhbuild update meta-sugar-base
./sugar-jhbuild update

In this step, you will go get all of the source files you’ll need to build Sugar. The first command retrieves the source files for all of the dependencies required to build Sugar; the second command retrieves the source files for Sugar itself.

Note that it’s entirely possible to run the build scripts without explicitly downloading all of the source files first. The build scripts always update the source files anyway as part of the build process. So why should you run these updates first?

Because getting all the sources can take a while, and this can be the most frustrating part of the process. You’ll be pulling large chunks of code from a whole bunch of different sites. Some of these sites may be up; some of them may be down; some of them may be really, really slow. Maybe subversion will time out on you, and you’ll have to kill sugar-jhbuild, kill the subversion process, blow away that part of the source tree and start again. (Like, for instance: rm -rf source/libxml2; ./sugar-jhbuild update meta-sugar-base, which I did a half-dozen times.)

Once the source files have all been retrieved, though, the build steps can run largely unattended. Even if some of your source becomes outdated, it will be much easier to download a small source diff than an entire source tree.

Building the Sugar Binaries

./sugar-jhbuild build meta-sugar-base

Now it’s time to build Sugar’s direct dependencies: autoconf, python, pygtk, avahi, mozilla, and many others. These are all covered under the meta-sugar-base dependency established in sugar-jhbuild.

“But wait,” you say, “I already have all of these things installed on my system,” and so you do. But you’ve almost certainly got versions that Sugar isn’t interested in. For instance, I’m running Fedora Core 6, which has Python 2.4.4 running by default — but Sugar needs Python 2.5. Therefore, sugar-jhbuild will build Python 2.5, and other specific application versions required by Sugar, and will install these versions into the bin/ and/or lib/ directories in your Sugar directory.

So kick off that build. You might want to go to dinner now. Or maybe to bed. It’ll finish at some point, but don’t wait up. Mozilla alone can take several hours. But be patient; it’s worth the wait.

./sugar-jhbuild build

At long last, you’re finally ready to build Sugar and all of its activities.

This is actually the quickest part of the build. It’s also the part most likely to break, since the components here are most likely to be in flux at any given time. If your build breaks here, though, you’ve got immediate recourse; the friendly folks on the Sugar mailing list will be happy to help, especially if you’ve found a real bug. Which, at this early stage in Sugar’s life, could be quite likely.

Running Sugar

./sugar-jhbuild run

You’ve built it; now it’s time to run it. To run Sugar, use the sugar-jhbuild run command. This will set all of the necessary environment variables for Sugar. For instance, it will tell Sugar to use the custom-installed Python 2.5 instead of the likely system default of Python 2.4.

It may not be clear to you how Sugar works. That’s okay; it’s a very different environment than most Linux geeks are used to. If you need some hints, be sure to check out the release notes to understand the nuances of the Sugar interface; even though the notes were written for the actual XO itself, they apply to the Sugar software as well.

A few quick commands to get you started:

  • Alt-F makes the frame come and go.
  • Alt-C quits an activity.
  • Alt-0 brings up the developers console.
  • Alt-Q quits Sugar.

Again, if you find bugs, pop on to the Sugar mailing list and say hello. The growing Sugar community will be delighted to help you.

Next up: writing Sugar activities

All done for now; with patience and a bit of luck, your very own instance of Sugar should be installed and running. Have fun playing with Sugar and all of its activities.

Next time, we’ll focus on writing our first activity for the XO.

21 responses to “Building the XO: Introducing Sugar”

  1. Ioannis Vranos says:

    I downloaded the live-cd ISO (with the plain name) but it doesn’t run on my system (Error 13 or something). My system is PIII 1 GHZ, 1 GB RAM. I am running Scientific Linux 4.4 OK on it.

  2. Greg DeKoenigsberg says:

    Like I said, Ioannis… join the Sugar mailing list. And when you do, you’ll probably have to provide more info that “Error 13 or something”. :)

  3. jacob egevang says:

    Is it possible for private people to support the OLPC project with money?

  4. Joao Bosco says:

    Yeah … this article explains in 5 minutes what I took 2 weeks to learn. ;P


  5. Greg DeKoenigsberg says:


    It is possible to donate money; a non-profit for this purpose has very recently been established. Go to the Foundation site and give with your credit card.

    But bear in mind: your hands, and your time, are far more valuable.

    And Joao: it took me 2 weeks to learn, too. That’s why I wrote it all down. :)

  6. Reeny says:

    Downloaded “olpc-redhat-stream-development-build-239-20070118_1442-livecd.iso” and tried to run it under VMware player without success.
    Screen shots are here[ http://rsgeorge.f2s.com/sugar.jpg ]

  7. fred says:

    You said: “unless you’re one of the hearty souls”
    but I think you meant: “unless you’re one of the hardy souls”

  8. Rams says:


    The URL for the LiveCD is incorrect. The correct URL is

  9. Greg DeKoenigsberg says:

    Thanks to Fred for the sharp editorial eyes, and thanks to Rams for pointing out the typo in the URL. Both have been fixed.

    And Reeny, join the sugar mailing list. Really. That’s what it’s for — to receive feedback like this.

  10. Rebecca Fernandez says:

    If you get this error during the “Downloading the Sugar Source” step:

    *** error during stage checkout of telepathy-python: [Errno 2] No such file or directory *** [10/23]

    Then you also need to have darcs installed, which can be done via yum:

    yum install darcs

  11. gary says:

    Human Interface Guidelines

  12. Reeny says:

    Had some success with booting up “olpc-redhat-stream-development-build-301-20070310_2047-livecd.iso” [ http://rsgeorge.f2s.com/olp11ma07.jpg ].

  13. Danny says:

    Newbie question : what does XO stand for?

  14. gregdek says:

    XO doesn’t stand for anything — it’s the textual representation of the project’s icon. The “X” are the arms and legs; the “O” is the head. Thus, XO.

  15. Josh says:

    I keep getting 404 errors from the livecd URL. Thoughts?

  16. antoniob says:

    here is the url that works


  17. roracle says:

    What do you mean “based on the future fedora 7”?
    Also, maybe I’m just not understanding this, but, what exactly IS sugar? Is it a window manager? A complete graphical environment similar to xorg? I see that it uses cairo, avahi, and a couple of other additional libraries, so i’m just wondering what its base is.

  18. John (J5) Palmieri says:

    Sugar is the desktop environment. It consists of the UI and the supporting libraries and API’s. It is also a concept on how applications should look and feel.

  19. a says:

    how to start it?
    i’ve burn it on a cd and it don’t work

  20. Richard Stallman llama a seguir colaborando con la interfaz libre ( sugar) de las OLPC « Luna Antagónica says:

    […] Building the XO: Introducing Sugar – Red Hat Magazine 2007-02-23 […]

  21. jerry says:

    SugarLabs has a newer install for all to consider


    which has yet to work for me, package conflict between libffi-devel and gwrap-devel
    see http://dev.sugarlabs.org/ticket/884

    anyway thought people might want to know about anything new about the process since 2007.