Sugar on Gentoo Linux: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Updates to reflect current building status)
Line 1: Line 1:
==Introduction==
==Introduction==


[[Sugar]] builds relatively reliably as of 2007-12-13 on Gentoo amd64 boxes using sugar-jhbuild, it is extremely likely that it would build on an x86 box as well.
There are two major approaches available to building Sugar on Gentoo Linux. In the first, you use Gentoo's Portage build system to update your Gentoo system to a state which is comparable to the environment on an OLPC laptop. Note that this involves upgrading past the point which Gentoo recommends as a stable configuration for a number of packages.

The second approach, which is not explored in detail here, is closer to that which is done for other Linux operating systems, namely using:

sugar-jhbuild build-base

to construct a parallel development environment which is used solely for the Sugar system. This builds approximately 180 packages before you begin the Sugar-specific build process. Unfortunately, because of the way jhbuild and sugar-jhbuild work this process will often fail when any one of the projects happens to check in broken code on their HEAD. The process outlined here avoids that problem somewhat by using relatively stable libraries from Gentoo's native portage.

==Installation==

[[Sugar]] can be built on an up-to-date Gentoo system by updating a number of the Gentoo system's libraries. These instructions are being updated on 2007-02-28 to reflect current build practice as successfully completed by the PyCon sprint. Test machine was an up-to-date x86 laptop with minimal ~x86 features added to support the Sugar environment. It requires a considerable period to build the system even on an up-to-date Gentoo machine, as the dependencies include large projects such as the Abiword word-processor and Mozilla's XULRunner.


==Prerequisites==
==Prerequisites==


You will need to emerge rather a lot of software, with many of the packages being ~x86 or hard-masked. For any package which is hard-masked, you will have to add the package to your /etc/portage/package.unmask file (which you may need to create).
You will need to emerge rather a lot of software, with many of the packages being ~x86/~amd64 masked or potentially hard-masked (none are as of 2007-12-13 for AMD64). For packages which are ~x86/~amd64 masked you will need to add them to your /etc/portage/packages.keywords file.

Please keep in mind that unmasking hard-masked files is strongly discouraged by Gentoo, and the project will generally *not* provide support for problems encountered with the software (i.e. ask on the Sugar lists before you ask on the Gentoo lists for hard-masked packages).


To unmask a hard-masked package, add a line such as the following to your /etc/portage/package.unmask file:
To unmask a hard-masked package, add a line such as the following to your /etc/portage/package.unmask file (note, the following are for example only, they are not needed as of 2007-12-13):


=net-misc/networkmanager-0.6.4_pre20061028-r1
=dev-libs/libnl-1.0_pre6
=dev-libs/libnl-1.0_pre6
=net-misc/dhcdbd-1.14-r1
=net-misc/dhcdbd-1.14-r1
=dev-lang/python-2.5-r1


To unmask a keyword-masked package, add a line with the full name of the package to your /etc/portage/package.keywords file, which by default adds the appropriate keyword for your architecture (~x86, ~amd64, etc):
To unmask a keyword-masked package, add a line with the full name of the package to your /etc/portage/package.keywords file, which by default adds the appropriate keyword for your architecture (~x86, ~amd64, etc):


dev-lang/python
dev-lang/python ~amd64
dev-python/setuptools
dev-python/setuptools ~amd64
net-libs/xulrunner
net-misc/networkmanager ~amd64
dev-libs/libnl ~amd64
net-misc/networkmanager
net-misc/dhcdbd ~amd64
dev-libs/libnl
dev-python/dbus-python ~amd64
net-misc/dhcdbd
dev-python/dbus-python


Note that you can use the full format (including comparison operator and version) as specified in the package.unmask file above as well.
Note that you can also use the full format (including comparison operator and version) as specified in the package.unmask file above if you want to prevent frequent updating of packages.

