LBE - LTSP Build Environment
The LBE is the set of tools that we use to build LTSP from the ground up. By utilizing the LBE, you can build (or rebuild) LTSP and it will be compatible with the official LTSP packages, because it will be using the same compilers, linkers and other tools that we used to build the official packages. You can also use the LBE to build additional applications and packages not originally distributed with LTSP.
LBE For LTSP-4.2
Instructions for 4.2 can be found
here.
LBE For LTSP-4.1
LBE Overview
- Download the source from CVS
- Change to ../lbe directory
- (Optional) Download packages before building, run ./build_all --fetch
- Run ./build_all; go get coffee
- cd ltsp-src
- ./build --makepkg
- cd ../packages
- cat *.ltsp > packages.list
That will leave all of the package files in
lbe/packages.
You can then use
ltspadmin, and go into the configuration screen and point the source url to
file:///usr/local/lbe/packages
To make your own package:
- mkdir ../lbe/ltsp-src/yourpkg
- Create package.def in ../lbe/ltsp-src/yourpkg directory
- In ../lbe/ltsp-src, run ./build --only=yourpkg to compile
- ./build --only=yourpkg --makepkg
- Now you have a package in ../lbe/packages
- cd ../packages
- cat *.ltsp > packages.list
Installing and Building LBE
You will need to get the current LBE source from CVS. It can be retrieved from CVS with the following command:
cvs -d :pserver:anonymous@cvs.ltsp.org:/usr/local/cvsroot checkout -r LTSP_just_before_4_2 lbe
or for newest and greatest..
cvs -d :pserver:anonymous@cvs.ltsp.org:/usr/local/cvsroot checkout lbe
The CVS should give you a directory called ../lbe. Cd to ../lbe and run ./build-all. This will build the LBE toolchain and environment. Consider doing something else for a while because it is going to take a long time.
I have changed the tag in the example above to 'LTSP_just_before_4_2', because we're actively committing changes for LTSP-4.2, and there are some significant changes that won't work in a LTSP-4.1+ environment. (jam - Oct 8, 2005)
Caution
Due to the time between the LTSP 4.1 release and now, some of the source archives URLs will have moved from where LBE expects them to be. Currently the only solution is to manually hunt down the new URL and fix it in the package.def. As of March 08, 2005, here are the package.def files that need to be changed and the suggested source archives URLs:
| Package File | Outdated Archive Source | Suggested Updated Archive Source |
| ../lbe/ltsp-src/samba/package.def | us1.samba.org/samba/ftp/, etc. | us1.samba.org/samba/ftp/old-versions/, etc. |
| ../lbe/ltsp-src/xorg/package.def | freedesktop.org/~xorg/X11R6.7.0/src/ | ftp.x.org/pub/R6.7/tars/ |
| ../lbe/kernel-src/syslinux | ftp.kernel.org/pub/linux/utils/boot/syslinux/ | ftp.kernel.org/pub/linux/utils/boot/syslinux/Old/ |
How long does it take?
Well, that depends on how fast your server is. Here's what we know:
| Hardware | Operating System | Kernel | Build Time | When | Who |
| P4-3.4Ghz 2GB ram | Debian Testing | 2.6.8 | 119min 13sec | Dec 7, 2004 | jam@Ltsp.org |
| Sony Vaio PCG-TR3AP - 1.1Ghz Pentium-M - 512MB | Debian testing | 2.6.8 | 257min 21sec | Dec 12, 2004 | jam@Ltsp.org |
| Dual P3 1Ghz 2GB ram | Debian Testing | 2.6.7 | 304min 8sec | Dec 13, 2004 | jam@Ltsp.org |
| P4-2.4ghz 1GB ram | Ubuntu - Hoary | 2.6.10 | 216min 56sec | Apr 9, 2005 | jam@Ltsp.org |
| VIA 600Mhz 1GB ram | Gentoo 2005.1 | 2.6.12 | 24hours | Aug 19, 2005 | Daniel Fort |
| Athlon64 3400+ 2GB ram | Gentoo 2005.1 (in x86 chroot) | 2.6.12 | 150min 4sec | Aug 21, 2005 | Daniel Fort |
| Xeon 3Ghz 1GB ram | Debian Sarge | 2.6.8 | 116min 31sec | Oct 5, 2005 | Asashi |
| P4 2x3.6Ghz 4GB ram (using --cpus=1) | Redhat Enterprise 4 | 2.6.9 | 176min 13sec | Oct 17, 2005 | ryan.ordway@oregonstate.edu |
| AMD Opteron 240 @ 1.3GHz 4GB ram | Debian Sarge | 2.6.10 | 146min 39sec | Nov 15, 2005 | Mikko Kokkonen |
| AMD Athlon XP 2800+ 1GB RAM | Fedora Core 3 | 2.6.12-1.1381_FC3 | 92min 02sec | Dec 07, 2005 | alexandre@debian-ce.org |
| Pentium M 1.73 Ghz 1 GB Ram in HP Laptop | Ubuntu 5.10 | 2.6.12-10-686 | 131min 55sec | Mar 30, 2006 | Steve Switzer |
Using LBE
Now you should have a complete LBE toolchain to work with. Let's walk through creating an application called
foo-1.2.
Create the Package Directory
Step one is to create the package directory in LBE. Change to the ../lbe/ltsp-src. Here you would create a directory called
foo.
Create the package.def File
In the directory called
foo you would create a file called
package.def. This file would contain all the information need to build package
foo. The
package.def name is lowercase, remember Linux is case-sensitive. When one of the ./build scripts is run, LBE chroots the environment to ../lbe directory. Each directory (../lbe, ../lbe/kernel-src, ../lbe/lbe-src, ../lbe/ltsp-src) has a ./build script. When run without switches they will build every package.def under their source tree.
Below is a list of required variables needed to make
package.def:
REQUIRED VARIABLES
| Variable | Use |
| PKG1 | archive name |
| MD5SUM1 | MD5 checksum for package |
| SOURCE1 | download source for archive |
| UNPACK1 | how to unpack archive |
| BUILDDIR | name for build directory |
| SOURCEDIR | unpacked source code directory |
| CONFIGURE | configure command |
| BUILD | build command |
| INSTALL | install command |
| CLEAN | how to clean up the build |
When preparing
package.def, keep in mind that each application is built as if you where starting in the application directory. This means that all directory variables are relative to the application directory. Assume we had application
foo-1.2 in directory
foo, and wanted it to build in ../foo/foo-build. We would set the to
BUILDDIR = foo-build,
not to
BUILDDIR = foo/foo-build.
You can reference a variable within another variable declaration by enclosing that variable in
${}. For example, to reference the variable
PKG1, you would use
${PKG1}.
The basic
package.def file for
foo might look like this:
#
# package.def file for building package foo-1.2 in the LTSP build environment
#
PKG1 = foo-1.2
MD5SUM1 = 234235sdf34fwer34234r2w3e
SOURCE1 = ftp://ftp.bar.baz/${PKG1}
UNPACK1 = bunzip2 < ${TARBALL} | tar xf -
BUILDDIR = foo-build
SOURCEDIR = foo-1.2
CONFIGURE = ../${SOURCEDIR}/configure --prefix=/usr
BUILD = make all
INSTALL = make install
CLEAN = rm -rf ${BUILDDIR} ${SOURCEDIR}
#
# EOF
#
Then from the ../lbe/ltsp-src directory you would run ./build --only=foo. If you want to make a clean rebuild you would run ./build --only=foo --clean, followed by ./build --only=foo.
Caution
The biggest gotcha is that any tool needed to build a package must be in the LBE directory. The LBE ./build scripts use chroot extensively to build the packages. You do this in the same way as you build in the ltsp-src directory to be sure all the linked libraries are in sync.
Notes for Specific Distributions
Debian
If you want to build the LBE, be aware that it takes quite a while to do, and there are certain required packages that you'll need on your server.
I originally built the LBE on a Redhat 7.3 machine, and then moved up to a RH-9 machine. By default, all the stuff I needed was included, so life was good. But then, I moved my development environment over to Debian-testing, and things didn't go so well. The LBE just wouldn't build. Mostly, failing when building bison and fileutils. It would fail with 'multiply defined symbols'. After a lot of digging, and some help from Ragnar Wisloff, I finally found that I was missing the
gettext package on my Debian box. I installed
gettext and that solved the problem. Then, I found a few other packages I needed, that supplied header files, and the LBE was back in business.
Here is a quick list of the packages that I had to install on my Debian-testing box. Other distros will probably need a similar set of packages.
- gettext 0.14.1-6
- libncurses5-dev 5.4-4
- zlib1g-dev 1.2.2-3
The versions that I listed are the versions that I used, and I know will work. It's entirely possible, and quite probable that other versions will work Ok too.
--
JimMcQuillan - 07 Dec 2004
Here is the complete list of packages required for successful build on a stock Debian Sarge:
- cvs
- wget
- bzip2
- perl
- perl-modules
- make
- libdigest-md4-perl
- patch
- gcc
- gettext
- m4
- bison
- flex
- libncurses5-dev
- zlib1g-dev
--
ThomasConstans - 16 Dec 2004
Ubuntu Hoary Hedehog - From the beginning
Here are notes on building
LBE on a fresh Ubuntu Hoary system.
I started with a bare machine, and loaded Hoary on it. I went through the complete install.
Here's the steps I took:
- Edit the
/etc/apt/sources.list file, and comment out the 1st line, which points to the cdrom.
- Install some packages
apt-get update
apt-get install cvs
apt-get install bison
apt-get install flex
apt-get install gcc
apt-get install libncurses5-dev
apt-get install zlib1g-dev
- Pick a location to put the LBE tree. Keep in mind that this is going to require alot of disk space. At least 5GBytes of freespace is needed. For this example, I'll use
/usr/local.
cd /usr/local
- use CVS to grab the LBE source tree:
cvs -d :pserver:anonymous@cvs.ltsp.org/usr/local/cvsroot checkout lbe
- Change into the
lbe directory:
cd lbe
- Fetch all the tarballs:
./build_all --fetch
- Run the complete build:
./build_all
The last step above will take quite a while to run. Probably several hours, depending on how powerful your build machine is.
Once it's finished, you can make package files by running this:
cd ltsp-src
./build --makepkg
cd ../packages
cat *.ltsp >packages.list
That will leave all of the package files in
lbe/packages.
You can then use
ltspadmin, and go into the configuration screen and point the source url to
file:///usr/local/lbe/packages
--
JimMcQuillan - 09 Apr 2005
Ubuntu Breezy
Make sure you have the lbe/crosscomp-src/build script of at least version 0.4. It's needed so that the correct version of gcc is checked for and used to start the build.
apt-get update
apt-get install cvs
apt-get install gettext
apt-get install build-essential
apt-get install bison
apt-get install flex
apt-get install gcc-3.4
apt-get install libncurses5-dev
apt-get install zlib1g-dev
mkdir /usr/local/projects
cd /usr/local/projects
cvs -d :pserver:anonymous@cvs.ltsp.org:/usr/local/cvsroot checkout lbe
cd lbe
./build_all --fetch
./build_all
cliebow@ltsp.org - Updated by
JimMcQuillan 20 Jan 2006
Mandrake
On Mandrake 9.2, you have to install nasm and byacc
--
JohnNew - 08 Mar 2005
The list of required packages for Debian Sarge (above) holds true for Mandrake 9.x and 10.x.
--
NetRix - 10 Mar 2005
Fedora Core 3 (and Other 2.6 Kernel Distributions)
When trying to build on Fedora Core 3, there is a problem with glibc (both lbe-src/glibc and crosscomp-src/glibc). This is because the kernel headers are included, and the 2.6 kernel headers have a check to make sure they are never used in userspace.
To fix this I changed glibc's package.def to include the glibc headers instead:
--enable-kernel=2.4.0 \
+ --with-headers=/usr/include \
--host=i386-linux \
a similar change ought to make it work on most 2.6 based distributions.
--
JesperRibbe - 08 Jan 2005
There has been much scrutiny over the use of kernel headers over time, and in the 2.6 kernels they've started the enforcement (which is a good thing.
Mariusz Mazur started a project a while back to maintain the de-kernelfied headers. He maintains a list at:
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/
There's no real instructions for how to use them on the site, but at least with Fedora (and I think most distributions) you do the following (assuming kernel 2.6.10-1.766_FC3 - I had to use his 2.6.10.0 headers, which worked fine but I'm expecting an update soon):
cd /lib/modules/2.6.10-1.766_FCE/build;tar xvfj ~/linux-libc-headers-2.6.10.0.tar.bz2
This will untar the tarball into the build directory and overwrite all of the include files with include files that are "sanitized" for non-kernel developers.
This seems to be the preferred approach to how people are doing it, but it also seems rather broken to me. Having built kernels since the pre-0.99 days, I can say that I don't think this is the altogether right solution, but I'm also no longer a kernel developer, so I don't have a say.
--
DaveFenwick - 04 Mar 2005
Much of this article is based on a set of notes by Evan Hisey. You can see it
here.
Gentoo
Since some files downloaded by ./build_all (may) already exist in /usr/portage/distfiles, create a symlink from your distfiles directory to tarballs to save downloading time.
Contributed package.def files
This is a place for people to put package.def files for various things that they've built with the
LBE
If you have a package.def file, please add it as an attachment, and include a link here. Thank you.
VOIP/CallCenter package.def files
I have compiled 2 VOIP softphone package,
kiax and
twinkle. I prefer
twinkle as it seems to integrate with
KDE better. I have also read a Linux Journal article demonstrating
kphone, but have yet to get it to compile. They should be compiled in the order listed and in the
ltsp-src or
lbe-src directory as specified. These defs also create a seperate ltsp-root in the lbe/tmp/packages directory for easy install.
--
LottCaskey - 21 Jun 2006
kiax package.defs
twinkle package.defs
--
LottCaskey - 21 Jun 2006