Sugar on Ubuntu

From OLPC
Revision as of 07:55, 12 October 2007 by Ramvi (talk | contribs) (intro)
Jump to navigation Jump to search

So you want to try out Sugar on your Ubuntu machine? No problem! There are three installation options available.


The options

Option 1 - Emulated XO

An emulated XO laptop is the recommended platform both for "checking out" the Sugar environment and for developing new activities. By installing an emulation package on your (reasonably powerful) host desktop, you can run an emulated version of the Sugar environment which is essentially the same code as runs on the real laptops.

An emulated XO does not provide tools such as SVG editors or Integrated Development Environments. You will normally run such software on your host machine and push the results onto the emulated machine.

The emulated XO has certain limitations with regard to the specialized hardware in the XO. See the Developer's FAQ below for some pointers on how to simulate the special hardware.

Option 2 - sugar-jhbuild

Compared with using an Emulated XO, installing sugar takes more time and space to set up, and can be difficult to maintain, but results in a more flexible better environment. This is what the core development team uses. If you are intending to work on the core system you will likely need to use sugar-jhbuild to set up your environment.

On 32-bit Linux

sugar-jhbuild no longer supports building "base" libraries, so to get a working Sugar using jhbuild you will need to be running an OS that provides compatible versions of the various libraries that Sugar requires.

As of 2007-08-17 the only two distributions known to be able to support sugar-jhbuild are Fedora 7 and Ubuntu Feisty Fawn (or Greater). It seems likely that Gentoo could be made to work with some effort, but no successful build there has been reported in a number of months.

It is also possible to run one of these "just works" distributions in emulation under another operating system (Windows/Mac/Linux) using any of a number of emulators (Parallels, Qemu, VMWare).

At the moment, a Fedora 7 install with sugar-jhbuild is probably the most "sure" bet for getting a working full-speed (non-emulated) working environment for developing on Sugar with the latest libraries and solid upgrade path. As most of the core developers are working on Fedora boxes with sugar-jhbuild it is the most likely environment to be supported and continue to receive support.

On 64-bit Linux (not working)

As of 2007-08-17 it is not possible to build Sugar on 64-bit Linux. This appears to just be minor configuration issues in the build process.


Option 3 - Deb Packages for Gutsy

Using this is, at the time being, not recommended. The sugar package doesn't depend on the libraries it really needs. Hence you are stuck to finding and getting them yourself. This will leave you with a very unclean installation. Not only that: the Sugar package is not up to date. Therefor the Sugar with sugar-jhbuild is recommended.

There are packages of Sugar and of about a dozen activities in this archive . To install

 $sudo -s
 #echo "deb http://ppa.launchpad.net/jani/ubuntu gutsy universe" > /etc/apt/sources.list.d/sugar.list
 #apt-get update
 #apt-get install sugar-emulator sugar-{calculate,write,memorize,connect,chat,read,web,newsreader,measure,pippy,paint,record,turtleart}-activity

The repo is not signed so you'll need to say 'y' when asked by apt-get

Then you can either run sugar-emulator or when logging in choose the Sugar session in the display manager (tested with GDM)


apt-get the prerequisites