You will also need a 1.1.x series dbus available in the [http://overlays.gentoo.org/proj/gentopia/browser/overlay/sys-apps/dbus Gentopia Overlay]. This is easiest done by using layman.
emerge layman
layman -a gentopia
emerge dbus

Note: you may need to add sys-apps/dbus to the package.keywords file.


You will also likely need to specify USE flags for a number of packages. These are added to the /etc/portage/package.use file in a format like so:
You will also likely need to specify USE flags for a number of packages. These are added to the /etc/portage/package.use file in a format like so:
Line 55: Line 33:
=== Python 2.5 is Required ===
=== Python 2.5 is Required ===


You will need to upgrade your Gentoo installation to Python 2.5, then upgrade all of the packages dependent on Python (normally Python modules):
You will need to upgrade your Gentoo installation to Python 2.5, most Gentoo systems as of 2007-12-13 will already be running Python 2.5, but just in case you aren't yet:


emerge -avDt ">=dev-lang/python-2.5"
emerge -avDt ">=dev-lang/python-2.5"
Line 62: Line 40:
'''DO NOT''' skip the python-updater stage or you '''will''' have build failures later in the process. Packages will attempt to build against the old Python version and then get confused when "python" is the new version.
'''DO NOT''' skip the python-updater stage or you '''will''' have build failures later in the process. Packages will attempt to build against the old Python version and then get confused when "python" is the new version.


Note that Python is a core component of Gentoo's portage package management system. As such it is potentially possible that you could damage your system by using an unsupported Python version. Probably not a huge risk, but be careful!
Note that Python is a core component of Gentoo's portage package management system. As such it is potentially possible that you could damage your system by using a new Python version. Probably not a huge risk given 2.5 is now standard, but be careful!


Note that with more recent (2007-07-12) jhbuilds you may need to disable building Python in order to prevent conflicts between the jhbuild-based and platform Python (and GTK+). Create edit the file ~/.olpc.jhbuildrc to add the line:
Note that you may need/want to disable building Python in order to prevent conflicts between the jhbuild-based and platform Python (and GTK+). Create edit the file ~/.olpc.jhbuildrc to add the line:


skip = ['python','gtk+']
skip = ['python']


=== Emerge the prerequisites ===
=== Emerge the prerequisites ===
Line 72: Line 50:
Sugar requires a large number of standard Gentoo packages, you will need to emerge all of them in order to build the package:
Sugar requires a large number of standard Gentoo packages, you will need to emerge all of them in order to build the package:


layman -a liquidx # needed for json-py
emerge -avDt \
emerge -avDt \
dev-util/git\
dev-util/git\
cvs subversion\
cvs subversion\
docbook-sgml-utils\
gtk-doc\
gtk-doc\
avahi\
avahi\
Line 86: Line 62:
gnome-python-desktop\
gnome-python-desktop\
gnome-python-extras\
gnome-python-extras\
">=dev-python/dbus-python-0.80.1"\
dev-python/dbus-python\
boost\
boost\
darcs\
darcs\
Line 94: Line 70:
gst-python \
gst-python \
gst-plugins-theora \
gst-plugins-theora \
json-py
vte

Some other packages you may need to emerge:
emerge -avDt vte


You will also likely need to rebuild the x11-base/xorg-server package to build the "nested X servers" module, (particularly the "Xephyr" server which Sugar uses) this is done by specifying "kdrive" USE flag then rebuilding the server:
You will also likely need to rebuild the x11-base/xorg-server package to build the "nested X servers" module, (particularly the "Xephyr" server which Sugar uses) this is done by specifying "kdrive" USE flag then rebuilding the server:
Line 103: Line 76:
emerge -avDt --newuse xorg-server
emerge -avDt --newuse xorg-server


Lastly, you will need to have the json-py module installed. There is an [http://projects.liquidx.net/linux/browser/portage.local/dev-python/json-py/json-py-3.4.ebuild ebuild] available which you can use to produce a proper Gentoo package in an overlay locally. Or you can use layman:
You may also need the "dm-crypt" module compiled into your kernel. To check for the presence of the module (one of the dependencies claims it is required in a default Gentoo build):


emerge -avDt layman
modprobe dm-crypt
layman -a liquidx
emerge -avDt json-py


Or you can just unpack the [http://sourceforge.net/project/showfiles.php?group_id=137891&package_id=151451 source package] manually and copy the json.py file to your PYTHONPATH.
if this fails, enable the option in your kernel and rebuild the kernel with genkernel (or whatever you prefer for your kernel building pleasure):

Device Drivers
Multi-Device Support
Device mapper support
[*] Crypt Target Support

(Note that orospakr says that the dm-crypt module is not actually required).


=== Setup System Services ===
=== Setup System Services ===
Line 132: Line 100:


If you use the default "dhcpcd" module instead your network will connect, then immediately drop off when NetworkManager takes control of it.
If you use the default "dhcpcd" module instead your network will connect, then immediately drop off when NetworkManager takes control of it.

'''NOTE''' changing your network configuration can easily be messed up, you're a Gentoo user, we're assuming you know how to fix your machine while offline if the network configuration doesn't work! Particularly if you're on a laptop, wpa_supplicant can be a serious pain to configure.


== Sugar-jhbuild ==
== Sugar-jhbuild ==


Use of Sugar-jhbuild is detailed on [[Sugar#Build_from_sources|building Sugar from sources]]. To summarize those instructions, in order to build the absolute latest version of Sugar:
Use of Sugar-jhbuild is detailed on [[Sugar#Build_from_sources|building Sugar from sources]]. To get sugar-jhbuild:


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


To summarize the build instructions, in order to build the absolute latest version of Sugar:
Note, however, that building the very latest version of Sugar is not likely what you want to do '''unless''' you want to help in developing '''Sugar itself'''. We are fixing a few bugs to allow for building a non-bleeding-edge version of the project. Sugar will check out the source code and build approximately 24 packages using this approach, while this is a much smaller number than in a full build-base, it's still likely that you will see a failure in at least '''one''' package.

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


cd sugar-jhbuild
cd sugar-jhbuild
./sugar-jhbuild update
git-pull
./sugar-jhbuild build

The sanity checks are still very basic but better than nothing:


If you encounter an error during the installation of python-dbus regarding the types module not being importable, it is safe to ignore the error, the installation script is trying to compile Python modules, which is not necessary under sugar-jhbuild. Upstream is aware of the problem but hasn't fixed it.
./sugar-jhbuild sanitycheck


=== Testing sugar ===
=== Testing Sugar ===


When using [[Sugar_with_sugar-jhbuild|sugar-jhbuild]], you can use:
When using [[Sugar_with_sugar-jhbuild|sugar-jhbuild]], you can use:
Line 158: Line 123:
./sugar-jhbuild run
./sugar-jhbuild run


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


./sugar-jhbuild shell
./sugar-jhbuild shell


You can start the sugar shell from this environment with:
Then from the directory sugar-jhbuild/source/sugar), use:


shell/sugar
sugar-emulator


[[Category:Installing Sugar]]
[[Category:Installing Sugar]]

Revision as of 16:11, 13 December 2007

Introduction

Sugar builds relatively reliably as of 2007-12-13 on Gentoo amd64 boxes using sugar-jhbuild, it is extremely likely that it would build on an x86 box as well.

Prerequisites

You will need to emerge rather a lot of software, with many of the packages being ~x86/~amd64 masked or potentially hard-masked (none are as of 2007-12-13 for AMD64). For packages which are ~x86/~amd64 masked you will need to add them to your /etc/portage/packages.keywords file.

To unmask a hard-masked package, add a line such as the following to your /etc/portage/package.unmask file (note, the following are for example only, they are not needed as of 2007-12-13):

 =dev-libs/libnl-1.0_pre6
 =net-misc/dhcdbd-1.14-r1

To unmask a keyword-masked package, add a line with the full name of the package to your /etc/portage/package.keywords file, which by default adds the appropriate keyword for your architecture (~x86, ~amd64, etc):

 dev-lang/python ~amd64
 dev-python/setuptools ~amd64
 net-misc/networkmanager ~amd64
 dev-libs/libnl ~amd64
 net-misc/dhcdbd ~amd64
 dev-python/dbus-python ~amd64

Note that you can also use the full format (including comparison operator and version) as specified in the package.unmask file above if you want to prevent frequent updating of packages.

You will also likely need to specify USE flags for a number of packages. These are added to the /etc/portage/package.use file in a format like so:

 dev-util/subversion -apache2
 net-dns/avahi dbus python gtk
 dev-python/gnome-python-extras firefox
 x11-base/xorg-server kdrive
 net-wireless/wpa_supplicant -qt4

Python 2.5 is Required

You will need to upgrade your Gentoo installation to Python 2.5, most Gentoo systems as of 2007-12-13 will already be running Python 2.5, but just in case you aren't yet:

 emerge -avDt ">=dev-lang/python-2.5"
 python-updater

DO NOT skip the python-updater stage or you will have build failures later in the process. Packages will attempt to build against the old Python version and then get confused when "python" is the new version.

Note that Python is a core component of Gentoo's portage package management system. As such it is potentially possible that you could damage your system by using a new Python version. Probably not a huge risk given 2.5 is now standard, but be careful!

Note that you may need/want to disable building Python in order to prevent conflicts between the jhbuild-based and platform Python (and GTK+). Create edit the file ~/.olpc.jhbuildrc to add the line:

 skip = ['python']

Emerge the prerequisites

Sugar requires a large number of standard Gentoo packages, you will need to emerge all of them in order to build the package:

 emerge -avDt \
   dev-util/git\
   cvs subversion\
   gtk-doc\
   avahi\
   expat\
   gstreamer\
   xulrunner\
   pycurl\
   networkmanager\
   gnome-python-desktop\
   gnome-python-extras\
   dev-python/dbus-python\
   boost\
   darcs\
   fribidi \
   sqlite \
   numpy \
   gst-python \
   gst-plugins-theora \
   vte

You will also likely need to rebuild the x11-base/xorg-server package to build the "nested X servers" module, (particularly the "Xephyr" server which Sugar uses) this is done by specifying "kdrive" USE flag then rebuilding the server:

 emerge -avDt --newuse xorg-server

Lastly, you will need to have the json-py module installed. There is an ebuild available which you can use to produce a proper Gentoo package in an overlay locally. Or you can use layman:

 emerge -avDt layman
 layman -a liquidx
 emerge -avDt json-py

Or you can just unpack the source package manually and copy the json.py file to your PYTHONPATH.

Setup System Services

You will want to ensure that the required services are started at boot time as well. If you want to run sugar without rebooting you will want to start the services using their /etc/init.d/ scripts as well:

 rc-update add avahi-daemon default
 rc-update add NetworkManager default
 rc-update add dbus default
 rc-update add hald default

If you do not have these services running when you attempt to start Sugar you will get access exceptions from dbus as your regular user is not allowed to create these system-wide services.

You will also need to alter you /etc/conf.d/net configuration to specify the use of the NetworkManager compatible dhclient module. This should be the first line in the file:

 modules=("dhclient" "wpa_supplicant")

If you use the default "dhcpcd" module instead your network will connect, then immediately drop off when NetworkManager takes control of it.

NOTE changing your network configuration can easily be messed up, you're a Gentoo user, we're assuming you know how to fix your machine while offline if the network configuration doesn't work! Particularly if you're on a laptop, wpa_supplicant can be a serious pain to configure.

Sugar-jhbuild

Use of Sugar-jhbuild is detailed on building Sugar from sources. To get sugar-jhbuild:

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

To summarize the build instructions, in order to build the absolute latest version of Sugar:

cd sugar-jhbuild
./sugar-jhbuild update
./sugar-jhbuild build

If you encounter an error during the installation of python-dbus regarding the types module not being importable, it is safe to ignore the error, the installation script is trying to compile Python modules, which is not necessary under sugar-jhbuild. Upstream is aware of the problem but hasn't fixed it.

Testing Sugar

When using sugar-jhbuild, you can use:

./sugar-jhbuild run

If you want to run Sugar code from the shell/terminal/console:

./sugar-jhbuild shell 

You can start the sugar shell from this environment with:

sugar-emulator