You need a number of packages from the Ubuntu repositories. Some of these packages are not available for the stock Ubuntu install, and you will need to enable the universe and multiverse repositories. (You can do this by either using the Synaptic Package Manager, or simply editing /etc/apt/sources.list, but don't forget to reload afterwards.)

Dapper

 sudo apt-get install build-essential cvs docbook-utils subversion libgtk2.0-dev libidl-dev \
   gnome-common gtk-doc-tools libxt-dev automake1.7 automake1.8 automake1.9 python-gtk2-dev \
   python2.4-avahi git-core cogito python-dev avahi-utils \
   libgconf2-dev xserver-xephyr libgnome2-dev libmatchbox-dev python-cairo-dev \
   libtiff4-dev python-gnome2-dev libxdamage-dev libxdamage1 libxcomposite-dev \
   libgnomeui-dev libtool libfribidi-dev libgsf-1-dev libbz2-dev libwmf-dev \
   libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgnomeprintui2.2-dev \
   libenchant-dev libnspr-dev darcs libxslt1.1 libxslt1-dev firefox firefox-dev \
   libasound2-dev sqlite3 libsqlite3-dev libssl-dev libncurses5-dev \
   bison flex libtheora-dev libtheora-bin libboost-dev

Edgy

 sudo apt-get install build-essential cvs docbook-utils subversion libgtk2.0-dev libidl-dev \
   gnome-common gtk-doc-tools libxt-dev automake1.7 automake1.8 automake1.9 python-gtk2-dev \
   python-avahi git-core cogito python-dev avahi-utils \
   libgconf2-dev xserver-xephyr libgnome2-dev libmatchbox-dev python-cairo-dev \
   libtiff4-dev python-gnome2-dev libxdamage-dev libxdamage1 libxcomposite-dev \
   libgnomeui-dev libtool libfribidi-dev libgsf-1-dev libbz2-dev libwmf-dev \
   libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgnomeprintui2.2-dev \
   libenchant-dev libnspr-dev darcs libxslt1.1 libxslt1-dev firefox firefox-dev \
   libasound2-dev sqlite3 libsqlite3-dev libssl-dev libncurses5-dev \
   bison flex libtheora-dev libtheora-bin libboost-dev

Feisty

 sudo aptitude install libloudmouth1-0 libloudmouth1-dev libdbus-glib-1-2 \
   libdbus-glib-1-dev darcs libsqlite3-dev libtheora-dev libxml2-utils libboost-dev \
   automake1.7 bison flex cvs libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev \
   libssl-dev xserver-xephyr libgtk2.0-dev libfribidi-dev libgsf-1-dev \
   libenchant-dev libasound2-dev libtiff4-dev libxt-dev docbook-xsl \
   libgconf2-dev libgnutls-dev intltool libpoppler-dev libpoppler-glib-dev \
   g++ python2.5-dev libtool gtk-doc-tools python-gtk2 python-gtk2-dev \
   python-avahi libavahi-client-dev libavahi-glib-dev liboil0.3-dev \
   libxslt1-dev libglade2-dev automake1.9 python-cairo-dev python-all-dev \
   libncurses5-dev gstreamer0.10-alsa python-gst0.10 subversion python-vte \
   ncurses-dev libsvn-dev gnome-doc-utils python-numpy python-numpy-dev \
   python-json libcurl3-dev libgnome-vfs-dev libxres-dev libxres1

Gutsy

  git-core automake1.9 cvs python-json python-numpy libdbus-glib-1-dev python-cairo-dev\
  automake1.7 bison flex libtool subversion darcs g++ gettext libpoppler-glib-dev\
  libgstreamer-plugins-base0.10-dev xserver-xephyr libavahi-glib-dev libjpeg62-dev \
  libtiff4-dev libsqlite3-dev python-avahi  libfribidi-dev libenchant-dev \
  libgnutls-dev libboost-dev libxslt1-dev libgsf-1-dev libasound2-dev libssl-dev\
  libxt-dev libgtk2.0-dev libgconf2-dev  liboil-dev libtheora-dev libncurses5-dev\
  python-gnome2-dev libglade2-dev gtk-doc-tools libavahi-client-dev

Even with the universe and multiverse enabled you can have some problems installing these packages. You can fix them using the sources.list generator that you can find on www.ubuntu-nl.org.

There may be more packages required; if you find any more, please append them to this list.

Note:I needed to install libgnomeui-dev version 2.16.1, libgnomeuimm-2.6-1c2a, and 
libgnomeuimm-2.6-dev. I no longer get the error "package libgnomeui-2.0 cannot be found" 
however I still encounter other errors [chundevi]
I was building an Edgy-based VM from a debootstrap base and using Edgy packages. I needed to install librsvg2-common before sugar would run.

Note: If you get the error "package python-avahi not available" try this- On PPC, I used the following command:

sudo apt-get install build-essential cvs docbook-utils subversion libgtk2.0-dev libidl-dev \
gnome-common gtk-doc-tools libxt-dev automake1.7 automake1.8 automake1.9 python-gtk2-dev git-core python-dev libgconf2-dev libgnome2-dev \
python-cairo-dev libtiff4-dev python-gnome2-dev libxdamage-dev libxdamage1 libxcomposite-dev libgnomeui-dev libtool libfribidi-dev \ 
libgsf-1-dev libbz2-dev libwmf-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgnomeprintui2.2-dev libenchant-dev \
telepathy-gabble python-telepathy xserver-xephyr python-setuptools python-sqlalchemy \
matchbox-window-manager

Xapian

Start Avahi

(not needed on Dapper) Then you must ensure that the Avahi daemon is enabled and running. Execute:

sudo vim /etc/default/avahi-daemon

and ensure the directive "AVAHI_DAEMON_START" is set to 1. Then execute:

sudo /etc/init.d/avahi-daemon start

Packages from Gutsy

Edit your /etc/apt/sources.list to include 'gutsy' repositories (main and universe), then upgrade/install:

sudo aptitude install python-dbus python-telepathy
Why is this necessary? jhbuild includes dbus-python and telepathy-python... --morgs

Build non-packaged code

On my Feisty Ubuntu box, I had to install the g++ compiler to get some of the following packages to work. Use the following if you have any trouble:

sudo apt-get install g++
./sugar-jhbuild buildone -a loudmouth
./sugar-jhbuild buildone -a datastore
./sugar-jhbuild buildone -a xapian-core         # note: you need libxapian15, not libxapian13
./sugar-jhbuild buildone -a xapian-bindings
./sugar-jhbuild buildone -a pyxapian
./sugar-jhbuild buildone -a artwork
./sugar-jhbuild buildone -a hippo-canvas
./sugar-jhbuild buildone -a sugar
./sugar-jhbuild buildone -a presence-service

Using Sugar-jhbuild

Use of Sugar-jhbuild is detailed on building Sugar from sources. To summarize those instructions:

git-clone git://dev.laptop.org/sugar-jhbuild
cd sugar-jhbuild
./sugar-jhbuild

If you had already checked out sugar-jhbuild previously, make sure your copy is up-to-date before building:

cd sugar-jhbuild
git pull

Troubleshooting

automake version mismatch

The following solution also applies in other situations. I ran into it when attempting:

./sugar-jhbuild build-base

make died while building fontconfig on a Ubuntu Dapper box with a missing separator error.

During the building task you may get the following error:

error during stage configure of matchbox-window-manager:....[9/12]

This error happens because Ubuntu uses the automake 1.4 version in contrast with matchbox-window-manager which uses the automake 1.9 version. In order to bypass this error you can execute the following command:

sudo update-alternatives --config automake

You will get the following list with the asterisk being at the 1 selection

There are 3 alternatives which provide `automake'.
  Selection    Alternative
 +    1        /usr/bin/automake-1.4
      2        /usr/bin/automake-1.7
 *    3        /usr/bin/automake-1.9
Press enter to keep the default[*], or type selection number:

Here you should press the button 3 and the try again to build sugar.

Mozilla Build Error

You may get stuck at a Mozilla build error - I did on Edgy AMD64. Two ways to resolve the problem, either:

 sudo aptitude install libxul-dev

which may not work, or copy the Mozilla or Firefox .pc files in /usr/lib/pkgconfig to xulrunner-*.pc files (You may only need to create xulrunner-gtkmozembed.pc and not the rest...). Either way, then, build with ./sugar-jhbuild build -s mozilla to skip building Mozilla from source. I have not yet completed a full Sugar build, though, so these instructions may just be masking a problem. --RP

Building libabiword

If you get an error like

 *** Building libabiword *** [24/35]

<...>

    I can't seem to figure out which platform you are using.

    You should probably try using the autoconfiscated build system (rather
    than this, the deprecated and unsupported diving make system) by running
    configure (creating it with autogen.sh if need be) and using GNU Make.
    Using configure is a requirement for all known platforms that aren't some form
    of Windows, QNX Neutrino, or MacOS X.

just choose the "configure" option. This error shows up (probably) because AbiWord has a regular Makefile setup for building on Windows in addition to AutoConf stuff for nearly every other platform, so it is just "faking out" jhbuild in all likelyhood.

git, the SCM

On Ubuntu 6.06 Dapper Drake, git has been deprecated. You have to run the following command to get git to work properly.

sudo update-alternatives --config git
Select option #2: git-scm

network manager error

If, after running ./sugar-jhbuild run you get the following error:

DBusException: Connection ":1.12" is not allowed to own
the service "org.freedesktop.NetworkManagerInfo" due to
security policies in the configuration file

you have two solutions

Method 1 : Install NetworkManager

You want to ensure that the NetworkManager is

  • installed
sudo apt-get install network-manager
  • reachable by console applications, in file /etc/dbus-1/system.d/NetworkManager.conf add
<allow own="org.freedesktop.NetworkManagerInfo"/>

after

<policy at_console="true">
  • started, by restarting the whole dbus
sudo /etc/init.d/dbus restart

Method 2 : Only provide .conf file

Copy the configuration file to /etc/dbus-1/system.d . Restart the dbus as above.

os.py not finding sugar-emulator folder

The error message is:

 ./sugar-jhbuild run
 Traceback (most recent call last):
 File "./sugar-jhbuild", line 11, in ?
   main.main(sys.argv[1:])
 File "/home/barbolo/Desktop/sugar/sugar-jhbuild/main.py", line 104, in main
   jhbuild.commands.run(command, config, args)
 File "/home/barbolo/Desktop/sugar/sugar-jhbuild/build-scripts/jhbuild/jhbuild/commands/__init__.py", line 74, in run
   return cmd.execute(config, args)
 File "/home/barbolo/Desktop/sugar/sugar-jhbuild/build-scripts/jhbuild/jhbuild/commands/base.py", line 238, in execute
   os.execlp(args[0], *args)
 File "/usr/lib/python2.4/os.py", line 324, in execlp
   execvp(file, args)
 File "/usr/lib/python2.4/os.py", line 341, in execvp
   _execvpe(file, args)
 File "/usr/lib/python2.4/os.py", line 379, in _execvpe
   func(fullname, *argrest)
 OSError: [Errno 2] No such file or directory

The solution:

Edit the archive sugar-jhbuild/main.py:

Change line 101:

args.append('sugar-emulator')

for

args.append('/home/barbolo/Desktop/sugar/sugar-jhbuild/source/sugar/sugar-emulator')


Note that /home/barbolo/Desktop/sugar is where my sugar-jhbuild folder is located, so you may change it!

Testing sugar

When using sugar-jhbuild, you can use:

./sugar-jhbuild run

If you want to run Sugar from the source tree enter in a jhbuild shell:

./sugar-jhbuild shell 

Then use:

sugar-shell